mirror of
https://github.com/LearningOS/rust-based-os-comp2022.git
synced 2026-02-09 13:15:35 +08:00
17 lines
589 B
Rust
17 lines
589 B
Rust
//! Rust wrapper around `__switch`.
|
|
//!
|
|
//! Switching to a different task's context happens here. The actual
|
|
//! implementation must not be in Rust and (essentially) has to be in assembly
|
|
//! language (Do you know why?), so this module really is just a wrapper around
|
|
//! `switch.S`.
|
|
|
|
core::arch::global_asm!(include_str!("switch.S"));
|
|
|
|
use super::TaskContext;
|
|
|
|
extern "C" {
|
|
/// Switch to the context of `next_task_cx_ptr`, saving the current context
|
|
/// in `current_task_cx_ptr`.
|
|
pub fn __switch(current_task_cx_ptr: *mut TaskContext, next_task_cx_ptr: *const TaskContext);
|
|
}
|