AquilaOS documentation
How it works, and its code
Toggle main menu visibility
Loading...
Searching...
No Matches
execve.c
Go to the documentation of this file.
1
6
7
#include <
core/system.h
>
8
#include <
core/arch.h
>
9
#include <
sys/proc.h
>
10
11
/* x86: sets the thread's saved instruction pointer, stack pointer and
12
* flags, which it starts from when it next returns to user mode. The C
13
* library's start code finds `argc` at the stack pointer. */
14
void
arch_exec_start
(
struct
thread
*
thread
,
uintptr_t
entry,
uintptr_t
sp)
15
{
16
struct
x86_thread
*arch =
thread
->
arch
;
17
18
#if ARCH_BITS==32
19
arch->eip = entry;
20
arch->esp = sp;
21
arch->eflags =
X86_EFLAGS
;
22
#else
23
arch->
rip
= entry;
24
arch->
rsp
= sp;
25
arch->
rflags
=
X86_EFLAGS
;
26
#endif
27
}
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,...
Definition
execve.c:15
X86_EFLAGS
#define X86_EFLAGS
Definition
arch.h:12
arch.h
system.h
proc.h
uintptr_t
__SIZE_TYPE__ uintptr_t
Definition
stddef.h:12
thread
A thread.
Definition
thread.h:23
thread::arch
void * arch
the architecture's own data: its registers, its kernel stack
Definition
thread.h:84
x86_thread
A thread's x86 state: its kernel stack, and where it resumes.
Definition
arch.h:16
x86_thread::rip
uintptr_t rip
Definition
arch.h:27
x86_thread::rflags
uintptr_t rflags
Definition
arch.h:30
x86_thread::rsp
uintptr_t rsp
Definition
arch.h:28
kernel
arch
i386
sys
execve.c
Generated by
1.18.0