System calls

Kernel contains mechanism of using kernel services.

This mechanism (commonly known as system calls, or syscalls) can be used to call system services only from userspace code running in thread context. It is not possible to call these services from within ISR context.

Function-like Macros

Unknown member type eSysCalls

Function-like Macros

__SYSCALL

This gives the function some common attributes. Currently syscall entrypoint are short functions which never get inlined and don’t construct stack frame. This is the most efficient method of calling syscalls right now.

___SVC(no)

__SVC(no, ...)

Function-like Macros

SYSCALL_DEFINITION

Attribute used to publish syscall definitions in a way that os_syscall can process them.

typedef int(*) Syscall_Handler_t(unsigned long, unsigned long, unsigned long, unsigned long)

int os_system_call_init(void)

int os_system_call(unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long arg3, uint8_t syscall_id)

Execution of system call is a portable action. It translates into calling a function determined by checking the syscall table. This function will call the syscall and return the return value it provided.

arg0 1st argument to the syscall routine

arg1 2nd argument to the syscall routine

arg2 3rd argument to the syscall routine

arg3 4th argument to the syscall routine

syscall_id the ID of system call routine that has to be called value provided by the system call routine, if routine with given syscall_id exists. Otherwise returns E_NOTAVAIL.

Returns value provided by the system call routine, if routine with given syscall_id exists. Otherwise returns E_NOTAVAIL.

← Signal handling Thread scheduling →