System Calls Flashcards
What is a system call?
Interface for user programs to request OS services.
What happens when a system call occurs?
Causes a trap into the OS. Dedicated ISR for handling system call interrupts.
The sys call identifier is wrote into a particular register.
How are parameters passed to sys calls?
Can pass parameters in registers, by pushing them onto the stack. or as a table.
Stacks and tables do not limit the number of parameters that can be passed.
How does pushing parameters to the stack work?
System call implementation knows to pop date from the stack
How do parameter tables works?
Address of table passed to OS. Within the table are the passed parameters.
On Linux, what happens after the system call?
Integer representing the success/failure of syscall stored in EAX.
Return value written to some specified address.
CPU state is restored.
User mode is restored before returning.
How can Syscalls be invoked?
High-level functions and other system library functions (printf, open etc..)
syscall() C function
Invoking interrupt 128