I have a simple NASM program that only calls sys_exit :
segment .text global _start _start: mov eax, 1 ; 1 is the system identifier for sys_exit mov ebx, 0 ; exit code int 0x80 ; interrupt to invoke the system call
When I first wrote this, I made a mistake and forgot the space between int and 0x80 :
int0x80
... but the program is still compiled without problems!
[prompt]> nasm -f elf MyProgram.asm [prompt]> ld -o MyProgram MyProgram.o
He just gave me a segmentation error when I ran it!
[prompt]> ./MyProgram Segmentation fault
So what does this program - the original one that I wrote, with the missing space - do? What does int0x80 (without space) mean in NASM?
segment .text global _start _start: mov eax, 1 mov ebx, 0 int0x80 ; no space...
assembly syntax nasm interrupt
Richard JP Le Guen
source share