From c79983aa4ceb0c55fbc46d966688fc754aa29a17 Mon Sep 17 00:00:00 2001 From: skra Date: Tue, 26 Jan 2016 13:50:44 +0000 Subject: [PATCH] Make pmap_fault() return values vm subsystem compliant to simplify their handling in abort_handler(). While here, remove one extra initialization of pcb variable. --- sys/arm/arm/pmap-v6-new.c | 14 +++++++------- sys/arm/arm/trap-v6.c | 11 +++-------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/sys/arm/arm/pmap-v6-new.c b/sys/arm/arm/pmap-v6-new.c index 2e4dfe26b1d9..2996898a4510 100644 --- a/sys/arm/arm/pmap-v6-new.c +++ b/sys/arm/arm/pmap-v6-new.c @@ -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 !!!! */ diff --git a/sys/arm/arm/trap-v6.c b/sys/arm/arm/trap-v6.c index 80cf793e7311..6d8015137939 100644 --- a/sys/arm/arm/trap-v6.c +++ b/sys/arm/arm/trap-v6.c @@ -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;