Expand description
Memory management.
This is an overview of Hermit’s memory layout:
DeviceAlloc.device_offsetis 0 if!cfg!(careful)- User space virtual memory is only used if
!cfg!(feature = "common-os") - On x86-64, PCI BARs, I/O APICs, and local APICs may be in
0xc0000000..0xffffffff, which could be inside ofMEM.
Virtual address
space
...┌───┬──► 00000000
Physical address ... │ │
space ... │ │ Identity map
... │ │
00000000 ◄──┬───┐... ...├───┼──► mem_size
│ │ ... ... │ │
FrameAlloc │MEM│ ... │ │ Unused
│ │ ... ... │ │
mem_size ◄──┼───┤... ...├───┼──► DeviceAlloc.phys_offset
│ │ ... │ │
│ │ ... │ │ DeviceAlloc
│ │ ... │ │
Empty │ │ ...├───┼──► DeviceAlloc.phys_offset + mem_size
│ │ │ │
│ │ │ │
│ │ │ │ Unused
Unknown ◄──┼───┤ │ │
│ │ │ │
PCI │ │ ├───┼──► kernel_virt_start
│ │ │ │
Unknown ◄──┼───┤ │ │ PageAlloc
│ │ │ │
│ │ ├───┼──► kernel_virt_end
│ │ │ │
Empty │ │ │ │
│ │ │ │ User space
│ │ │ │
│ │ │ │Structs§
- Frame
Alloc - Page
Alloc - Page
Range Box - Phys
Addr - A 64-bit physical memory address.
- Virt
Addr - A canonical 64-bit virtual memory address.
Traits§
- Page
Range Allocator - An allocator that allocates memory in page granularity.
Functions§
- virtual_
to_ physical - Translate a virtual memory address to a physical one.