Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 Remove wrong KASSERT in EPT, and reorder th...



details:   https://anonhg.NetBSD.org/src/rev/1f582f1d6f92
branches:  trunk
changeset: 449082:1f582f1d6f92
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Feb 21 14:31:54 2019 +0000

description:
Remove wrong KASSERT in EPT, and reorder the code to reduce duplication.

diffstat:

 sys/arch/x86/x86/pmap.c |  15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diffs (61 lines):

diff -r 2e150da0ea20 -r 1f582f1d6f92 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Thu Feb 21 13:25:44 2019 +0000
+++ b/sys/arch/x86/x86/pmap.c   Thu Feb 21 14:31:54 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.324 2019/02/18 19:03:12 maxv Exp $  */
+/*     $NetBSD: pmap.c,v 1.325 2019/02/21 14:31:54 maxv Exp $  */
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.324 2019/02/18 19:03:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.325 2019/02/21 14:31:54 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -3643,25 +3643,25 @@
        pt_entry_t expect;
        bool need_shootdown;
 
-       expect = pmap_pa2pte(pa) | PG_V;
        ptp = pvpte->pte_ptp;
        va = pvpte->pte_va;
        KASSERT(ptp == NULL || ptp->uobject != NULL);
        KASSERT(ptp == NULL || ptp_va2o(va, 1) == ptp->offset);
        pmap = ptp_to_pmap(ptp);
+       KASSERT(kpreempt_disabled());
 
        if (__predict_false(pmap->pm_sync_pv != NULL)) {
                return (*pmap->pm_sync_pv)(ptp, va, pa, clearbits, oattrs,
                    optep);
        }
 
+       expect = pmap_pa2pte(pa) | PG_V;
+
        if (clearbits != ~0) {
                KASSERT((clearbits & ~(PP_ATTRS_M|PP_ATTRS_U|PP_ATTRS_W)) == 0);
                clearbits = pmap_pp_attrs_to_pte(clearbits);
        }
 
-       KASSERT(kpreempt_disabled());
-
        ptep = pmap_map_pte(pmap, ptp, va);
        do {
                opte = *ptep;
@@ -5487,13 +5487,8 @@
        bool need_shootdown;
 
        expect = pmap_pa2pte(pa) | EPT_R;
-       KASSERT(ptp == NULL || ptp->uobject != NULL);
-       KASSERT(ptp == NULL || ptp_va2o(va, 1) == ptp->offset);
        pmap = ptp_to_pmap(ptp);
 
-       KASSERT(clearbits == ~0 || (clearbits & ~(EPT_D | EPT_A | EPT_W)) == 0);
-       KASSERT(kpreempt_disabled());
-
        if (clearbits != ~0) {
                KASSERT((clearbits & ~(PP_ATTRS_M|PP_ATTRS_U|PP_ATTRS_W)) == 0);
                clearbits = pmap_pp_attrs_to_ept(clearbits);



Home | Main Index | Thread Index | Old Index