void nmi_handler(void) { // Clock Security System triggered NMI if ((RCC_CIR & RCC_CIR_CSSF) != 0) { fault_handler("Clock instability"); } }
void isr_stub(struct int_frame *r) { if (r->int_no < ISR_IRQ0 || r->int_no == ISR_UNKNOWN) { fault_handler(r); } else if (r->int_no < ISR_IRQ0 + 16) { irq_handler(r); } else if (r->int_no == ISR_SYSCALL) { syscall(); // get syscall number form proc->fm } else { panic("isr_stub: wrong interrupt number"); } }
/* restoreregs * this is where win32 handles traps */ int restoreregs(lib7_state_t *lib7_state) { extern Word_t request_fault[]; caught_cntrl_c = FALSE; __try{ int request; request = asm_restoreregs(lib7_state); return request; } __except(fault_handler(GetExceptionCode(), (Word_t *)(GetExceptionInformation())->ContextRecord->Eip) ? #ifdef HOST_X86 ((Word_t *)(GetExceptionInformation())->ContextRecord->Eip = request_fault, EXCEPTION_CONTINUE_EXECUTION) : EXCEPTION_CONTINUE_SEARCH) #else # error non-x86 win32 platforms need restoreregs support #endif { /* nothing */ } }
void mem_manage_handler(void) { fault_handler("Memory fault"); }
void hard_fault_handler(void) { fault_handler("Hard fault"); }
void __attribute__((noreturn)) __stack_chk_fail(void) { fault_handler("Stack smashing"); }