I just looked on the net on linux system calls numbers, and I found different numbers whether it is a 32 bits or 64 bits linux version.

Why did Linux change the ordering of system calls ?? wouldn't that make the compatibility between 32 bits and 64 bits linux programs harder to achieve ??

More informations :

  • Here is the websites where I found the system calls numbers : 32 bits linux , 64 bits linux .

  • I also found the system calls numbers in linux system, in theses two files : /usr/include/asm/unistd_32.h and /usr/include/asm/unistd_64.h .

Edit : I wrote a 32 bits assembly hello world program :

assembly program

I compiled it with the command nasm -f elf32 prog.asm && ld -m elf_i386 prog.o, it compiles and execute normally. Then I compiled the same program with the command nasm -f elf64 prog.asm && ld -m elf_x86_64 prog.o expecting it to crash, but It did the same thing as the first program, it wrote "Hello World!" to the default output.

How is it possible that the 64-bits program used the same system calls as the 32-bits program (although the system calls table is different for the two architectures).

  • Maybe you can find some hints in this wiki page. It is stated that "Implementing system calls requires a control transfer from userspace to kernel code, which involves some sort of architecture-specific feature" so they are different with the exception of one: __NR_syslog 103. – Hastur Mar 31 '16 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.