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.h>
#include <time/timer.h>
#include <logging.h>
#include <systeminfo.h>
#include <linker.h>
#include <utils.h>
#include <hashmap.h>
#include <stdbufs.h>
#include <hypervisor/hypervisor_vmxops.h>
#include <hypervisor/hypervisor_vm.h>
#include <hypervisor/hypervisor_macros.h>
#include <strings.h>
#include <spool.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)
 
static int8_t task_sleep_queue_comparator (const void *item1, const void *item2)
 
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_task_switch_exit (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)
 
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.
 
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
 
memory_heap_ttask_map_heap = NULL
 
memory_heap_t ** task_queue_and_cleanup_heaps = NULL
 
list_t ** task_queues = NULL
 
list_t ** task_sleep_queues
 task sleep lists
 
list_t ** task_wait_queues
 task wait lists
 
list_t ** task_cleanup_queues = NULL
 
hashmap_ttask_map = NULL
 
uint32_t task_mxcsr_mask = 0
 
uint64_t task_max_tick_count_limit = 0
 
volatile uint64_t time_timer_rdtsc_delta
 
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_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_get_current_task()

void * task_get_current_task ( void  )

returns current task

Returns
current task

◆ 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_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