11

Does anyone know where to find a summary table or cheatsheet for the Linux system call in Assembly? I am invoking Linux system calls through the int 0x80 instruction and I need a quick reference to determine which register contains which value from time to time.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
smwikipedia
  • 61,609
  • 92
  • 309
  • 482
  • 1
    You don't really need one, you just need to know the calling convention (e.g. ebx, ecx, edx, etc. for the 32-bit ABI) and the C argument order. [What are the calling conventions for UNIX & Linux system calls (and user-space functions) on i386 and x86-64](https://stackoverflow.com/q/2535989) (Plus the Notes section of the man page that comments on any differences between the C interface and the kernel, e.g. for brk/sbrk, or the way `getpriority(2)` encodes the return value to avoid negative values because those mean error.) – Peter Cordes Sep 16 '20 at 11:49
  • Related: https://unix.stackexchange.com/questions/421750/where-do-you-find-the-syscall-table-for-linux – Ciro Santilli OurBigBook.com Nov 28 '20 at 13:08

3 Answers3

23

Here's an archive of a really good online reference with links to documentation and kernel source code.

Makyen
  • 31,849
  • 12
  • 86
  • 121
Dean Harding
  • 71,468
  • 13
  • 145
  • 180
2

The system calls can also be found in /usr/include/asm/unistd.h, which will point you to unistd32.h or unistd64.h

automaton
  • 1,091
  • 1
  • 9
  • 23
0

And here's one more that's more easily navigable:
http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html

A scripting way to find out for your current machine:

ls /usr/share/man/man2 | sed -e s/.2.gz//g | xargs man -s 2 -k  | sort | grep -v 'unimplemented system calls'

Credit - http://www.cs.fsu.edu/~langley/current-system-calls.html

fcdt
  • 2,371
  • 5
  • 14
  • 26
SidJ
  • 669
  • 12
  • 29