kernel/ELF: Avoid zeroing out memory twice
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-04-22 12:19:22 +02:00
parent 4f6e020196
commit 2acd2ed75d
Signed by: asleepymoon
GPG Key ID: B8A7D06E42258954

View File

@ -101,9 +101,12 @@ namespace ELFLoader
if (can_execute_segment(program_header.p_flags)) flags &= ~MMU::NoExecute;
// Allocate physical memory for the segment
TRY(MemoryManager::alloc_at_zeroed(
TRY(MemoryManager::alloc_at(
base_vaddr, get_blocks_from_size(program_header.p_memsz + vaddr_diff, ARCH_PAGE_SIZE), flags));
// Zero out unused memory (before the start of the segment)
memset((void*)base_vaddr, 0, vaddr_diff);
// Load the file section of the segment
inode->read((u8*)program_header.p_vaddr, program_header.p_offset, program_header.p_filesz);