Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do you check the prototypes of syscalls on x86-64 machines?

That is, how do you know

how many parameters a specific syscall expects,

which register each parameter should be in,

and finally what each parameter means?

Is there a man alike command to tell you that?

like image 683
new_perl Avatar asked Dec 22 '11 02:12

new_perl


People also ask

What syscall 64?

syscall is an instruction in x86-64, and is used as part of the ABI for making system calls. (The 32-bit ABI uses int 80h or sysenter , and is also available in 64-bit mode, but using the 32-bit ABI from 64-bit code is a bad idea, especially for calls with pointer arguments.)

What is the system call number for the exit system call on Kali 64 bit Linux?

The exit syscall is number 60 .

Where is the syscall table Linux?

Solved using the following approach: The system call table is located in arch/x86/syscalls/syscall_32. tbl for the x86 architecture.

What is syscall in NASM?

syscall(2) is a glibc wrapper function for system calls, and the syscall man page also documents is asm ABI for various Linux platforms (x86-64, SPARC, ARM, etc.), including registers for the call number and ret val, and the instruction for entering the kernel.


1 Answers

see also: What are the calling conventions for UNIX & Linux system calls on x86-64

What you are looking for is the kernel ABI, I can't find the official site, but there is a blog with info like this.

In x64 with int 80h call, it is:

value   storage
syscall nr  rax
arg 1   rdi
arg 2   rsi
arg 3   rdx
arg 4   r10
arg 5   r9
arg 6   r8
like image 124
J-16 SDiZ Avatar answered Sep 30 '22 12:09

J-16 SDiZ