Turnstone Operating System
|
cpu task definitons More...
#include <cpu/descriptor.h>
#include <cpu/interrupt.h>
#include <memory.h>
#include <memory/paging.h>
#include <list.h>
#include <buffer.h>
#include <utils.h>
Classes | |
struct | descriptor_tss_t |
64 bit tss descriptor More... | |
struct | tss_s |
tss descriptor values More... | |
struct | task_registers_t |
struct | task_t |
Macros | |
#define | ___CPU_TASK_H 0 |
#define | TASK_MAX_TICK_COUNT 10 |
#define | TASK_IDLE_TASK_ID 1 |
#define | TASK_KERNEL_TASK_ID 2 |
#define | DESCRIPTOR_BUILD_TSS_SEG(tss, base, limit, DPL) |
initialize tss More... | |
#define | task_init_tasking() task_init_tasking_ext(NULL) |
#define | task_get_current_task_message_queue(queue_number) task_get_message_queue(task_get_id(), queue_number) |
Typedefs | |
typedef struct descriptor_tss_t | descriptor_tss_t |
typedef struct tss_s | tss_t |
short hand for struct | |
typedef enum task_state_e | task_state_t |
short hand for enum | |
typedef struct task_registers_t | task_registers_t |
typedef struct task_t | task_t |
short hand for struct | |
Enumerations | |
enum | task_state_e { TASK_STATE_NULL , TASK_STATE_CREATED , TASK_STATE_STARTING , TASK_STATE_RUNNING , TASK_STATE_SUSPENDED , TASK_STATE_ENDED } |
task states More... | |
Functions | |
_Static_assert (sizeof(task_registers_t)==0x290, "task_registers_t size must be 0x290") | |
_Static_assert ((offsetof_field(task_registers_t, sse) % 0x10)==0x0, "task_registers_t sse offset must be aligned 0x10") | |
int8_t | task_init_tasking_ext (memory_heap_t *heap) |
inits kernel tasking, configures tss and kernel task More... | |
void | task_task_switch_set_parameters (boolean_t need_eoi, boolean_t need_sti) |
sets task switch parameters More... | |
void | task_switch_task (void) |
switches current task to a new one. | |
void | task_yield (void) |
yields task for waiting other tasks. More... | |
uint64_t | task_get_id (void) |
returns current task's id More... | |
task_t * | task_get_current_task (void) |
returns current task More... | |
void | task_set_message_waiting (void) |
sets current task's message waiting flag | |
void | task_clear_message_waiting (uint64_t task_id) |
clears current task's message waiting flag More... | |
void | task_set_interruptible (void) |
sets current task's interruptible flag | |
void | task_set_interrupt_received (uint64_t task_id) |
sets current task's interrupt received flag More... | |
void | task_add_message_queue (list_t *queue) |
adds a queue to task More... | |
list_t * | task_get_message_queue (uint64_t task_id, uint64_t queue_number) |
uint64_t | task_create_task (memory_heap_t *heap, uint64_t heap_size, uint64_t stack_size, void *entry_point, uint64_t args_cnt, void **args, const char_t *task_name) |
creates a task and apends it to wait queue More... | |
boolean_t | task_idle_check_need_yield (void) |
idle task checks if there is any task neeeds to run. it speeds up task running | |
void | task_current_task_sleep (uint64_t wake_tick) |
sleep for current task for ticks More... | |
void | task_end_task (void) |
void | task_kill_task (uint64_t task_id, boolean_t force) |
void | task_print_all (void) |
buffer_t * | task_get_task_input_buffer (uint64_t tid) |
buffer_t * | task_get_task_output_buffer (uint64_t tid) |
buffer_t * | task_get_task_error_buffer (uint64_t tid) |
buffer_t * | task_get_input_buffer (void) |
dummy method for efi for getting input buffer. More... | |
buffer_t * | task_get_output_buffer (void) |
dummy method for efi for getting output buffer. More... | |
buffer_t * | task_get_error_buffer (void) |
dummy method for efi for getting error buffer. More... | |
int8_t | task_set_input_buffer (buffer_t *buffer) |
int8_t | task_set_output_buffer (buffer_t *buffer) |
int8_t | task_set_error_buffer (buffer_t *buffer) |
void | task_set_vmcs_physical_address (uint64_t vmcs_physical_address) |
uint64_t | task_get_vmcs_physical_address (void) |
void | task_set_vm (void *vm) |
void * | task_get_vm (void) |
void | task_remove_task_after_fault (uint64_t task_id) |
int8_t | task_set_current_and_idle_task (void *entry_point, uint64_t stack_base, uint64_t stack_size) |
cpu task definitons
This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.
#define ___CPU_TASK_H 0 |
prevent duplicate header error macro
#define DESCRIPTOR_BUILD_TSS_SEG | ( | tss, | |
base, | |||
limit, | |||
DPL | |||
) |
initialize tss
tss | address of tss slot in gdt |
base | base address of tss struct |
limit | length of tss - 1 |
DPL | privilage level |
#define task_init_tasking | ( | ) | task_init_tasking_ext(NULL) |
inits tasking with default heap
#define TASK_KERNEL_TASK_ID 2 |
kernel task id
#define TASK_MAX_TICK_COUNT 10 |
maximum tick count of a task without yielding
enum task_state_e |
void task_add_message_queue | ( | list_t * | queue | ) |
adds a queue to task
[in] | queue | queue which task will have. tasks consumes these queues |
void task_clear_message_waiting | ( | uint64_t | task_id | ) |
clears current task's message waiting flag
[in] | task_id | task id |
uint64_t task_create_task | ( | memory_heap_t * | heap, |
uint64_t | heap_size, | ||
uint64_t | stack_size, | ||
void * | entry_point, | ||
uint64_t | args_cnt, | ||
void ** | args, | ||
const char_t * | task_name | ||
) |
creates a task and apends it to wait queue
[in] | heap | creator heap |
[in] | heap_size | task's heap size, heap allocated with frame allocator |
[in] | stack_size | task's stack size, stack allocated with frame allocator |
[in] | entry_point | task's entry point |
[in] | args_cnt | argument count |
[in] | args | argument list |
[in] | task_name | task's name |
void task_current_task_sleep | ( | uint64_t | wake_tick | ) |
sleep for current task for ticks
[in] | wake_tick | tick count for sleep |
task_t * task_get_current_task | ( | void | ) |
returns current task
returns current task
this method is not required for efi however is required for linking.
buffer_t * task_get_error_buffer | ( | void | ) |
dummy method for efi for getting error buffer.
this method is not required for efi however is required for linking. NULL is returned.
uint64_t task_get_id | ( | void | ) |
returns current task's id
returns current task's id
this method is not required for efi however is required for linking.
buffer_t * task_get_input_buffer | ( | void | ) |
dummy method for efi for getting input buffer.
this method is not required for efi however is required for linking. NULL is returned.
buffer_t * task_get_output_buffer | ( | void | ) |
dummy method for efi for getting output buffer.
this method is not required for efi however is required for linking. NULL is returned.
int8_t task_init_tasking_ext | ( | memory_heap_t * | heap | ) |
inits kernel tasking, configures tss and kernel task
[in] | heap | the heap of kernel task and tasking related variables. |
void task_set_interrupt_received | ( | uint64_t | task_id | ) |
sets current task's interrupt received flag
[in] | task_id | task id |
void task_task_switch_set_parameters | ( | boolean_t | need_eoi, |
boolean_t | need_sti | ||
) |
sets task switch parameters
[in] | need_eoi | if task switching needs notify local apic this field should be true |
[in] | need_sti | if task switching needs enable interrupts this field should be true |
void task_yield | ( | void | ) |
yields task for waiting other tasks.
yields task for waiting other tasks.
this method is not required for efi however is required for linking.