You can find their implementation(I just copied & pasted legacy code) below:
// feature/supervisor_interrupt.rs
pub fn forward_supervisor_timer() {
// Forward to S-level timer interrupt
unsafe {
mip::set_stimer(); // set S-timer interrupt flag
mie::clear_mext(); // Ref: rustsbi Pull request #5
mie::clear_mtimer(); // mask M-timer interrupt
}
}
pub fn forward_supervisor_soft() {
// Forward to S-level software interrupt
unsafe {
mip::set_ssoft(); // set S-soft interrupt flag
mie::clear_msoft(); // mask M-soft interrupt
}
}
The timer has passed the test in rCore-Tutorial-v3 while the soft has not been tested due to the lack of the SMP execution environment, I will apply myself to check it later.
Added two new types of machine traps:
MachineTrap::MachineTimer
MachineTrap::MachineSoft
Now the runtime is able to yield them:
When they are matched in two added arms in
execute::execute_supervisor
, two functions will be called:You can find their implementation(I just copied & pasted legacy code) below:
The timer has passed the test in rCore-Tutorial-v3 while the soft has not been tested due to the lack of the SMP execution environment, I will apply myself to check it later.