docs: documented process executable and page_map

This commit is contained in:
antifallobst 2023-03-04 18:09:16 +01:00
parent ae89275c68
commit 1e38299857
1 changed files with 30 additions and 15 deletions

View File

@ -1081,6 +1081,10 @@ The osdev wiki explains this more detailed.
#### `g_idt_register` - global variable #### `g_idt_register` - global variable
The default IDT configuration loaded when the IDT gets initialized. The default IDT configuration loaded when the IDT gets initialized.
#### `g_handling_interrupt` - global variable
When the system isn't handling an interrupt this is set to 0.
If this is greater than 0 the system is currently handling an interrupt,
#### `idt_init()` - function (void) #### `idt_init()` - function (void)
This function fills all the interrupt gates (handlers) into the IDT and loads it. This function fills all the interrupt gates (handlers) into the IDT and loads it.
@ -1194,28 +1198,38 @@ These are standard pids
#### `process_T` - struct #### `process_T` - struct
| Name | Type | Description | | Name | Type | Description |
|-------------|------------|-----------------------------------------------------------| |-------------|-------------------|-----------------------------------------------------------|
| name | char[128] | The processes' name | | name | char[128] | The processes' name |
| id | pid_t | The process-identification number | | id | pid_t | The process-identification number |
| chunk | void* | A pointer to the chunk, where the process is stored in | | chunk | void* | A pointer to the chunk, where the process is stored in |
| chunk_id | uint32_t | The processes id inside of its chunk | | chunk_id | uint32_t | The processes id inside of its chunk |
| num_threads | uint32_t | The amount of spawned threads, that belong to the process | | page_map | page_map_T* | The processes page map. |
| threads | void* | A pointer to the processes' first thread | | executable | elf_executable_T* | The processes executable |
| parent | process_T* | The process, that spawned this process | | num_threads | uint32_t | The amount of spawned threads, that belong to the process |
| childs | process_T* | A pointer to the processes' first child process | | threads | void* | A pointer to the processes' first thread |
| prev | process_T* | The previous process | | parent | process_T* | The process, that spawned this process |
| next | process_T* | The next process | | childs | process_T* | A pointer to the processes' first child process |
| prev | process_T* | The previous process |
| next | process_T* | The next process |
#### `process_spawn(parent, name)` - function (pid_t) #### `process_kernel_spawn(executable)` - function (void)
Spawns the kernels' main process.
**Warning:** this should only be called once, when initializing the scheduler!
#### `process_spawn(parent, name, executable, buffer)` - function (pid_t)
Spawns a process named **_name_** as child of **_parent_** and returns its pid. Spawns a process named **_name_** as child of **_parent_** and returns its pid.
The process gets its own page map with the mappings specified in **_executable_**.
In order to apply these mappings, this function needs the **_buffer_** where the executable was loaded from.
#### `process_kill_pid(pid)` - function (void) #### `process_kill_pid(pid)` - function (void)
Kills the process connected with **_pid_** and all of its threads and child processes. Resolves the pids process and performs `process_kill` on it.
#### `process_kill(process)` - function (void) #### `process_kill(process)` - function (void)
Kills **_process_** and all of its threads and child processes. Kills **_process_** and all of its threads and child processes.
This will also destruct the `executable` and `page_map` associated with **_process_**.
### scheduler.h ### scheduler.h
@ -1242,8 +1256,9 @@ They store the `process_T` pointer for each valid `pid_T`.
| blocked | bool | Set to true, while switching the context. Thread safety mechanism. | | blocked | bool | Set to true, while switching the context. Thread safety mechanism. |
| initialized | bool | Set to true, if the scheduler is initialized and started. | | initialized | bool | Set to true, if the scheduler is initialized and started. |
#### `scheduler_init()` - function (void) #### `scheduler_init(boot_info)` - function (void)
Initializes the scheduler and performs a `scheduler_start` kernel syscall. Initializes the scheduler and performs a `scheduler_start` kernel syscall.
**_boot_info_** is needed in to spawn the kernels' main process.
After this function, the whole kernel is in scheduling mode. After this function, the whole kernel is in scheduling mode.
#### `scheduler_start(state)` - function (cpu_state_T*) #### `scheduler_start(state)` - function (cpu_state_T*)