Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsel4utils: remove unused environment setup #80

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions libsel4utils/src/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,8 @@ int sel4utils_spawn_process(sel4utils_process_t *process, vka_t *vka, vspace_t *
int sel4utils_spawn_process_v(sel4utils_process_t *process, vka_t *vka, vspace_t *vspace, int argc,
char *argv[], int resume)
{
/* define an envp and auxp */
int error;
int envc = 0;
char *envp[] = {};

uintptr_t initial_stack_pointer = (uintptr_t) process->thread.stack_top - sizeof(seL4_Word);
int error;

/* Copy the elf headers */
uintptr_t at_phdr;
Expand Down Expand Up @@ -307,7 +303,6 @@ int sel4utils_spawn_process_v(sel4utils_process_t *process, vka_t *vka, vspace_t
seL4_UserContext context = {0};

uintptr_t dest_argv[argc];
uintptr_t dest_envp[envc];

/* write all the strings into the stack */
/* Copy over the user arguments */
Expand All @@ -316,18 +311,11 @@ int sel4utils_spawn_process_v(sel4utils_process_t *process, vka_t *vka, vspace_t
return -1;
}

/* copy the environment */
error = sel4utils_stack_copy_args(vspace, &process->vspace, vka, envc, envp, dest_envp, &initial_stack_pointer);
if (error) {
return -1;
}

/* we need to make sure the stack is aligned to a double word boundary after we push on everything else
* below this point. First, work out how much we are going to push */
size_t to_push = 5 * sizeof(seL4_Word) + /* constants */
sizeof(auxv[0]) * auxc + /* aux */
sizeof(dest_argv) + /* args */
sizeof(dest_envp); /* env */
sizeof(dest_argv); /* args */
uintptr_t hypothetical_stack_pointer = initial_stack_pointer - to_push;
uintptr_t rounded_stack_pointer = ALIGN_DOWN(hypothetical_stack_pointer, STACK_CALL_ALIGNMENT);
ptrdiff_t stack_rounding = hypothetical_stack_pointer - rounded_stack_pointer;
Expand All @@ -353,11 +341,6 @@ int sel4utils_spawn_process_v(sel4utils_process_t *process, vka_t *vka, vspace_t
if (error) {
return -1;
}
/* write environment */
error = sel4utils_stack_write(vspace, &process->vspace, vka, dest_envp, sizeof(dest_envp), &initial_stack_pointer);
if (error) {
return -1;
}
/* Null terminate arguments */
error = sel4utils_stack_write_constant(vspace, &process->vspace, vka, 0, &initial_stack_pointer);
if (error) {
Expand Down