bzerostrcatisalphaisdigitisalnumisasciiisprinttouppertolowerputs(obviously, you can use the write syscall)
strlenmemsetmemcpystrdup(obviously you are allowed to call malloc)
To conclude, you must code a ft_cat function which will take a file descriptor (for
example 0...) as argument and that will have the same behavior as the cat command it’ll
return void.
- Stack must be 16-bit aligned.
- Symbols must be prefixed with an underscore (e.g. _printf).
- Syscalls on x86_64 uses the same opcodes as x86.
- Syscall opcodes must be offset by x200000, i.e. a syscall to write (usually 0x4) would be 0x2000004 (2, five 0's, 4).
Tutorial on nasm assembly, covers plenty of topics:
Stack?
- https://eli.thegreenplace.net/2011/02/04/where-the-top-of-the-stack-is-on-x86/
- https://eli.thegreenplace.net/2011/09/06/stack-frame-layout-on-x86-64/
Sample code:
Complete tutorial (lots of useful information but overall not extremely reliable information):
- https://www.tutorialspoint.com/assembly_programming/index.htm
- https://www.tutorialspoint.com/assembly_programming/assembly_strings.htm (especially useful for mem* operations like memcpy (see next point!))
strlen (a little extra info on rep and scasb):
Syscalls/interfacing with Linux:
- https://en.wikibooks.org/wiki/X86_Assembly/Interfacing_with_Linux#syscall
- https://syscalls64.paolostivanin.com/
Architecture (describes register purposes):
x86 opcode and instruction set reference:
- http://ref.x86asm.net/ (see the table near the top of the page for the differences between the versions)
Not exactly sure what this is but I used the x86-64 psABI version 1.0 document for register reference on p. 23 (version 1, Jan 28, 2018). The document contains a lot of information on the x86-64 architecture:
Debugging:
Some answers that cleared up confusion for me:
And, of course, there is always the official documentation:
- nasm (available in pdf and html format)
- Intel assembly (also available in pdf format, link at the top of the article)
- Intel® 64 and IA-32 Architectures Software Developer’s Manual (all volumes)