fix(vmm): make MMU bring-up and kernel mappings reliable
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user