Make pmap_fault() return values vm subsystem compliant to

simplify their handling in abort_handler(). While here,
remove one extra initialization of pcb variable.
This commit is contained in:
skra 2016-01-26 13:50:44 +00:00
parent a8467604b3
commit c79983aa4c
2 changed files with 10 additions and 15 deletions

View File

@ -6151,7 +6151,7 @@ pmap_fault(pmap_t pmap, vm_offset_t far, uint32_t fsr, int idx, bool usermode)
__func__, pmap, pmap->pm_pt1, far);
panic("%s: pm_pt1 abort", __func__);
}
return (EFAULT);
return (KERN_INVALID_ADDRESS);
}
if (__predict_false(IN_RANGE2(far, PT2MAP, PT2MAP_SIZE))) {
/*
@ -6167,7 +6167,7 @@ pmap_fault(pmap_t pmap, vm_offset_t far, uint32_t fsr, int idx, bool usermode)
__func__, pmap, PT2MAP, far);
panic("%s: PT2MAP abort", __func__);
}
return (EFAULT);
return (KERN_INVALID_ADDRESS);
}
/*
@ -6187,7 +6187,7 @@ pmap_fault(pmap_t pmap, vm_offset_t far, uint32_t fsr, int idx, bool usermode)
if (!pte2_cmpset(pte2p, pte2, pte2 | PTE2_A)) {
goto pte2_seta;
}
return (0);
return (KERN_SUCCESS);
}
}
if (idx == FAULT_ACCESS_L1) {
@ -6198,7 +6198,7 @@ pmap_fault(pmap_t pmap, vm_offset_t far, uint32_t fsr, int idx, bool usermode)
if (!pte1_cmpset(pte1p, pte1, pte1 | PTE1_A)) {
goto pte1_seta;
}
return (0);
return (KERN_SUCCESS);
}
}
@ -6222,7 +6222,7 @@ pmap_fault(pmap_t pmap, vm_offset_t far, uint32_t fsr, int idx, bool usermode)
goto pte2_setrw;
}
tlb_flush(trunc_page(far));
return (0);
return (KERN_SUCCESS);
}
}
if ((fsr & FSR_WNR) && (idx == FAULT_PERM_L1)) {
@ -6235,7 +6235,7 @@ pmap_fault(pmap_t pmap, vm_offset_t far, uint32_t fsr, int idx, bool usermode)
goto pte1_setrw;
}
tlb_flush(pte1_trunc(far));
return (0);
return (KERN_SUCCESS);
}
}
@ -6274,7 +6274,7 @@ pmap_fault(pmap_t pmap, vm_offset_t far, uint32_t fsr, int idx, bool usermode)
}
}
#endif
return (EAGAIN);
return (KERN_FAILURE);
}
/* !!!! REMOVE !!!! */

View File

@ -336,14 +336,10 @@ abort_handler(struct trapframe *tf, int prefetch)
#ifdef ARM_NEW_PMAP
rv = pmap_fault(PCPU_GET(curpmap), far, fsr, idx, usermode);
if (rv == 0) {
if (rv == KERN_SUCCESS)
return;
} else if (rv == EFAULT) {
call_trapsignal(td, SIGSEGV, SEGV_MAPERR, far);
userret(td, tf);
return;
}
if (rv == KERN_INVALID_ADDRESS)
goto nogo;
#endif
/*
* Now, when we handled imprecise and debug aborts, the rest of
@ -452,7 +448,6 @@ abort_handler(struct trapframe *tf, int prefetch)
*/
/* fusubailout is used by [fs]uswintr to avoid page faulting. */
pcb = td->td_pcb;
if (__predict_false(pcb->pcb_onfault == fusubailout)) {
tf->tf_r0 = EFAULT;
tf->tf_pc = (register_t)pcb->pcb_onfault;