Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Switch to new PTE bits.



details:   https://anonhg.NetBSD.org/src/rev/47d5e64d129d
branches:  trunk
changeset: 1004485:47d5e64d129d
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Oct 30 07:40:05 2019 +0000

description:
Switch to new PTE bits.

diffstat:

 sys/arch/i386/i386/gdt.c            |   6 +++---
 sys/arch/x86/x86/pmap.c             |  16 ++++++++--------
 sys/arch/xen/include/xenpmap.h      |   6 +++---
 sys/arch/xen/x86/x86_xpmap.c        |   8 ++++----
 sys/arch/xen/x86/xen_pmap.c         |  10 +++++-----
 sys/arch/xen/xen/if_xennet_xenbus.c |  14 +++++++-------
 6 files changed, 30 insertions(+), 30 deletions(-)

diffs (241 lines):

diff -r b8baf479ac81 -r 47d5e64d129d sys/arch/i386/i386/gdt.c
--- a/sys/arch/i386/i386/gdt.c  Wed Oct 30 07:28:13 2019 +0000
+++ b/sys/arch/i386/i386/gdt.c  Wed Oct 30 07:40:05 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gdt.c,v 1.70 2019/03/09 08:42:25 maxv Exp $    */
+/*     $NetBSD: gdt.c,v 1.71 2019/10/30 07:40:05 maxv Exp $    */
 
 /*
  * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.70 2019/03/09 08:42:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.71 2019/10/30 07:40:05 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -83,7 +83,7 @@
        pt_entry_t *ptp;
 
        ptp = kvtopte((vaddr_t)table);
-       pa = (*ptp & PG_FRAME) | ((vaddr_t)table & ~PG_FRAME);
+       pa = (*ptp & PTE_4KFRAME) | ((vaddr_t)table & ~PTE_4KFRAME);
        if (HYPERVISOR_update_descriptor(pa, entry->raw[0], entry->raw[1]))
                panic("HYPERVISOR_update_descriptor failed\n");
 #endif
diff -r b8baf479ac81 -r 47d5e64d129d sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Wed Oct 30 07:28:13 2019 +0000
+++ b/sys/arch/x86/x86/pmap.c   Wed Oct 30 07:40:05 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.336 2019/10/05 07:19:49 maxv Exp $  */
+/*     $NetBSD: pmap.c,v 1.337 2019/10/30 07:40:05 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.336 2019/10/05 07:19:49 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.337 2019/10/30 07:40:05 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -747,7 +747,7 @@
            pm != vm_map_pmap(&curproc->p_vmspace->vm_map))
                return;
 
-       if ((opte ^ npte) & PG_X)
+       if ((opte ^ npte) & PTE_X)
                pmap_update_pg(va);
 
        /*
@@ -757,7 +757,7 @@
         * We can't do that because of locking constraints on the vm map.
         */
 
-       if ((opte & PG_X) && (npte & PG_X) == 0 && va == pm->pm_hiexec) {
+       if ((opte & PTE_X) && (npte & PTE_X) == 0 && va == pm->pm_hiexec) {
                struct trapframe *tf = curlwp->l_md.md_regs;
 
                tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL);
@@ -1068,13 +1068,13 @@
         * into a x86 PTE.
         */
        protection_codes[VM_PROT_NONE] = pmap_pg_nx;
-       protection_codes[VM_PROT_EXECUTE] = PG_X;
+       protection_codes[VM_PROT_EXECUTE] = PTE_X;
        protection_codes[VM_PROT_READ] = pmap_pg_nx;
-       protection_codes[VM_PROT_READ|VM_PROT_EXECUTE] = PG_X;
+       protection_codes[VM_PROT_READ|VM_PROT_EXECUTE] = PTE_X;
        protection_codes[VM_PROT_WRITE] = PTE_W | pmap_pg_nx;
-       protection_codes[VM_PROT_WRITE|VM_PROT_EXECUTE] = PTE_W | PG_X;
+       protection_codes[VM_PROT_WRITE|VM_PROT_EXECUTE] = PTE_W | PTE_X;
        protection_codes[VM_PROT_WRITE|VM_PROT_READ] = PTE_W | pmap_pg_nx;
-       protection_codes[VM_PROT_ALL] = PTE_W | PG_X;
+       protection_codes[VM_PROT_ALL] = PTE_W | PTE_X;
 
        /*
         * Now we init the kernel's pmap.
diff -r b8baf479ac81 -r 47d5e64d129d sys/arch/xen/include/xenpmap.h
--- a/sys/arch/xen/include/xenpmap.h    Wed Oct 30 07:28:13 2019 +0000
+++ b/sys/arch/xen/include/xenpmap.h    Wed Oct 30 07:40:05 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xenpmap.h,v 1.41 2019/02/13 06:52:43 cherry Exp $      */
+/*     $NetBSD: xenpmap.h,v 1.42 2019/10/30 07:40:06 maxv Exp $        */
 
 /*
  *
@@ -85,7 +85,7 @@
 static __inline paddr_t
 xpmap_mtop(paddr_t mpa)
 {
-       return (xpmap_mtop_masked(mpa) | (mpa & ~PG_FRAME));
+       return (xpmap_mtop_masked(mpa) | (mpa & ~PTE_4KFRAME));
 }
 
 static __inline paddr_t
@@ -99,7 +99,7 @@
 static __inline paddr_t
 xpmap_ptom(paddr_t ppa)
 {
-       return (xpmap_ptom_masked(ppa) | (ppa & ~PG_FRAME));
+       return (xpmap_ptom_masked(ppa) | (ppa & ~PTE_4KFRAME));
 }
 
 static __inline void
diff -r b8baf479ac81 -r 47d5e64d129d sys/arch/xen/x86/x86_xpmap.c
--- a/sys/arch/xen/x86/x86_xpmap.c      Wed Oct 30 07:28:13 2019 +0000
+++ b/sys/arch/xen/x86/x86_xpmap.c      Wed Oct 30 07:40:05 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: x86_xpmap.c,v 1.84 2019/03/09 08:42:25 maxv Exp $      */
+/*     $NetBSD: x86_xpmap.c,v 1.85 2019/10/30 07:40:06 maxv Exp $      */
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.84 2019/03/09 08:42:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.85 2019/10/30 07:40:06 maxv Exp $");
 
 #include "opt_xen.h"
 #include "opt_ddb.h"
@@ -489,7 +489,7 @@
 
        /* Set the NX/XD bit, if available. descs[3] = %edx. */
        x86_cpuid(0x80000001, descs);
-       xpmap_pg_nx = (descs[3] & CPUID_NOX) ? PG_NX : 0;
+       xpmap_pg_nx = (descs[3] & CPUID_NOX) ? PTE_NX : 0;
 
        /* Space after Xen boostrap tables should be free */
        xen_tables = xen_start_info.pt_base;
@@ -902,7 +902,7 @@
 
        /* Mark old tables RW */
        page = old_pgd;
-       addr = xpmap_mtop((paddr_t)L2[pl2_pi(page)] & PG_FRAME);
+       addr = xpmap_mtop((paddr_t)L2[pl2_pi(page)] & PTE_4KFRAME);
        pte = (pd_entry_t *)((u_long)addr + KERNBASE);
        pte += pl1_pi(page);
        while (page < old_pgd + (old_count * PAGE_SIZE) && page < map_end) {
diff -r b8baf479ac81 -r 47d5e64d129d sys/arch/xen/x86/xen_pmap.c
--- a/sys/arch/xen/x86/xen_pmap.c       Wed Oct 30 07:28:13 2019 +0000
+++ b/sys/arch/xen/x86/xen_pmap.c       Wed Oct 30 07:40:05 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xen_pmap.c,v 1.31 2019/03/10 16:30:01 maxv Exp $       */
+/*     $NetBSD: xen_pmap.c,v 1.32 2019/10/30 07:40:06 maxv Exp $       */
 
 /*
  * Copyright (c) 2007 Manuel Bouyer.
@@ -101,7 +101,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_pmap.c,v 1.31 2019/03/10 16:30:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_pmap.c,v 1.32 2019/10/30 07:40:06 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -177,10 +177,10 @@
 
        npte = ma | ((prot & VM_PROT_WRITE) ? PTE_W : 0) | PTE_P;
        if (flags & PMAP_NOCACHE)
-               npte |= PG_N;
+               npte |= PTE_PCD;
 
        if ((cpu_feature[2] & CPUID_NOX) && !(prot & VM_PROT_EXECUTE))
-               npte |= PG_NX;
+               npte |= PTE_NX;
 
        opte = pmap_pte_testset(pte, npte); /* zap! */
 
@@ -229,7 +229,7 @@
 
        if (__predict_true((pte & PTE_P) != 0)) {
                if (pap != NULL)
-                       *pap = (pte & PG_FRAME) | (va & (NBPD_L1 - 1));
+                       *pap = (pte & PTE_4KFRAME) | (va & (NBPD_L1 - 1));
                return true;
        }
 
diff -r b8baf479ac81 -r 47d5e64d129d sys/arch/xen/xen/if_xennet_xenbus.c
--- a/sys/arch/xen/xen/if_xennet_xenbus.c       Wed Oct 30 07:28:13 2019 +0000
+++ b/sys/arch/xen/xen/if_xennet_xenbus.c       Wed Oct 30 07:40:05 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: if_xennet_xenbus.c,v 1.86 2019/03/09 08:42:25 maxv Exp $      */
+/*      $NetBSD: if_xennet_xenbus.c,v 1.87 2019/10/30 07:40:06 maxv Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -84,7 +84,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.86 2019/03/09 08:42:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.87 2019/10/30 07:40:06 maxv Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -149,9 +149,9 @@
 #ifdef XENPVHVM
 /* Glue for p2m table stuff. Should be removed eventually */
 #define xpmap_mtop_masked(mpa) (mpa & ~PAGE_MASK)
-#define xpmap_mtop(mpa) (mpa & ~PG_FRAME)
+#define xpmap_mtop(mpa) (mpa & ~PTE_4KFRAME)
 #define xpmap_ptom_masked(mpa) (mpa & ~PAGE_MASK)
-#define xpmap_ptom(mpa) (mpa & ~PG_FRAME)
+#define xpmap_ptom(mpa) (mpa & ~PTE_4KFRAME)
 #define xpmap_ptom_map(ppa, mpa)
 #define xpmap_ptom_unmap(ppa)
 #define xpmap_ptom_isvalid 1 /* XXX: valid PA check */
@@ -1238,7 +1238,7 @@
                }
 
                if (m->m_pkthdr.len != m->m_len ||
-                   (pa ^ (pa + m->m_pkthdr.len - 1)) & PG_FRAME) {
+                   (pa ^ (pa + m->m_pkthdr.len - 1)) & PTE_4KFRAME) {
 
                        MGETHDR(new_m, M_DONTWAIT, MT_DATA);
                        if (__predict_false(new_m == NULL)) {
@@ -1295,7 +1295,7 @@
                }
                MCLAIM(m, &sc->sc_ethercom.ec_tx_mowner);
 
-               KASSERT(((pa ^ (pa + m->m_pkthdr.len -  1)) & PG_FRAME) == 0);
+               KASSERT(((pa ^ (pa + m->m_pkthdr.len -  1)) & PTE_4KFRAME) == 0);
 
                SLIST_REMOVE_HEAD(&sc->sc_txreq_head, txreq_next);
                req->txreq_m = m;
@@ -1319,7 +1319,7 @@
                txreq = RING_GET_REQUEST(&sc->sc_tx_ring, req_prod);
                txreq->id = req->txreq_id;
                txreq->gref = req->txreq_gntref;
-               txreq->offset = pa & ~PG_FRAME;
+               txreq->offset = pa & ~PTE_4KFRAME;
                txreq->size = m->m_pkthdr.len;
                txreq->flags = txflags;
 



Home | Main Index | Thread Index | Old Index