aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/fs/elf.c
diff options
context:
space:
mode:
authorMarvin Borner2020-05-13 21:28:56 +0200
committerMarvin Borner2020-05-13 22:12:41 +0200
commita9c7529dcca845d98192ece62be70f752972216b (patch)
tree666d49ceb411a669abe6191151b2238fd7156c30 /src/kernel/fs/elf.c
parente1a6ed079303dc7d218f1d5326a13b6755781271 (diff)
Replaced alloc.h with liballoc
And many more adaptions to the lib
Diffstat (limited to 'src/kernel/fs/elf.c')
-rw-r--r--src/kernel/fs/elf.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/kernel/fs/elf.c b/src/kernel/fs/elf.c
index c89fd2e..a67ab6a 100644
--- a/src/kernel/fs/elf.c
+++ b/src/kernel/fs/elf.c
@@ -46,23 +46,23 @@ struct process *elf_load(char *path)
proc->registers.eip = header->entry;
paging_switch_directory(proc->cr3);
- u32 stk = (u32)kmalloc_a(PAGE_S);
- proc->registers.useresp = 0x40000000 - (PAGE_S / 2);
+ u32 stk = (u32)malloc(PAGE_SIZE);
+ proc->registers.useresp = 0x40000000 - (PAGE_SIZE / 2);
proc->registers.ebp = proc->registers.useresp;
proc->registers.esp = proc->registers.useresp;
- paging_map_user(proc->cr3, stk, 0x40000000 - PAGE_S);
+ paging_map(stk, 0x40000000 - PAGE_SIZE, PT_USER);
for (int i = 0; i < header->phnum; i++, program_header++) {
switch (program_header->type) {
case 0:
break;
case 1: {
- u32 loc = (u32)kmalloc_a(PAGE_S);
- paging_map_user(proc->cr3, loc, program_header->vaddr);
+ u32 loc = (u32)malloc(PAGE_SIZE);
+ paging_map(loc, program_header->vaddr, PT_USER);
memcpy((void *)program_header->vaddr,
((void *)((u32)file) + program_header->offset),
program_header->filesz);
- if (program_header->filesz > PAGE_S)
+ if (program_header->filesz > PAGE_SIZE)
panic("ELF binary section too large");
break;
}
@@ -71,6 +71,6 @@ struct process *elf_load(char *path)
}
}
- paging_switch_directory(paging_root_directory);
+ paging_switch_directory(paging_kernel_directory);
return proc;
} \ No newline at end of file