- // You can't trust memory map from multiboot in virtual box!
- // They put ACPI RSDP in the FUCKING 0xe0000 !!!
- // Which is reported to be free area bt multiboot!
- // SWEET CELESTIA!!!
-#ifndef VIRTUAL_BOX_PROBLEM
- multiboot_memory_map_t* mmap = (multiboot_memory_map_t*)mb_info->mmap_addr;
- for (size_t i = 0, j = 0; j < mb_info->mmap_length && !rsdp;
- i++, j += MB_MMAP_ENTRY_SIZE) {
- multiboot_memory_map_t entry = mmap[i];
- if (entry.type != MULTIBOOT_MEMORY_RESERVED ||
- entry.addr_low > 0x100000) {
- continue;
- }
-
- uint8_t* mem_start = entry.addr_low & ~0xf;
- size_t len = entry.len_low;
- for (size_t j = 0; j < len; j += 16) {
- uint32_t sig_low = *((uint32_t*)(mem_start + j));
- // uint32_t sig_high = *((uint32_t*)(mem_start+j) + 1);
- if (sig_low == ACPI_RSDP_SIG_L) {
- rsdp = (acpi_rsdp_t*)(mem_start + j);
- break;
- }
- }
- }
-#else
- // You know what, I just search the entire 1MiB for Celestia's sake.
- uint8_t* mem_start = 0x4000;