MCPcopy Create free account
hub / github.com/chyyuu/os_kernel_lab / trap_from_kernel

Function trap_from_kernel

os/src/trap/mod.rs:147–167  ·  view source on GitHub ↗
(_trap_cx: &TrapContext)

Source from the content-addressed store, hash-verified

145
146#[no_mangle]
147pub fn trap_from_kernel(_trap_cx: &TrapContext) {
148 let scause = scause::read();
149 let stval = stval::read();
150 match scause.cause() {
151 Trap::Interrupt(Interrupt::SupervisorExternal) => {
152 crate::board::irq_handler();
153 }
154 Trap::Interrupt(Interrupt::SupervisorTimer) => {
155 set_next_trigger();
156 check_timer();
157 // do not schedule now
158 }
159 _ => {
160 panic!(
161 "Unsupported trap from kernel: {:?}, stval = {:#x}!",
162 scause.cause(),
163 stval
164 );
165 }
166 }
167}
168
169pub use context::TrapContext;

Callers

nothing calls this directly

Calls 4

readFunction · 0.85
irq_handlerFunction · 0.85
set_next_triggerFunction · 0.85
check_timerFunction · 0.85

Tested by

no test coverage detected