Makes scheduler works at the end of the interruption
This commit is contained in:
@@ -3,7 +3,7 @@ use core::{arch::riscv64::wfi, time::Duration};
|
||||
use alloc::{format, string::String};
|
||||
|
||||
use crate::{
|
||||
scheduler::{scheduler, ACTIVE_PID, PROCESSUS_COUNT, PROCESS_TABLE},
|
||||
scheduler::{ACTIVE_PID, PROCESSUS_COUNT, PROCESS_TABLE},
|
||||
time::elapsed_time_since_startup,
|
||||
};
|
||||
|
||||
@@ -26,8 +26,8 @@ pub struct ExecutionContext {
|
||||
pub tp: usize,
|
||||
pub a: [usize; 8],
|
||||
pub t: [usize; 7],
|
||||
pub s: [usize; 11],
|
||||
pub mepc: usize,
|
||||
pub s: [usize; 12],
|
||||
pub mepc: *const usize,
|
||||
pub mstatus: usize,
|
||||
}
|
||||
|
||||
@@ -73,7 +73,8 @@ pub fn create_processus<T: Into<String>>(code: extern "C" fn(), name: T) -> i64
|
||||
PROCESS_TABLE[next_pid].state = ProcessState::Activable;
|
||||
PROCESS_TABLE[next_pid].entry_point = Some(code);
|
||||
PROCESS_TABLE[next_pid].ctx.a[0] = code as usize;
|
||||
PROCESS_TABLE[next_pid].ctx.ra = processus_launcher as *const _;
|
||||
PROCESS_TABLE[next_pid].ctx.mepc = processus_launcher as *const _;
|
||||
PROCESS_TABLE[next_pid].ctx.mstatus = 1 << 11;
|
||||
PROCESS_TABLE[next_pid].ctx.sp = &raw const PROCESS_TABLE[next_pid].stack[STACK_SIZE - 1];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user