userspace_build 0.2.2

userspace_build library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// Transfer control using the Linux process-entry convention.
///
/// The target receives the newly prepared Linux initial stack in `%rsp`.
/// The dynamic interpreter uses that stack to relocate itself and the main
/// executable before transferring control to the program entry point.
pub unsafe fn jump_to_entry(entry: u64, initial_stack: crate::target::arch::PointerType) -> ! {
    unsafe {
        core::arch::asm!(
            "mov rsp, {stack}",
            "xor ebp, ebp",
            "jmp {entry}",
            stack = in(reg) initial_stack,
            entry = in(reg) entry,
            options(noreturn),
        );
    }
}