Better user programs with a special std. Sleep and exit are calling scheduler instead of wfi.
This commit is contained in:
@@ -57,11 +57,11 @@ pub fn scheduler_init() {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn scheduler(interrupt_state: ExecutionContext) -> *const ExecutionContext {
|
||||
pub fn scheduler_without_ret(interrupt_state: &mut *mut ExecutionContext) {
|
||||
// info!("scheduler");
|
||||
unsafe {
|
||||
let prev_pid = ACTIVE_PID;
|
||||
PROCESS_TABLE[prev_pid].ctx = interrupt_state;
|
||||
PROCESS_TABLE[prev_pid].ctx = **interrupt_state;
|
||||
|
||||
if PROCESS_TABLE[prev_pid].state == ProcessState::Active {
|
||||
PROCESS_TABLE[prev_pid].state = ProcessState::Activable;
|
||||
@@ -80,6 +80,6 @@ pub fn scheduler(interrupt_state: ExecutionContext) -> *const ExecutionContext {
|
||||
}
|
||||
PROCESS_TABLE[ACTIVE_PID].state = ProcessState::Active;
|
||||
|
||||
&raw const PROCESS_TABLE[ACTIVE_PID].ctx
|
||||
*interrupt_state = &raw mut PROCESS_TABLE[ACTIVE_PID].ctx
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user