mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-07-11 23:39:20 +00:00
QoL and bug fixes
This commit is contained in:
@ -159,7 +159,7 @@ namespace Execute
|
||||
size_t ExFileSize = ExFile->node->Length;
|
||||
|
||||
/* Allocate elf in memory */
|
||||
void *ElfFile = KernelAllocator.RequestPages(TO_PAGES(ExFileSize));
|
||||
void *ElfFile = KernelAllocator.RequestPages(TO_PAGES(ExFileSize + 1));
|
||||
/* Copy the file to the allocated memory */
|
||||
memcpy(ElfFile, (void *)ExFile->node->Address, ExFileSize);
|
||||
debug("Image Size: %#lx - %#lx (length: %ld)", ElfFile, (uintptr_t)ElfFile + ExFileSize, ExFileSize);
|
||||
|
@ -172,7 +172,7 @@ namespace Execute
|
||||
if (ELFGetDynamicTag(ElfFile, DT_TEXTREL))
|
||||
{
|
||||
fixme("Text relocation is not(?) tested yet!");
|
||||
MemoryImage = (uint8_t *)mem->RequestPages(TO_PAGES(Length), true);
|
||||
MemoryImage = (uint8_t *)mem->RequestPages(TO_PAGES(Length + 1), true);
|
||||
memset(MemoryImage, 0, Length);
|
||||
return {MemoryImage, 0x0};
|
||||
}
|
||||
@ -196,14 +196,14 @@ namespace Execute
|
||||
if (ItrPhdr.p_type == PT_LOAD && ItrPhdr.p_vaddr == 0)
|
||||
{
|
||||
debug("p_vaddr is 0, allocating %ld pages for image", TO_PAGES(Length));
|
||||
MemoryImage = mem->RequestPages(TO_PAGES(Length), true);
|
||||
MemoryImage = mem->RequestPages(TO_PAGES(Length + 1), true);
|
||||
memset(MemoryImage, 0, Length);
|
||||
return {MemoryImage, (void *)FirstProgramHeaderVirtualAddress};
|
||||
}
|
||||
}
|
||||
|
||||
debug("Allocating %ld pages for image", TO_PAGES(Length));
|
||||
MemoryImage = mem->RequestPages(TO_PAGES(Length));
|
||||
MemoryImage = mem->RequestPages(TO_PAGES(Length + 1));
|
||||
memset(MemoryImage, 0, Length);
|
||||
|
||||
if (FirstProgramHeaderVirtualAddress != 0)
|
||||
|
@ -48,7 +48,7 @@ namespace Execute
|
||||
continue;
|
||||
if (Section->sh_flags & SHF_ALLOC)
|
||||
{
|
||||
void *Buffer = KernelAllocator.RequestPages(TO_PAGES(Section->sh_size));
|
||||
void *Buffer = KernelAllocator.RequestPages(TO_PAGES(Section->sh_size + 1));
|
||||
memset(Buffer, 0, Section->sh_size);
|
||||
|
||||
Memory::Virtual(Process->PageTable).Map((void *)Buffer, (void *)Buffer, Section->sh_size, Memory::PTFlag::RW | Memory::PTFlag::US);
|
||||
|
@ -89,7 +89,7 @@ namespace Execute
|
||||
sl.Timeout = TimeManager->CalculateTarget(600000); /* 10 minutes */
|
||||
sl.RefCount = 0;
|
||||
|
||||
void *LibFile = mem->RequestPages(TO_PAGES(Length), true);
|
||||
void *LibFile = mem->RequestPages(TO_PAGES(Length + 1), true);
|
||||
debug("LibFile: %#lx", LibFile);
|
||||
memcpy(LibFile, (void *)ElfImage, Length);
|
||||
Memory::Virtual().Map(LibFile, LibFile, Length, Memory::RW | Memory::US | Memory::G);
|
||||
|
Reference in New Issue
Block a user