[arch-general] system call numbers on amd64

Michael Krauss hippodriver at gmx.net
Sun Jun 29 07:18:41 EDT 2008


Hello arch users!

I am running Arch64:
[mickraus at gandalf lib]\$ uname -m
x86_64

Looking into /usr/include/asm/unistd.h, it uses unistd_64.h on AMD64.
According to this file the _exit syscall has number 60. But on my
machine I have to use syscall 1 instead, as listed in unistd_32.h.

Here is an example code for nasm (the version in extra repo is far
deprecated by the way, had to compile a newer version by myself):

; tiny.asm
BITS 64
GLOBAL _start
SECTION .text
_start:
	mov	eax,1
	mov	ebx,42
	int	0x80

This works. But changing the 1 to 60 breaks.
Build procedure:

[mickraus at gandalf elf]\$ nasm -f elf64 tiny.asm
[mickraus at gandalf elf]\$ gcc -s -Wall -nostdlib tiny.o
[mickraus at gandalf elf]\$ ./a.out; echo $?
42

What is my error here?


Kind regards,
Michael Krauss




More information about the arch-general mailing list