Skip to main content

Module task

Module task 

Source
Expand description

Task Management

Defines the Task structure and related types for the Strat9-OS scheduler.

Structsยง

CpuContext
CPU context saved/restored during context switches.
ExtendedState
FPU/SSE/AVX extended state, saved and restored on context switch.
KernelStack
Kernel stack for a task
SyncUnsafeCell
A wrapper around UnsafeCell that implements Sync for TaskState
Task
Represents a single task/thread in the system
TaskId
Unique identifier for a task
UserStack
User stack for a task (when running in userspace)

Enumsยง

ResumeKind
How this task must be resumed the next time the scheduler selects it.
TaskPriority
Priority levels for tasks
TaskState
State of a task in the scheduler

Functionsยง

do_restore_first_task ๐Ÿ”’ โš 
First-task restore dispatcher. Like do_switch_context but without saving old state (there is no previous task).
do_switch_context ๐Ÿ”’ โš 
Context switch dispatcher. Picks the xsave or fxsave path based on host capabilities, then performs the full save/swap/restore sequence.
next_pid ๐Ÿ”’
Performs the next pid operation.
next_tid ๐Ÿ”’
Performs the next tid operation.
normalized_xcr0 ๐Ÿ”’
restore_first_task_fxsave ๐Ÿ”’ โš 
rdi=frame_ptr, rsi=fpu_ptr
restore_first_task_xsave ๐Ÿ”’ โš 
rdi=frame_ptr, rsi=fpu_ptr, rdx=xcr0
switch_context_fxsave ๐Ÿ”’ โš 
rdi=old_rsp, rsi=new_rsp, rdx=old_fpu, rcx=new_fpu
switch_context_xsave ๐Ÿ”’ โš 
rdi=old_rsp, rsi=new_rsp, rdx=old_fpu, rcx=new_fpu, r8=new_xcr0, r9=old_xcr0
task_entry_trampolineโš 
Trampoline for newly created tasks.
task_post_switch_enter ๐Ÿ”’

Type Aliasesยง

Pid
POSIX process ID.
Tid
POSIX thread ID.