pub unsafe extern "C" fn switch_to(
current: *mut KernelContext,
target: *const KernelContext,
)Expand description
Switch from current context to target context
This function saves the current kernel context and loads the target context. When the target task is later switched away from, it will resume execution right after this function call.
§Arguments
current- Pointer to current task’s kernel context (will be saved)target- Pointer to target task’s kernel context (will be loaded)
§Safety
This function manipulates CPU registers directly and must only be called with valid context pointers. The caller must ensure proper stack alignment and that both contexts point to valid memory.