diff --git a/.wiki/Kernel-documentation.md b/.wiki/Kernel-documentation.md index 3b0e299..920c4e4 100644 --- a/.wiki/Kernel-documentation.md +++ b/.wiki/Kernel-documentation.md @@ -1081,6 +1081,10 @@ The osdev wiki explains this more detailed. #### `g_idt_register` - global variable 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) 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 -| Name | Type | Description | -|-------------|------------|-----------------------------------------------------------| -| name | char[128] | The processes' name | -| id | pid_t | The process-identification number | -| chunk | void* | A pointer to the chunk, where the process is stored in | -| 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 | -| threads | void* | A pointer to the processes' first thread | -| parent | process_T* | The process, that spawned this process | -| childs | process_T* | A pointer to the processes' first child process | -| prev | process_T* | The previous process | -| next | process_T* | The next process | +| Name | Type | Description | +|-------------|-------------------|-----------------------------------------------------------| +| name | char[128] | The processes' name | +| id | pid_t | The process-identification number | +| chunk | void* | A pointer to the chunk, where the process is stored in | +| chunk_id | uint32_t | The processes id inside of its chunk | +| page_map | page_map_T* | The processes page map. | +| executable | elf_executable_T* | The processes executable | +| num_threads | uint32_t | The amount of spawned threads, that belong to the process | +| threads | void* | A pointer to the processes' first thread | +| parent | process_T* | The process, that spawned this 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. +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) -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) Kills **_process_** and all of its threads and child processes. +This will also destruct the `executable` and `page_map` associated with **_process_**. ### 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. | | 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. +**_boot_info_** is needed in to spawn the kernels' main process. After this function, the whole kernel is in scheduling mode. #### `scheduler_start(state)` - function (cpu_state_T*)