Turnstone Operating System
Loading...
Searching...
No Matches
task.64.c File Reference

cpu task methods More...

#include <apic.h>
#include <cpu.h>
#include <cpu/cpu_state.h>
#include <cpu/interrupt.h>
#include <cpu/task.h>
#include <cpu/crx.h>
#include <cpu/sync.h>
#include <memory/paging.h>
#include <memory/frame.h>
#include <list.h>
#include <time/timer.h>
#include <logging.h>
#include <systeminfo.h>
#include <linker.h>
#include <utils.h>
#include <map.h>
#include <stdbufs.h>
#include <hypervisor/hypervisor_vmxops.h>
#include <hypervisor/hypervisor_vm.h>
#include <hypervisor/hypervisor_macros.h>
#include <strings.h>

Typedefs

typedef task_t *(* memory_current_task_getter_f) (void)
 
typedef task_t *(* lock_current_task_getter_f) (void)
 
typedef void(* lock_task_yielder_f) (void)
 
typedef buffer_t *(* stdbuf_task_buffer_getter_f) (void)
 
typedef void(* future_task_wait_toggler_f) (uint64_t task_id)
 

Functions

 MODULE ("turnstone.kernel.cpu.task")
 
void video_text_print (const char_t *str)
 
void memory_set_current_task_getter (memory_current_task_getter_f getter)
 
int8_t kmain64 (void)
 
int8_t task_task_switch_isr (interrupt_frame_ext_t *frame)
 
void task_save_registers (task_registers_t *registers)
 
void task_load_registers (task_registers_t *registers)
 
void task_cleanup (void)
 
task_ttask_find_next_task (void)
 
void task_idle_task (void)
 
int8_t task_create_idle_task (void)
 
void task_toggle_wait_for_future (uint64_t task_id)
 
task_ttask_get_current_task (void)
 returns current task More...
 
int8_t task_init_tasking_ext (memory_heap_t *heap)
 inits kernel tasking, configures tss and kernel task More...
 
int8_t task_set_current_and_idle_task (void *entry_point, uint64_t stack_base, uint64_t stack_size)
 
static void task_cleanup_task (task_t *task)
 
void task_task_switch_set_parameters (boolean_t need_eoi, boolean_t need_sti)
 sets task switch parameters More...
 
static void task_switch_task_exit_prep (void)
 
void task_switch_task (void)
 switches current task to a new one.
 
void task_end_task (void)
 
void task_kill_task (uint64_t task_id, boolean_t force)
 
void task_add_message_queue (list_t *queue)
 adds a queue to task More...
 
list_ttask_get_message_queue (uint64_t task_id, uint64_t queue_number)
 
void task_set_message_waiting (void)
 sets current task's message waiting flag
 
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...
 
void task_yield (void)
 yields task for waiting other tasks.
 
uint64_t task_get_id (void)
 returns current task's id More...
 
void task_current_task_sleep (uint64_t wake_tick)
 sleep for current task for ticks More...
 
void task_clear_message_waiting (uint64_t tid)
 clears current task's message waiting flag More...
 
void task_set_interrupt_received (uint64_t tid)
 sets current task's interrupt received flag More...
 
void task_set_interruptible (void)
 sets current task's interruptible flag
 
void task_print_all (void)
 
buffer_ttask_get_task_input_buffer (uint64_t tid)
 
buffer_ttask_get_task_output_buffer (uint64_t tid)
 
buffer_ttask_get_task_error_buffer (uint64_t tid)
 
buffer_ttask_get_input_buffer (void)
 
buffer_ttask_get_output_buffer (void)
 
buffer_ttask_get_error_buffer (void)
 
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)
 

Variables

lock_current_task_getter_f lock_get_current_task_getter
 
lock_task_yielder_f lock_task_yielder
 
stdbuf_task_buffer_getter_f stdbufs_task_get_input_buffer
 
stdbuf_task_buffer_getter_f stdbufs_task_get_output_buffer
 
stdbuf_task_buffer_getter_f stdbufs_task_get_error_buffer
 
future_task_wait_toggler_f future_task_wait_toggler_func
 
buffer_tstdbufs_default_input_buffer
 
buffer_tstdbufs_default_output_buffer
 
buffer_tstdbufs_default_error_buffer
 
uint64_t task_next_task_id = 0
 
lock_ttask_next_task_id_lock = NULL
 
volatile boolean_t task_tasking_initialized = false
 
list_t ** task_queues = NULL
 
list_t ** task_cleanup_queues = NULL
 
map_t task_map = NULL
 
uint32_t task_mxcsr_mask = 0
 
boolean_t local_apic_id_is_valid
 
volatile cpu_state_t __seg_gs * cpu_state
 
lock_ttask_find_next_task_lock = NULL
 
static char_t task_switch_task_id_buf [100] = {0}
 

Detailed Description

cpu task methods

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Function Documentation

◆ task_add_message_queue()

void task_add_message_queue ( list_t queue)

adds a queue to task

Parameters
[in]queuequeue which task will have. tasks consumes these queues

◆ task_clear_message_waiting()

void task_clear_message_waiting ( uint64_t  task_id)

clears current task's message waiting flag

Parameters
[in]task_idtask id

◆ task_create_task()

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

Parameters
[in]heapcreator heap
[in]heap_sizetask's heap size, heap allocated with frame allocator
[in]stack_sizetask's stack size, stack allocated with frame allocator
[in]entry_pointtask's entry point
[in]args_cntargument count
[in]argsargument list
[in]task_nametask's name

◆ task_current_task_sleep()

void task_current_task_sleep ( uint64_t  wake_tick)

sleep for current task for ticks

Parameters
[in]wake_ticktick count for sleep

◆ task_get_current_task()

void * task_get_current_task ( void  )

returns current task

Returns
current task

◆ task_get_id()

uint64_t task_get_id ( void  )

returns current task's id

Returns
task id

◆ task_init_tasking_ext()

int8_t task_init_tasking_ext ( memory_heap_t heap)

inits kernel tasking, configures tss and kernel task

Parameters
[in]heapthe heap of kernel task and tasking related variables.

◆ task_set_interrupt_received()

void task_set_interrupt_received ( uint64_t  task_id)

sets current task's interrupt received flag

Parameters
[in]task_idtask id

◆ task_task_switch_set_parameters()

void task_task_switch_set_parameters ( boolean_t  need_eoi,
boolean_t  need_sti 
)

sets task switch parameters

Parameters
[in]need_eoiif task switching needs notify local apic this field should be true
[in]need_stiif task switching needs enable interrupts this field should be true