fix(vmm): make MMU bring-up and kernel mappings reliable

This commit is contained in:
karina
2026-04-26 23:41:57 +04:00
parent b56b55e4b3
commit 5d010f7fb2
8 changed files with 167 additions and 13 deletions
+6 -2
View File
@@ -1,6 +1,5 @@
#include <VM/PMM.h>
#include <Lib/String.h>
#include "../Common/bootinfo.h"
extern char _kernelStart[];
extern char _kernelEnd[];
@@ -26,13 +25,18 @@ static inline void BitmapUnset(MemoryPointer bitmap, Address address) {
bitmap[BitmapGetByteIndex(address)] &= ~(1U << BitmapGetBitOffset(address));
}
void PMMInitialize(VMBootMemoryMap* bootMap, Bootinfo* info) {
void PMMInitialize(VMBootMemoryMap* bootMap) {
sPMMRamBase = bootMap->totalRAM.base;
sPMMTotalPages = bootMap->totalRAM.size / kVMPageSize;
sPMMBitmapSize = sPMMTotalPages / kVMBlocksPerByte;
sPMMBitmap = (MemoryPointer)_kernelEnd;
MemorySet(sPMMBitmap, 0, sPMMBitmapSize);
UInt32 safeIndex = bootMap->reservedCount;
bootMap->reserved[safeIndex].base = sPMMRamBase;
bootMap->reserved[safeIndex].size = 16 * 1024 * 1024; // 16 Mb
bootMap->reservedCount++;
UInt32 kIndex = bootMap->reservedCount;
bootMap->reserved[kIndex].base = (Address)_kernelStart;
bootMap->reserved[kIndex].size = (Address)_kernelEnd - (Address)_kernelStart;