Skip to content

Commit

Permalink
Small elf adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
malwarepad committed Oct 5, 2024
1 parent c8f67f5 commit 7f737f7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/kernel/multitasking/stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ void stackGenerateUser(Task *target, uint32_t argc, char **argv, uint32_t envc,
if (!lowestThing || lowestThing > elf_phdr->p_vaddr)
lowestThing = elf_phdr->p_vaddr;
}
size_t phdrThing = lowestThing;
if (elf_ehdr->e_type == 3) {
phdrThing = 0;
} // DYN

// aux: AT_NULL
PUSH_TO_STACK(target->registers.usermode_rsp, size_t, (size_t)0);
Expand Down Expand Up @@ -116,7 +120,7 @@ void stackGenerateUser(Task *target, uint32_t argc, char **argv, uint32_t envc,
PUSH_TO_STACK(target->registers.usermode_rsp, uint64_t, 16);
// aux: AT_PHDR
PUSH_TO_STACK(target->registers.usermode_rsp, size_t,
lowestThing + elf_ehdr->e_phoff);
phdrThing + elf_ehdr->e_phoff);
PUSH_TO_STACK(target->registers.usermode_rsp, uint64_t, 3);

// store arguments & environment variables in heap
Expand Down

0 comments on commit 7f737f7

Please sign in to comment.