diff options
author | Marvin Borner | 2020-08-15 13:45:41 +0200 |
---|---|---|
committer | Marvin Borner | 2020-08-15 13:45:41 +0200 |
commit | 162c84cfe6b4652bae213776944b910390553d41 (patch) | |
tree | 737645fb79228393a9ef463ba5e01b92659ea43e /kernel/features | |
parent | cb47a048d233e1f2433c815a06d53d8087e19dad (diff) |
Reverted PIE binaries and fixed userspace lib
Diffstat (limited to 'kernel/features')
-rw-r--r-- | kernel/features/load.c | 8 | ||||
-rw-r--r-- | kernel/features/proc.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/kernel/features/load.c b/kernel/features/load.c index 4468778..5ef7def 100644 --- a/kernel/features/load.c +++ b/kernel/features/load.c @@ -28,30 +28,30 @@ int elf_verify(struct elf_header *h) h->machine == ELF_386 && (h->type == ET_REL || h->type == ET_EXEC); } +// TODO: Fix elf loading void elf_load(char *path, struct proc *proc) { char *data = read_file(path); struct elf_header *h = (struct elf_header *)data; - if (!elf_verify(h)) + if (!elf_verify(h)) { + printf("File is not elf"); return; + } if (h->type != ET_REL) return; struct elf_program_header *phdrs = (struct elf_program_header *)((u32 *)h + h->phoff); - printf("%d", h->phnum); for (int i = 0; i < h->phnum; i++) { struct elf_program_header *phdr = &phdrs[i]; - printf("%d\n", phdr->type); if (phdr->type != PT_LOAD) continue; memcpy((void *)phdr->vaddr, h + phdr->offset, phdr->filesz); memset((void *)(phdr->vaddr + phdr->filesz), phdr->memsz - phdr->filesz, 0); } - loop(); u32 stack = (u32)malloc(0x1000) + 0x1000; proc->regs.ebp = (u32)stack; proc->regs.esp = (u32)stack; diff --git a/kernel/features/proc.c b/kernel/features/proc.c index 7e6c95a..64a4ac1 100644 --- a/kernel/features/proc.c +++ b/kernel/features/proc.c @@ -94,7 +94,7 @@ void proc_init() irq_install_handler(0, scheduler); root = proc_make(); - elf_load("/init", root); + bin_load("/init", root); proc_print(); _eip = root->regs.eip; |