X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/28c176b668c841a3b7fb093faccf0efa39257603..f89517343bf062d299d54408eea2f9387bfefb6d:/lunaix-os/arch/x86/exceptions/intr_routines.c diff --git a/lunaix-os/arch/x86/exceptions/intr_routines.c b/lunaix-os/arch/x86/exceptions/intr_routines.c deleted file mode 100644 index 05f547e..0000000 --- a/lunaix-os/arch/x86/exceptions/intr_routines.c +++ /dev/null @@ -1,98 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "sys/apic.h" -#include - -LOG_MODULE("INTR") - -extern void -intr_routine_page_fault(const struct hart_state* state); - -extern u32_t debug_resv; - -void -__print_panic_msg(const char* msg, const struct hart_state* state) -{ - ERROR("panic: %s", msg); - failsafe_diagnostic(); -} - -void -intr_routine_divide_zero(const struct hart_state* state) -{ - __print_panic_msg("div zero", state); -} - -void -intr_routine_general_protection(const struct hart_state* state) -{ - __print_panic_msg("general protection", state); -} - -void -intr_routine_sys_panic(const struct hart_state* state) -{ -#ifdef CONFIG_ARCH_X86_64 - __print_panic_msg((char*)(state->registers.rdi), state); -#else - __print_panic_msg((char*)(state->registers.edi), state); -#endif -} - -void -intr_routine_fallback(const struct hart_state* state) -{ - __print_panic_msg("unknown interrupt", state); -} - -/** - * @brief ISR for Spurious interrupt - * - * @param struct hart_state passed by CPU - */ -void -intr_routine_apic_spi(const struct hart_state* state) -{ - // FUTURE: do nothing for now -} - -void -intr_routine_apic_error(const struct hart_state* state) -{ - u32_t error_reg = apic_read_reg(APIC_ESR); - char buf[32]; - ksprintf(buf, "APIC error, ESR=0x%x", error_reg); - - failsafe_diagnostic(); -} - -void -intr_routine_sched(const struct hart_state* state) -{ - schedule(); -} - -void -intr_routine_init() -{ - isrm_bindiv(FAULT_DIVISION_ERROR, intr_routine_divide_zero); - isrm_bindiv(FAULT_GENERAL_PROTECTION, intr_routine_general_protection); - isrm_bindiv(FAULT_PAGE_FAULT, intr_routine_page_fault); - isrm_bindiv(FAULT_STACK_SEG_FAULT, intr_routine_page_fault); - - isrm_bindiv(LUNAIX_SYS_PANIC, intr_routine_sys_panic); - isrm_bindiv(LUNAIX_SCHED, intr_routine_sched); - - isrm_bindiv(APIC_SPIV_IV, intr_routine_apic_spi); - isrm_bindiv(APIC_ERROR_IV, intr_routine_apic_error); -} \ No newline at end of file