[][src]Crate crt0stack

Create the initial stack frame to start an ELF binary on Linux

Examples

use crt0stack::{Builder, Entry};

let mut stack = [1u8; 512];
let stack = stack.as_mut();

let mut builder = Builder::new(stack);

builder.push("/init").unwrap();
let mut builder = builder.done().unwrap();

builder.push("HOME=/root").unwrap();
let mut builder = builder.done().unwrap();

let auxv = [
    Entry::Gid(1000),
    Entry::Uid(1000),
    Entry::Platform("x86_64"),
    Entry::ExecFilename("/init"),
];
auxv.iter().for_each(|e| builder.push(e).unwrap());

let handle = builder.done().unwrap();

Structs

Builder

Builder for the initial stack of a Linux ELF binary

Handle

Handle for the stack

OutOfSpace

Indicates too many arguments for serialize

Reader

Reader for the initial stack of a Linux ELF binary

Stack

An opaque stack type used for a stack pointer

Enums

Arg

State marker for the argument section

Aux

State marker for the auxiliary section

Entry

An auxiliary vector entry

Env

State marker for the environment section