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.
- Extended
State - FPU/SSE/AVX extended state, saved and restored on context switch.
- Kernel
Stack - Kernel stack for a task
- Sync
Unsafe Cell - A wrapper around UnsafeCell that implements Sync for TaskState
- Task
- Represents a single task/thread in the system
- TaskId
- Unique identifier for a task
- User
Stack - User stack for a task (when running in userspace)
Enumsยง
- Resume
Kind - How this task must be resumed the next time the scheduler selects it.
- Task
Priority - Priority levels for tasks
- Task
State - State of a task in the scheduler
Functionsยง
- do_
restore_ ๐ โfirst_ task - First-task restore dispatcher. Like
do_switch_contextbut 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