[−][src]Function sunrise_kernel::i386::interrupt_service_routines::syscall_interrupt_dispatcher
fn syscall_interrupt_dispatcher(
_exception_name: &'static str,
hwcontext: &mut UserspaceHardwareContext,
_has_errcode: bool
)
This is the function called on int 0x80.
The ABI is linuxy, but modified to allow multiple register returns:
Inputs
- eax system call number
- ebx arg1
- ecx arg2
- edx arg3
- esi arg4
- edi arg5
- ebp arg6
Outputs
- eax error code
- ebx ret1
- ecx ret2
- edx ret3
- esi ret4
- edi ret5
- ebp ret6
What this wrapper does is creating an instance of the Registers structure on the stack as argument to the syscall dispatcher. The syscall dispatcher will then modify this structure to reflect what the registers should look like on syscall exit, and the wrapper pops those modified values.
We don't use the x86-interrupt llvm feature because syscall arguments are passed in registers, and it does not enable us to access those saved registers.
We do NOT restore registers before returning, as they all are used for parameter passing. It is the caller's job to save the one it needs.
Dispatches to the various syscall handling functions based on hwcontext.eax
,
and updates the hwcontext with the correct return values.