1 #include <lunaix/mm/fault.h>
2 #include <lunaix/hart_state.h>
5 __arch_prepare_fault_context(struct fault_context* fault)
7 struct hart_state* ictx = fault->hstate;
9 ptr_t ptr = cpu_ldeaddr();
14 fault->fault_ptep = mkptep_va(VMS_SELF, ptr);
15 fault->fault_data = ictx->execp->err_code;
16 fault->fault_instn = hart_pc(ictx);
17 fault->fault_va = ptr;
24 intr_routine_page_fault(const struct hart_state* hstate)
26 if (hstate->depth > 10) {
27 // Too many nested fault! we must messed up something
28 // XXX should we failed silently?
32 struct fault_context fault = { .hstate = hstate };
34 if (!__arch_prepare_fault_context(&fault)) {
38 if (!handle_page_fault(&fault)) {
45 fault_resolving_failed(&fault);