Note: Switching to Intel syntax. Only vecsum.asm
is up to date right now.
To build a program, e.g vecsum.asm
make vecsum
bin/vecsum
echo $? # to check the return code
Before exit, every program pushes the result to the top of the stack. Set breakpoint
at _exit
to inspect.
- Caller saved: RAX, RCX, RDX
- Callee saved: RBX, RDI, RSI, RBP, RSP
- Push arguments in reverse order
-
NASM Tutorial by Ray Toal
-
Programming from the Ground Up by Jonathan Bartlett
-
x86 and amd64 instruction reference by Felix Cloutier
-
x86 manpages - Generated from Felix Cloutier's reference
-
See
man syscall
for calling conventions. Seeman syscalls
for a list of syscalls. To find the number of a syscall, refer to/usr/include/asm/unistd.h
.
- Basic GDB Tutorial by Hoa Nguyen
- Use GDB Enhancement Features for a less painful experience.