#define MODULE "mmap" #include "memory/MemoryMap.h" #include "bootboot.h" #include "log/Log.h" extern BOOTBOOT bootboot; void Memory::walk_memory_map() { MMapEnt* ptr = &bootboot.mmap; uint64_t mmap_entries = (bootboot.size - 128) / 16; for (uint64_t i = 0; i < mmap_entries; i++) { switch (MMapEnt_Type(ptr)) { case MMAP_USED: kinfoln("Used memory region starting at %lx, ends at %lx, size %lx", MMapEnt_Ptr(ptr), MMapEnt_Ptr(ptr) + MMapEnt_Size(ptr) - 1, MMapEnt_Size(ptr)); break; case MMAP_ACPI: kinfoln("ACPI memory region starting at %lx, ends at %lx, size %lx", MMapEnt_Ptr(ptr), MMapEnt_Ptr(ptr) + MMapEnt_Size(ptr) - 1, MMapEnt_Size(ptr)); break; case MMAP_MMIO: kinfoln("MMIO memory region starting at %lx, ends at %lx, size %lx", MMapEnt_Ptr(ptr), MMapEnt_Ptr(ptr) + MMapEnt_Size(ptr) - 1, MMapEnt_Size(ptr)); break; case MMAP_FREE: kinfoln("Free memory region starting at %lx, ends at %lx, size %lx", MMapEnt_Ptr(ptr), MMapEnt_Ptr(ptr) + MMapEnt_Size(ptr) - 1, MMapEnt_Size(ptr)); break; default: kinfoln("Invalid memory map entry"); break; } ptr++; } }