Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
exec: Correctly align memory using .p_align
Browse files Browse the repository at this point in the history
  • Loading branch information
EnderIce2 committed Nov 19, 2024
1 parent 7b05405 commit a96086c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions exec/elf/elf_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ namespace Execute
continue;

void *pAddr = vma->RequestPages(TO_PAGES(ProgramHeader.p_memsz), true);
void *vAddr = (void *)ALIGN_DOWN(ProgramHeader.p_vaddr, PAGE_SIZE);
void *vAddr = (void *)ALIGN_DOWN(ProgramHeader.p_vaddr, ProgramHeader.p_align);
uintptr_t SegDestOffset = ProgramHeader.p_vaddr - uintptr_t(vAddr);

vmm.Map(vAddr, pAddr,
ProgramHeader.p_memsz,
ALIGN_UP(ProgramHeader.p_memsz, ProgramHeader.p_align),
Memory::RW | Memory::US);

debug("Mapped %#lx to %#lx (%ld bytes)",
Expand Down

0 comments on commit a96086c

Please sign in to comment.