docs: documented process memory isolation implementation

This commit is contained in:
antifallobst 2023-03-07 20:43:39 +01:00
parent 1af6191748
commit 1b1a5ed653
1 changed files with 40 additions and 11 deletions

View File

@ -876,6 +876,35 @@ If **_divisor_** is smaller than 100, it will be set to 100.
## mm ## mm
### region.h
The first 4 digits can be ignored, they are ignored by the MMU,
but for clarity / readability reasons they are `FFFF` in the kernel space.
See _General Concepts / Memory Layout_ and _General Concepts / Process Memory Isolation_ 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_DATA` | 0x0000010100000000 | The start of the thread specific data ( -> _Process Memory Isolation_ ) |
| `MEM_REGION_KERNEL` | 0xFFFF800000000000 | This is the start of the kernel space |
| `MEM_REGION_KERNEL_EXEC` | 0xFFFFFFFF80000000 | The kernel executable is mapped here |
| `MEM_REGION_KERNEL_HEAP` | 0xFFFFFFFFF0000000 | The kernels' heap begins here |
#### `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 the `KERNEL_START_ADDRESS` macro.
#### `_kernel_end` - global variable
This symbol is inserted by the linker at the end of the kernel.
To access its value use the `KERNEL_END_ADDRESS` macro.
### heap.h ### heap.h
#### `heap_segment_T` - struct #### `heap_segment_T` - struct
@ -1218,17 +1247,17 @@ Thread schematics (schedulers view):
### thread.h ### thread.h
#### `thread_T` - struct #### `thread_T` - struct
| Name | Type | Description | | Name | Type | Description |
|-------------|-------------|--------------------------------------------------------------------------------------------------| |-------------|--------------|--------------------------------------------------------------------------------------------------|
| state | cpu_state_T | The last saved state of the thread. ( -> _context switching_) | | state | cpu_state_T* | The last saved state of the thread ( -> _context switching_) |
| cpu_time | uint64_t | The amount of cpu time the thread had. (currently the amount of context switches the thread had) | | cpu_time | uint64_t | The amount of cpu time the thread had. (currently the amount of context switches the thread had) |
| stack | void* | The bottom of the threads stack | | stack | void* | The bottom of the threads stack |
| stack_size | uint32_t | The size of the threads stack (in bytes) | | stack_size | uint32_t | The size of the threads stack (in bytes) |
| process | process_T* | The process, to which the thread belongs to | | process | process_T* | The process, to which the thread belongs to |
| global_prev | thread_T* | The previous thread in the scheduling queue (**should only be accessed by the scheduler!**) | | global_prev | thread_T* | The previous thread in the scheduling queue (**should only be accessed by the scheduler!**) |
| global_next | thread_T* | The next thread in the scheduling queue (**should only be accessed by the scheduler!**) | | global_next | thread_T* | The next thread in the scheduling queue (**should only be accessed by the scheduler!**) |
| local_prev | thread_T* | The previous thread of _process_ (**should only be accessed by the scheduler!**) | | local_prev | thread_T* | The previous thread of _process_ (**should only be accessed by the scheduler!**) |
| local_next | thread_T* | The next thread of _process_ (**should only be accessed by the scheduler!**) | | local_next | thread_T* | The next thread of _process_ (**should only be accessed by the scheduler!**) |
#### `thread_spawn(function)` - function (thread_T*) #### `thread_spawn(function)` - function (thread_T*)