|
ArvernOS
|
#include <stdint.h>Functions | |
| uintptr_t | create_user_stack (uintptr_t stack_top, int argc, char *const argv[], char *const envp[], uintptr_t entry) |
| uintptr_t create_user_stack | ( | uintptr_t | stack_top, |
| int | argc, | ||
| char *const | argv[], | ||
| char *const | envp[], | ||
| uintptr_t | entry ) |
Builds the initial user stack for a program about to be executed.
The stack is written downward from stack_top.
+-----------------------—+ <- stack_top | strings | +-----------------------—+ <- returned stack pointer | argc | | argv[0..argc-1] | | NULL | | envp[0..] | | NULL | | AT_PAGESZ, page_size | | AT_ENTRY, entry | | AT_NULL, 0 | +-----------------------—+
The returned pointer is 16-byte aligned.
| stack_top | the top (high address) of the user stack |
| argc | the number of arguments |
| argv | the argument list |
| envp | the environment list |
| entry | the program entry point |