2023-03-15 23:02:09 +00:00
|
|
|
---
|
|
|
|
title: "region.h"
|
|
|
|
summary: "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 |
|
|
|
|
|
2023-03-16 10:04:14 +00:00
|
|
|
# `MEM_REGION_THREAD_OFFSET` - macro
|
2023-03-15 23:02:09 +00:00
|
|
|
This time the threads id specifies its offset in its processes' _Thread Data_ region.
|
|
|
|
|
2023-03-16 10:04:14 +00:00
|
|
|
# `KERNEL_START_ADDRESS` - macro
|
2023-03-15 23:02:09 +00:00
|
|
|
Returns the address of [_kernel_start](https://nerdcult.net/projects/noxos/docs/codebase/mm/region.h/#_kernel_start---global-variable).
|
|
|
|
|
2023-03-16 10:04:14 +00:00
|
|
|
# `KERNEL_END_ADDRESS` - macro
|
2023-03-15 23:02:09 +00:00
|
|
|
Returns the address of [_kernel_end](https://nerdcult.net/projects/noxos/docs/codebase/mm/region.h/#_kernel_end---global-variable).
|
|
|
|
|
2023-03-16 10:04:14 +00:00
|
|
|
# `_kernel_start` - global variable
|
2023-03-15 23:02:09 +00:00
|
|
|
This symbol is inserted by the linker at the beginning of the kernel.
|
|
|
|
To access its value use [KERNEL_START_ADDRESS](https://nerdcult.net/projects/noxos/docs/codebase/mm/region.h/#kernel_start_address---macro).
|
|
|
|
|
2023-03-16 10:04:14 +00:00
|
|
|
# `_kernel_end` - global variable
|
2023-03-15 23:02:09 +00:00
|
|
|
This symbol is inserted by the linker at the end of the kernel.
|
|
|
|
To access its value use [KERNEL_END_ADDRESS](https://nerdcult.net/projects/noxos/docs/codebase/mm/region.h/#kernel_end_address---macro).
|