Skip to main content

setup_boot_user_stack

Function setup_boot_user_stack 

Source
fn setup_boot_user_stack(
    user_as: &AddressSpace,
    name: &str,
    extra_args: &[&str],
    phdr_vaddr: u64,
    phent: u16,
    phnum: u16,
    program_entry: u64,
    interp_base: Option<u64>,
) -> Result<u64, &'static str>
Expand description

Performs the setup boot user stack operation. Sets up the initial user-space stack for a freshly loaded ELF task.

Stack layout (low addr at bottom = first word read by _start):

[sp+0]             argc
[sp+8]             argv[0] ptr  (program name)
[sp+8*(2..=argc)]  argv[1..] ptrs  (extra_args)
[sp+8*(argc+1)]    NULL  (argv terminator)
[sp+8*(argc+2)]    NULL  (envp terminator)
...                auxv pairs