From cb5e40852540cf76e95290e49e76ea1972759737 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Sun, 11 Feb 2024 23:41:34 +0100 Subject: [PATCH] Fix init ressource mapping --- core/elf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/elf.c b/core/elf.c index 8f4ccc1..ab9a559 100644 --- a/core/elf.c +++ b/core/elf.c @@ -138,17 +138,17 @@ uaddr_t loadElfProg(const char *prog, struct process *proc) unrefPhyPage(ppage); } - // Hack: Even if already allocated mark the adresse space as managed by a ressource - // So this address space is not used by another ressource. - uaddr = elf_phdrs[i].p_vaddr; - zeroMmap(as, &uaddr, elf_phdrs[i].p_memsz, PAGING_MEM_USER | PAGING_MEM_WRITE | PAGING_MEM_READ, 0); - /* Copy segment into memory */ memcpy((void *)elf_phdrs[i].p_vaddr, (void *)(prog + elf_phdrs[i].p_offset), elf_phdrs[i].p_filesz); if (lastUserAddr < uaddr) { lastUserAddr = uaddr; } + + // Hack: Even if already allocated mark the adresse space as managed by a ressource + // So this address space is not used by another ressource. + uaddr = elf_phdrs[i].p_vaddr; + zeroMmap(as, &uaddr, elf_phdrs[i].p_memsz, PAGING_MEM_USER | PAGING_MEM_WRITE | PAGING_MEM_READ, 0); } processInitHeap(proc, lastUserAddr);