int fault_page_fault_handler(spdid_t spdid, void *fault_addr, int flags, void *ip) { if (regs_active) BUG(); regs_active = 1; cos_regs_save(cos_get_thd_id(), spdid, fault_addr, ®s); printc("Thread %d faults in spd %d @ %p\n", cos_get_thd_id(), spdid, fault_addr); cos_regs_print(®s); BUG(); /* no fault is a good fault currently */ // sched_block(spdid, 0); return 0; }
int fault_page_fault_handler(spdid_t spdid, void *fault_addr, int flags, void *orig_ip) { if (regs_active) BUG(); regs_active = 1; cos_regs_save(cos_get_thd_id(), spdid, fault_addr, ®s); printc("Thread %d faults in spd %d @ %p\n", cos_get_thd_id(), spdid, fault_addr); cos_regs_print(®s); walk_stack_all(spdid, ®s); /* No fault is a good fault currently. Thus if we get _any_ * fault, we bomb out here. Look into the stack-trace, as * that is where the problem is. */ printc("Bombing out after fault.\n"); BUG(); return 0; }
int fault_page_fault_handler(spdid_t spdid, void *fault_addr, int flags, void *ip) { unsigned long r_ip; /* the ip to return to */ int tid = cos_get_thd_id(); int i; /* START UNCOMMENT FOR FAULT INFO */ if (regs_active) BUG(); regs_active = 1; cos_regs_save(tid, spdid, fault_addr, ®s); printc("Thread %d faults in spd %d @ %p\n", tid, spdid, fault_addr); cos_regs_print(®s); regs_active = 0; for (i = 0 ; i < 5 ; i++) printc("Frame ip:%lx, sp:%lx\n", cos_thd_cntl(COS_THD_INVFRM_IP, tid, i, 0), cos_thd_cntl(COS_THD_INVFRM_SP, tid, i, 0)); /* END UNCOMMENT FOR FAULT INFO */ /* remove from the invocation stack the faulting component! */ assert(!cos_thd_cntl(COS_THD_INV_FRAME_REM, tid, 1, 0)); /* Manipulate the return address of the component that called * the faulting component... */ assert(r_ip = cos_thd_cntl(COS_THD_INVFRM_IP, tid, 1, 0)); /* ...and set it to its value -8, which is the fault handler * of the stub. */ assert(!cos_thd_cntl(COS_THD_INVFRM_SET_IP, tid, 1, r_ip-8)); /* * Look at the booter: when recover is happening, the sstub is * set to 0x1, thus we should just wait till recovery is done. */ if ((int)ip == 1) failure_notif_wait(cos_spd_id(), spdid); else failure_notif_fail(cos_spd_id(), spdid); return 0; }