Skip to main content

map_all_ram

Function map_all_ram 

Source
pub fn map_all_ram(memory_regions: &[MemoryRegion])
Expand description

Map all RAM regions from the memory map into the HHDM.

This ensures that every byte of physical RAM is accessible through the higher-half direct map. Should be called after paging::init. Fix for VMWare Workstation which doesn’t identity-map all RAM by default, causing the kernel to crash when it tries to access unmapped RAM (e.g. for the buddy allocator’s metadata array). Limine’s initial map only covers the first 1GB of RAM, which is not enough for our 2GB test VM. This function lazily maps any missing RAM regions on demand using ensure_identity_map_range(), which checks if the region is already mapped before mapping it. This allows the kernel to boot successfully on VMWare Workstation without requiring changes to the bootloader or Limine configuration.