C Microkernel Realtime eXecutive
Realtime Operating System for Cortex-M based microcontrollers
 
Loading...
Searching...
No Matches

Portable parts of system call machinery. More...

Detailed Description

Portable parts of system call machinery.

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.

Macro Definition Documentation

◆ ___SVC

#define ___SVC (   no)
Value:
asm volatile(\
"SVC %[immediate]\n\t"\
"BX LR\n\t" : : [immediate] "I" (no) : "r0")

◆ __SVC

#define __SVC (   no,
  ... 
)    ___SVC(no)

Perform syscall.

Parameters
nonumber of syscall.
Note
ARM port will throw arguments to SVC call, they are already where they should be.

◆ __SYSCALL

#define __SYSCALL   __attribute__((naked)) __attribute__((noinline))

Mark function as syscall entrypoint in userspace.

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.

◆ SYSCALL_DEFINITION

#define SYSCALL_DEFINITION   __attribute__((section(".syscall"), used)) const

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

Typedef Documentation

◆ Syscall_Handler_t

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

Enumeration Type Documentation

◆ eSysCalls

enum eSysCalls

List of known syscall IDs.

These syscall IDs are known and can be used to call services.

Enumerator
SYSCALL_GET_TID 
SYSCALL_SCHED_YIELD 
SYSCALL_THREAD_CREATE 
SYSCALL_MUTEX_INIT 
SYSCALL_MUTEX_DESTROY 
SYSCALL_MUTEX_UNLOCK 
SYSCALL_MUTEX_TRYLOCK 
SYSCALL_RPC_CALL 
SYSCALL_RPC_RETURN 
SYSCALL_THREAD_JOIN 
SYSCALL_THREAD_EXIT 
SYSCALL_SETITIMER 
SYSCALL_USLEEP 
SYSCALL_SIGNAL 
SYSCALL_KILL 
SYSCALL_SETPRIORITY 
SYSCALL_RESET 
SYSCALL_INIT_WAITABLE_OBJECT 
SYSCALL_NOTIFY_OBJECT 
SYSCALL_WAIT_FOR_OBJECT 
SYSCALL_ENABLE_IRQ 
SYSCALL_DISABLE_IRQ 
SYSCALL_CPUFREQ_GET 
SYSCALL_GET_MICROTIME 
SYSCALL_SHUTDOWN 
SYSCALL_NOTIFY_OBJECT2 
SYSCALL_WAIT_FOR_OBJECT_VALUE 
_SYSCALL_COUNT 

Function Documentation

◆ os_system_call()

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

Find and execute a system call.

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.

Parameters
arg01st argument to the syscall routine
arg12nd argument to the syscall routine
arg23rd argument to the syscall routine
arg34th argument to the syscall routine
syscall_idthe ID of system call routine that has to be called
Returns
value provided by the system call routine, if routine with given syscall_id exists. Otherwise returns E_NOTAVAIL.