KERNEL: Improved Physical memory allocation code / Code refactor

* Moved tests to a different folder
* Adjusted the memory map address locations
* Improved readability of `kernel.cpp`
This commit is contained in:
2022-09-02 21:09:51 +02:00
parent 13e9beea79
commit 01fcb0aa15
14 changed files with 158 additions and 202 deletions

View File

@ -40,6 +40,7 @@ struct BootInfoBlock {
};
// TODO Put the BootInfoBlock 1MB above the kernel.
const uint32_t BootInfoBlock_pptr = (uint32_t)&kernel_end - 0xC0000000 + 0x1;
const uint32_t MemoryMapHeap_pptr = BootInfoBlock_pptr + sizeof(BootInfoBlock);
const uint32_t pke = ((uint32_t)&kernel_end) - 0xC0000000;
const uint32_t BootInfoBlock_pptr = pke + 1000 - sizeof(BootInfoBlock);
const uint32_t MemoryMapHeap_pptr = pke + 0x1;

View File

@ -99,9 +99,8 @@ if (CHECK_FLAG(mbi->flags, 6))
// continue to the next block
mmap = (multiboot_memory_map_t *) ((unsigned long) mmap + mmap->size + sizeof(mmap->size));
CurrentInfoBlock->next = (MemoryInfoBlock*) ((uint32_t)CurrentInfoBlock) + sizeof(MemoryInfoBlock);
CurrentInfoBlock->next = (MemoryInfoBlock*) CurrentInfoBlock + 16;
CurrentInfoBlock = CurrentInfoBlock->next;
}
CurrentInfoBlock->next = (MemoryInfoBlock*) 0x0;