documentation/kernel/mm/region.h.md

2.0 KiB

region.h

Virtual memory space layout.

The first 4 digits of an address can be ignored, they are also ignored by the MMU, but for clarity / readability reasons they are FFFF in the kernel space. See General Concepts / Memory Layout(todo: add reference) and General Concepts / Process Memory Isolation(todo: add reference) for more details.

Name Start Description
MEM_REGION_PROCESS 0x0000000000000000 This is the start of the process space
MEM_REGION_PROCESS_EXEC 0x0000010000000000 Every processes' executable will be mapped here
MEM_REGION_PROCESS_THREAD_BASE 0x0000010100000000 The start of the Thread Data regions
MEM_REGION_KERNEL 0xFFFF800000000000 This is the start of the kernel space
MEM_REGION_KERNEL_STACK_DUMMY 0xFFFFF00000000000 This area is used when preparing a threads' stack
MEM_REGION_KERNEL_HEAP 0xFFFFF80000000000 The kernels' heap begins here
MEM_REGION_KERNEL_THREAD_BASE 0xFFFFFF0000000000 The kernel processes' Thread Data regions
MEM_REGION_KERNELEXEC 0xFFFFFFFF80000000 The kernel executable is mapped here

MEM_REGION_THREAD_OFFSET - macro

This time the threads id specifies its offset in its processes' Thread Data region.

KERNEL_START_ADDRESS - macro

Returns the address of _kernel_start.

KERNEL_END_ADDRESS - macro

Returns the address of _kernel_end.

_kernel_start - global variable

This symbol is inserted by the linker at the beginning of the kernel. To access its value use KERNEL_START_ADDRESS.

_kernel_end - global variable

This symbol is inserted by the linker at the end of the kernel. To access its value use KERNEL_END_ADDRESS.