diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2018-02-22 20:36:41 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2018-02-22 20:36:41 +0000 |
commit | d5d384ed9794a3290d6685c4dc697c5d44bb8739 (patch) | |
tree | ae9292a91dfdf37f4915bce4d7fc4e8e13091fdd /sys | |
parent | 691ccdfa2e98c3a9236f85f484a949aad14c8dd1 (diff) |
Set the PG_G (global) bit on the special page table entries that are shared
between the u-k and u+k tables, because they're actually in *all* tables.
ok bluhm@ kettenis@ mlarkin@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/pmap.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c index 3e559206608..4ea444b3917 100644 --- a/sys/arch/amd64/amd64/pmap.c +++ b/sys/arch/amd64/amd64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.109 2018/02/21 19:24:15 guenther Exp $ */ +/* $OpenBSD: pmap.c,v 1.110 2018/02/22 20:36:40 guenther Exp $ */ /* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */ /* @@ -2035,6 +2035,8 @@ pmap_enter_special(vaddr_t va, paddr_t pa, vm_prot_t prot) pd_entry_t *pd, *ptp; paddr_t npa; struct pmap *pmap = pmap_kernel(); + pt_entry_t *ptes; + int level, offs; /* If CPU is secure, no need to do anything */ if (!cpu_meltdown) @@ -2138,25 +2140,18 @@ pmap_enter_special(vaddr_t va, paddr_t pa, vm_prot_t prot) (uint64_t)npa); DPRINTF("%s: setting PTE, PT page @ phys 0x%llx virt 0x%llx prot " - "0x%llx was 0x%llx\n", __func__, (uint64_t)npa, (uint64_t)pd, (uint64_t)prot, (uint64_t)pd[l1idx]); + "0x%llx was 0x%llx\n", __func__, (uint64_t)npa, (uint64_t)pd, + (uint64_t)prot, (uint64_t)pd[l1idx]); - pd[l1idx] = pa | protection_codes[prot] | PG_V | pg_g_kern | PG_W; + pd[l1idx] = pa | protection_codes[prot] | PG_V | PG_G | PG_W; DPRINTF("%s: setting PTE[%lld] = 0x%llx\n", __func__, l1idx, pd[l1idx]); - if (pg_g_kern) { - /* now set the PG_G flag on the corresponding U+K entry */ - pt_entry_t *ptes; - int level, offs; - - level = pmap_find_pte_direct(pmap, va, &ptes, &offs); - if (__predict_true(level == 0 && - pmap_valid_entry(ptes[offs]))) { - ptes[offs] |= pg_g_kern; - } else { - DPRINTF("%s: no U+K mapping for special mapping?\n", - __func__); - } - } + /* now set the PG_G flag on the corresponding U+K entry */ + level = pmap_find_pte_direct(pmap, va, &ptes, &offs); + if (__predict_true(level == 0 && pmap_valid_entry(ptes[offs]))) + ptes[offs] |= PG_G; + else + DPRINTF("%s: no U+K mapping for special mapping?\n", __func__); } /* |