Struct axhal::arch::TaskContext
source · pub struct TaskContext {
pub kstack_top: VirtAddr,
pub rsp: u64,
pub fs_base: usize,
pub ext_state: ExtendedState,
}Expand description
Saved hardware states of a task.
The context usually includes:
- Callee-saved registers
- Stack pointer register
- Thread pointer register (for thread-local storage, currently unsupported)
- FP/SIMD registers
On context switch, current task saves its context from CPU to memory, and the next task restores its context from memory to CPU.
On x86_64, callee-saved registers are saved to the kernel stack by the
PUSH instruction. So that rsp is the RSP after callee-saved
registers are pushed, and kstack_top is the top of the kernel stack
(RSP before any push).
Fields§
§kstack_top: VirtAddrThe kernel stack top of the task.
rsp: u64RSP after all callee-saved registers are pushed.
fs_base: usizeThread Local Storage (TLS).
ext_state: ExtendedStateAvailable on crate feature
fp_simd only.Extended states, i.e., FP/SIMD states.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TaskContext
impl RefUnwindSafe for TaskContext
impl Send for TaskContext
impl Sync for TaskContext
impl Unpin for TaskContext
impl UnwindSafe for TaskContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more