Fixed bug in page table heap alloc
This commit is contained in:
parent
c13946c7dd
commit
1ba17d852b
2 changed files with 6 additions and 3 deletions
6
lboot.S
6
lboot.S
|
|
@ -184,9 +184,11 @@ _gmdone: add $24, %di
|
|||
// paging: Set up initial page tables for long mode
|
||||
paging:
|
||||
mov heap_ptr, %eax
|
||||
add $6*4096, %eax
|
||||
cmp heap_end, %eax
|
||||
mov %eax, %ecx
|
||||
add $6*4096, %ecx
|
||||
cmp heap_end, %ecx
|
||||
ja out_of_mem
|
||||
mov %ecx, heap_ptr
|
||||
|
||||
mov %eax, pd_ptr
|
||||
add $4*4096, %eax
|
||||
|
|
|
|||
3
loader.c
3
loader.c
|
|
@ -172,6 +172,7 @@ load_elf(file_t file, uintptr_t *entry)
|
|||
if (file.size < phdr->p_offset + phdr->p_filesz) {
|
||||
return -1;
|
||||
}
|
||||
panic("Loading segment");
|
||||
memcpy((void *)ADDR_LOAD, file.ptr + phdr->p_offset, phdr->p_filesz);
|
||||
if (phdr->p_filesz < phdr->p_memsz) {
|
||||
memset((void *)(ADDR_LOAD + phdr->p_filesz), 0, phdr->p_memsz - phdr->p_filesz);
|
||||
|
|
@ -188,7 +189,7 @@ void
|
|||
loader_main(void *initrd)
|
||||
{
|
||||
uint64_t entry = 0;
|
||||
file_t elf = { initrd, 1024 };
|
||||
file_t elf = { initrd, MEG(2) };
|
||||
if (load_elf(elf, &entry) < 0) {
|
||||
panic("panic: Malformed ELF64 executable");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue