pub unsafe extern "C" fn switch_to_user(
ds: SegmentSelector,
sp: *mut u32,
cs: SegmentSelector,
ip: *mut (),
syscall_ret: u32,
) -> !
Expand description
Switch to the user by faking a return from an interrupt.
iretd
expects the following stack layout:
Offset | Value |
---|---|
16 | SS (Ring 3) |
12 | ESP |
8 | EFLAGS |
4 | CS (Ring 3) |
0 | EIP |
The top of stack (ESP) points the EIP at the bottom (stack grows downwards).