MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / sch

Function sch

src/sys/idt.rs:313–348  ·  view source on GitHub ↗

sch

(stack_frame: &mut InterruptStackFrame, reg: &mut Reg)

Source from the content-addressed store, hash-verified

311
312// sch
313extern "sysv64" fn sch(stack_frame: &mut InterruptStackFrame, reg: &mut Reg)
314{
315 let n = reg.rax;
316 let a1 = reg.rdi;
317 let a2 = reg.rsi;
318 let a3 = reg.rdx;
319
320 // Create backup of the CPU context
321 if n == crate::sys::sc::SPAWN
322 {
323 crate::sys::proc::setsf(stack_frame.clone());
324 crate::sys::proc::setreg(*reg);
325 }
326
327 let res = crate::sys::sc::dispatch(n, a1, a2, a3);
328
329
330 // Restore from backup
331 if n == crate::sys::sc::EXIT
332 {
333 let stackframe = crate::sys::proc::sf();
334
335 unsafe
336 {
337 core::ptr::write_volatile(stack_frame.as_mut().extract_inner() as *mut InterruptStackFrameValue, stackframe);
338 core::ptr::write_volatile(reg, crate::sys::proc::reg());
339 }
340 }
341
342 reg.rax = res;
343
344 unsafe
345 {
346 crate::pic::PICS.lock().notify_intrend(0x80)
347 };
348}
349
350
351// Clear interrupt-request mask

Callers

nothing calls this directly

Calls 8

setsfFunction · 0.85
setregFunction · 0.85
dispatchFunction · 0.85
sfFunction · 0.85
regFunction · 0.85
extract_innerMethod · 0.80
lockMethod · 0.80
notify_intrendMethod · 0.45

Tested by

no test coverage detected