1use crate::context::current_thread;
2use config::BootEnv;
3use core::sync::atomic::Ordering;
4use krt::boot_env;
5
6pub extern "C" fn interrupt_handler(frame: &mut TrapFrame) {
12 let td = current_thread();
13
14 unsafe { td.active_interrupts().fetch_add(1, Ordering::Relaxed) };
15
16 match frame.num {
17 TrapNo::Breakpoint => match boot_env() {
18 BootEnv::Vm(vm) => super::vm::interrupt_handler(vm, frame),
19 },
20 }
21
22 unsafe { td.active_interrupts().fetch_sub(1, Ordering::Relaxed) };
23}
24
25pub extern "C" fn syscall_handler() {
31 let td = current_thread();
33 let p = td.proc();
34
35 td.set_profiling_ticks(0);
36
37 p.abi().syscall_handler();
39
40 todo!()
41}
42
43#[allow(dead_code)] #[repr(u32)]
46#[derive(Clone, Copy, PartialEq, Eq)]
47pub enum TrapNo {
48 Breakpoint = 3, }
50
51#[repr(C)]
53pub struct TrapFrame {
54 pub rdi: usize, pub rsi: usize, pub rdx: usize, pub rcx: usize, pub r8: usize, pub r9: usize, pub rax: usize, pub rbx: usize, pub rbp: usize, pub r10: usize, pub r11: usize, pub r12: usize, pub r13: usize, pub r14: usize, pub r15: usize, pub num: TrapNo, pub fs: u16, pub gs: u16, }