UnnamedOS
Syscall

Syscall Interface. More...

+ Collaboration diagram for Syscall:

Functions

static void syscall_exit (uint32_t return_value, uint32_t ecx, uint32_t edx, uint32_t esi, uint32_t edi, cpu_state_t **cpu)
 Exits the current task. More...
 
static uint32_t syscall_getpid ()
 Returns the current task's PID. More...
 
void syscall_init ()
 Initializes the syscall interface.
 

Detailed Description

Syscall Interface.

This defines the syscall interface used in user-space to access kernel functions. Syscalls may have up to 5 arguments and a return value. They are called by firing a 0x30 interrupt with a syscall ID placed in EAX. Parameters are placed in general purpose registers, the return value in EAX.

Function Documentation

static void syscall_exit ( uint32_t  return_value,
uint32_t  ecx,
uint32_t  edx,
uint32_t  esi,
uint32_t  edi,
cpu_state_t **  cpu 
)
static

Exits the current task.

Parameters
return_valuewhether the task returned successfully (0) or not
ecxignored
edxignored
esiignored
ediignored
cputhe CPU state pointer so we can switch to the next task
Todo:
process the return value and return it to the calling task

We tell the scheduler to not switch to this task again, so we can properly free it later in schedule_finalize_tasks(). We can't do that here because we are operating on this task's kernel stack which we cannot free while it is still in use.

Definition at line 29 of file syscall.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uint32_t syscall_getpid ( )
static

Returns the current task's PID.

Returns
current task's PID

Definition at line 48 of file syscall.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function: