Expand description
Kernel memory space management.
The kernel memory space is currently managed as follows, if the address width is 48 bits (with 47 bits kernel space).
TODO: the cap of linear mapping (the start of vm alloc) are raised to workaround for high IO in TDX. We need actual vm alloc API to have a proper fix.
+-+ <- the highest used address (0xffff_ffff_ffff_0000)
| | For the kernel code, 1 GiB.
+-+ <- 0xffff_ffff_8000_0000
| |
| | Unused hole.
+-+ <- 0xffff_e100_0000_0000
| | For frame metadata, 1 TiB.
+-+ <- 0xffff_e000_0000_0000
| | For [`KVirtArea`], 32 TiB.
+-+ <- the middle of the higher half (0xffff_c000_0000_0000)
| |
| |
| |
| | For linear mappings, 64 TiB.
| | Mapped physical addresses are untracked.
| |
| |
| |
+-+ <- the base of high canonical address (0xffff_8000_0000_0000)If the address width is (according to [crate::arch::mm::PagingConsts])
39 bits or 57 bits, the memory space just adjust proportionally.
Constants§
- ADDR_
WIDTH_ SHIFT - The shortest supported address width is 39 bits. And the literal values are written for 48 bits address width. Adjust the values by arithmetic left shift.
- CONST_
FRAME_ METADATA_ BASE_ VADDR - The constant
FRAME_METADATA_BASE_VADDR. - CONST_
FRAME_ METADATA_ CAP_ VADDR - The constant
FRAME_METADATA_CAP_VADDR. - CONST_
LINEAR_ MAPPING_ BASE_ VADDR - The constant
LINEAR_MAPPING_BASE_VADDR. The base address of the linear mapping of all physical memory in the kernel address space. - CONST_
LINEAR_ MAPPING_ VADDR_ RANGE - The constant
LINEAR_MAPPING_VADDR_RANGE. - CONST_
VMALLOC_ BASE_ VADDR - The constant
VMALLOC_BASE_VADDR. - CONST_
VMALLOC_ VADDR_ RANGE - The constant
VMALLOC_VADDR_RANGE. - KERNEL_
BASE_ VADDR - Start of the kernel address space. This is the lowest address of the x86-64’s high canonical addresses.
- KERNEL_
CODE_ BASE_ VADDR - KERNEL_
END_ VADDR - End of the kernel address space (non inclusive).
Functions§
- FRAME_
METADATA_ BASE_ VADDR - FRAME_
METADATA_ BASE_ VADDR_ SPEC - FRAME_
METADATA_ CAP_ VADDR - FRAME_
METADATA_ CAP_ VADDR_ SPEC - LINEAR_
MAPPING_ BASE_ VADDR - LINEAR_
MAPPING_ BASE_ VADDR_ SPEC - LINEAR_
MAPPING_ VADDR_ RANGE - LINEAR_
MAPPING_ VADDR_ RANGE_ SPEC - VMALLOC_
BASE_ VADDR - VMALLOC_
BASE_ VADDR_ SPEC - VMALLOC_
VADDR_ RANGE - VMALLOC_
VADDR_ RANGE_ SPEC - paddr_
to_ vaddr - paddr_
to_ vaddr_ spec