System calls
From WhitixDoc
In Whitix, the system calls are the services provided by the kernel; it is essentially a kernel API. In general, these system functions are wrapped by C functions in the librtl library, but it is possible to use system calls directly.
Contents |
Call method
Unlike in Linux, parameters are passed through the stack rather than registers. However, for a system call to succeed, several registers must contain certain values:
| Register | Value |
|---|---|
eax
| System call index. See the list |
ecx
| Number of bytes in argument stack |
edx
| Address of argument stack. |
With the argument stack laid out in the typical C way (last argument pushed first and so on), an int $0x30 is then issued. After the system call returns (if it does), a return value is placed in eax.
List
There is a list of system calls in kernel/sys.c and user/librtl/sysdefs.h. This is a complete list, with links to the description of each system function.
Filesystem
Memory
Task management
Time
eax Name Source First arg. 41 SysGetTime arch/i386/kernel/time.cstruct Time*
Network
eax Name Source First arg. Second arg. Third arg. Fourth arg. 42 SysSocketCreate net/socket.cintintint- 43 SysSocketBind net/socket.cintvoid*int- 44 SysSocketConnect net/socket.cintvoid*int-
- This short article needs expansion or improvement. Why not help?
Miscellaenous
eax Name Source First arg. 51 SysShutdown kernel/reboot.cint52 SysIoAccess arch/i386/kernel/ioperms.cint