// Check if computer has enough memory address that MINT64OS can use.
// MINT64OS requires 64MB
BOOL kIsMemoryEnough(void) {
// 0x100000 == 1MB
DWORD* pdwCurrentAddress = (DWORD*) 0x100000;
// loop up to 0x4000000(64MB)
while ( (DWORD) pdwCurrentAddress < 0x4000000) {
*pdwCurrentAddress = 0x12345678;
// there is possibility that computer pretends that is allows
// to write to specific memory area. To make sure that the addr exists,
// reading the addr is necessary
if (*pdwCurrentAddress != 0x12345678) {
return FALSE;
}
// Do not check every single byte. Instead, check first byte of
// every megabyte
pdwCurrentAddress += (0x100000 / 4);
}
return TRUE;
}-
MINT64OS's IA-32e mode code accesses up to 64MB.
-
If you run QEMU with
-m 32option, you will see that a memory shortage messageqemu-system-x86_64.exe -m 32 -fda .\Disk.img -rtc base=localtime -M pc -
Memory Layout up to CH08
- start(inclusive) ~ end(exclusive)
- 0x00000 ~ 0x00400 (Interrupt Vector Table)
- 0x07C00 ~ 0x07E00 (Bootloader)
- 0x07E00 ~ 0x10000 (Stack)
- 0x10000 ~ 0x10400 (32 bits code of OS; EntryPoint.S + Main.c)
- 0xA0000 ~ ... (video memory for graphic mode)
- 0xB8000 ~ ... (video memory for text mode)