AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
execve.c File Reference

x86: where a new program starts, for execve(). More...

#include <core/system.h>
#include <core/arch.h>
#include <sys/proc.h>

Go to the source code of this file.

Functions

void arch_exec_start (struct thread *thread, uintptr_t entry, uintptr_t sp)
 Sets up a thread to start a new program when it next returns to user mode: at its entry point, with its stack pointer at its initial stack, which the kernel has built already (argc, argv, envp and the auxiliary vector, as the System V ABI has them: sys/execve.c).

Detailed Description

x86: where a new program starts, for execve().

The kernel has built its initial stack already (sys/execve.c); the thread only needs its instruction and stack pointers set.

Definition in file execve.c.

Function Documentation

◆ arch_exec_start()

void arch_exec_start ( struct thread * thread,
uintptr_t entry,
uintptr_t sp )

Sets up a thread to start a new program when it next returns to user mode: at its entry point, with its stack pointer at its initial stack, which the kernel has built already (argc, argv, envp and the auxiliary vector, as the System V ABI has them: sys/execve.c).

The other registers start as zeros, and so does the FPU's state.

Parameters
threadthe thread, which hasn't run since execve() (or ever)
entrythe program's entry point
spthe initial stack pointer, 16-byte aligned

Definition at line 14 of file execve.c.

References thread::arch, arch_exec_start(), x86_thread::rflags, x86_thread::rip, x86_thread::rsp, and X86_EFLAGS.