Skip to main content

push_argv

Function push_argv 

Source
fn push_argv(
    ctx: &Ctx,
    regs: &mut Regs,
    path: &[u8],
    argv: &[Vec<u8>],
    ptr_size: usize,
) -> Result<(u64, u64), i32>
Expand description

Writes a path and an argv array onto the tracee’s stack.

Layout, from the returned base upwards: the NUL-terminated pointer array (entries ptr_size bytes wide, base 16-byte aligned), then every string, then the path.

§Arguments

  • ctx - Shared supervisor state.
  • regs - Registers whose stack pointer locates the scratch area.
  • path - Program path for the kernel.
  • argv - Argument strings, without NULs.
  • ptr_size - Pointer width of the calling process’s ABI (4 or 8).

§Returns

(path address, argv address) in the tracee.