Source-Changes-HG archive

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

[src/trunk]: src Switch to the new PTE naming. The old naming is now unused, ...



details:   https://anonhg.NetBSD.org/src/rev/1a981e96f358
branches:  trunk
changeset: 971468:1a981e96f358
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Apr 25 05:17:16 2020 +0000

description:
Switch to the new PTE naming. The old naming is now unused, remove it.

diffstat:

 lib/libkvm/kvm_i386.c                              |  20 +++++++-------
 lib/libkvm/kvm_i386pae.c                           |  20 +++++++-------
 lib/libkvm/kvm_x86_64.c                            |  28 +++++++++++-----------
 sys/arch/amd64/include/pte.h                       |  24 +------------------
 sys/arch/i386/i386/genassym.cf                     |   5 +---
 sys/arch/i386/include/kcore.h                      |   4 +-
 sys/arch/i386/include/pte.h                        |  28 +---------------------
 sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c |  14 +++++-----
 8 files changed, 46 insertions(+), 97 deletions(-)

diffs (truncated from 396 to 300 lines):

diff -r ee54c6b17722 -r 1a981e96f358 lib/libkvm/kvm_i386.c
--- a/lib/libkvm/kvm_i386.c     Sat Apr 25 00:07:27 2020 +0000
+++ b/lib/libkvm/kvm_i386.c     Sat Apr 25 05:17:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kvm_i386.c,v 1.30 2014/02/19 20:21:22 dsl Exp $        */
+/*     $NetBSD: kvm_i386.c,v 1.31 2020/04/25 05:17:16 maxv Exp $       */
 
 /*-
  * Copyright (c) 1989, 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)kvm_hp300.c        8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: kvm_i386.c,v 1.30 2014/02/19 20:21:22 dsl Exp $");
+__RCSID("$NetBSD: kvm_i386.c,v 1.31 2020/04/25 05:17:16 maxv Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -148,7 +148,7 @@
         * Find and read the page directory entry.
         * pdppaddr being PAGE_SIZE aligned, we mask the option bits.
         */
-       pde_pa = (cpu_kh->pdppaddr & PG_FRAME) + (pl2_pi(va) * sizeof(pde));
+       pde_pa = (cpu_kh->pdppaddr & PTE_FRAME) + (pl2_pi(va) * sizeof(pde));
        if (_kvm_pread(kd, kd->pmfd, (void *)&pde, sizeof(pde),
            _kvm_pa2off(kd, pde_pa)) != sizeof(pde)) {
                _kvm_syserr(kd, 0, "could not read PDE");
@@ -158,19 +158,19 @@
        /*
         * Find and read the page table entry.
         */
-       if ((pde & PG_V) == 0) {
+       if ((pde & PTE_P) == 0) {
                _kvm_err(kd, 0, "invalid translation (invalid PDE)");
                goto lose;
        }
-       if ((pde & PG_PS) != 0) {
+       if ((pde & PTE_PS) != 0) {
                /*
                 * This is a 4MB page.
                 */
-               page_off = va & ~PG_LGFRAME;
-               *pa = (pde & PG_LGFRAME) + page_off;
+               page_off = va & ~PTE_LGFRAME;
+               *pa = (pde & PTE_LGFRAME) + page_off;
                return (int)(NBPD_L2 - page_off);
        }
-       pte_pa = (pde & PG_FRAME) + (pl1_pi(va) * sizeof(pt_entry_t));
+       pte_pa = (pde & PTE_FRAME) + (pl1_pi(va) * sizeof(pt_entry_t));
        if (_kvm_pread(kd, kd->pmfd, (void *) &pte, sizeof(pte),
            _kvm_pa2off(kd, pte_pa)) != sizeof(pte)) {
                _kvm_syserr(kd, 0, "could not read PTE");
@@ -180,11 +180,11 @@
        /*
         * Validate the PTE and return the physical address.
         */
-       if ((pte & PG_V) == 0) {
+       if ((pte & PTE_P) == 0) {
                _kvm_err(kd, 0, "invalid translation (invalid PTE)");
                goto lose;
        }
-       *pa = (pte & PG_FRAME) + page_off;
+       *pa = (pte & PTE_FRAME) + page_off;
        return (int)(NBPG - page_off);
 
  lose:
diff -r ee54c6b17722 -r 1a981e96f358 lib/libkvm/kvm_i386pae.c
--- a/lib/libkvm/kvm_i386pae.c  Sat Apr 25 00:07:27 2020 +0000
+++ b/lib/libkvm/kvm_i386pae.c  Sat Apr 25 05:17:16 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_i386pae.c,v 1.2 2014/02/19 20:21:22 dsl Exp $ */
+/* $NetBSD: kvm_i386pae.c,v 1.3 2020/04/25 05:17:16 maxv Exp $ */
 
 /*
  * Copyright (c) 2010 Jean-Yves Migeon.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: kvm_i386pae.c,v 1.2 2014/02/19 20:21:22 dsl Exp $");
+__RCSID("$NetBSD: kvm_i386pae.c,v 1.3 2020/04/25 05:17:16 maxv Exp $");
 
 /*
  * This will expose PAE functions, macros, definitions and constants.
@@ -83,7 +83,7 @@
         * to increment pdppaddr to compute the address of the PDE.
         * pdppaddr being PAGE_SIZE aligned, we mask the option bits.
         */
-       pde_pa = (cpu_kh->pdppaddr & PG_FRAME) + (pl2_pi(va) * sizeof(pde));
+       pde_pa = (cpu_kh->pdppaddr & PTE_FRAME) + (pl2_pi(va) * sizeof(pde));
        if (_kvm_pread(kd, kd->pmfd, (void *)&pde, sizeof(pde),
            _kvm_pa2off(kd, pde_pa)) != sizeof(pde)) {
                _kvm_syserr(kd, 0, "could not read PDE");
@@ -93,20 +93,20 @@
        /*
         * Find and read the page table entry.
         */
-       if ((pde & PG_V) == 0) {
+       if ((pde & PTE_P) == 0) {
                _kvm_err(kd, 0, "invalid translation (invalid PDE)");
                goto lose;
        }
-       if ((pde & PG_PS) != 0) {
+       if ((pde & PTE_PS) != 0) {
                /*
                 * This is a 2MB page.
                 */
-               page_off = va & ((vaddr_t)~PG_LGFRAME);
-               *pa = (pde & PG_LGFRAME) + page_off;
+               page_off = va & ((vaddr_t)~PTE_LGFRAME);
+               *pa = (pde & PTE_LGFRAME) + page_off;
                return (int)(NBPD_L2 - page_off);
        }
 
-       pte_pa = (pde & PG_FRAME) + (pl1_pi(va) * sizeof(pt_entry_t));
+       pte_pa = (pde & PTE_FRAME) + (pl1_pi(va) * sizeof(pt_entry_t));
        if (_kvm_pread(kd, kd->pmfd, (void *) &pte, sizeof(pte),
            _kvm_pa2off(kd, pte_pa)) != sizeof(pte)) {
                _kvm_syserr(kd, 0, "could not read PTE");
@@ -116,11 +116,11 @@
        /*
         * Validate the PTE and return the physical address.
         */
-       if ((pte & PG_V) == 0) {
+       if ((pte & PTE_P) == 0) {
                _kvm_err(kd, 0, "invalid translation (invalid PTE)");
                goto lose;
        }
-       *pa = (pte & PG_FRAME) + page_off;
+       *pa = (pte & PTE_FRAME) + page_off;
        return (int)(NBPG - page_off);
 
 lose:
diff -r ee54c6b17722 -r 1a981e96f358 lib/libkvm/kvm_x86_64.c
--- a/lib/libkvm/kvm_x86_64.c   Sat Apr 25 00:07:27 2020 +0000
+++ b/lib/libkvm/kvm_x86_64.c   Sat Apr 25 05:17:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kvm_x86_64.c,v 1.11 2020/03/08 00:14:18 chs Exp $      */
+/*     $NetBSD: kvm_x86_64.c,v 1.12 2020/04/25 05:17:16 maxv Exp $     */
 
 /*-
  * Copyright (c) 1989, 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)kvm_hp300.c        8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: kvm_x86_64.c,v 1.11 2020/03/08 00:14:18 chs Exp $");
+__RCSID("$NetBSD: kvm_x86_64.c,v 1.12 2020/04/25 05:17:16 maxv Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -118,7 +118,7 @@
                _kvm_syserr(kd, 0, "could not read PT level 4 entry");
                goto lose;
        }
-       if ((pde & PG_V) == 0) {
+       if ((pde & PTE_P) == 0) {
                _kvm_err(kd, 0, "invalid translation (invalid level 4 PDE)");
                goto lose;
        }
@@ -126,45 +126,45 @@
        /*
         * Level 3.
         */
-       pde_pa = (pde & PG_FRAME) + (pl3_pi(va) * sizeof(pd_entry_t));
+       pde_pa = (pde & PTE_FRAME) + (pl3_pi(va) * sizeof(pd_entry_t));
        if (_kvm_pread(kd, kd->pmfd, (void *)&pde, sizeof(pde),
            _kvm_pa2off(kd, pde_pa)) != sizeof(pde)) {
                _kvm_syserr(kd, 0, "could not read PT level 3 entry");
                goto lose;
        }
-       if ((pde & PG_V) == 0) {
+       if ((pde & PTE_P) == 0) {
                _kvm_err(kd, 0, "invalid translation (invalid level 3 PDE)");
                goto lose;
        }
-       if (pde & PG_PS) {
+       if (pde & PTE_PS) {
                page_off = va & (NBPD_L3 - 1);
-               *pa = (pde & PG_1GFRAME) + page_off;
+               *pa = (pde & PTE_1GFRAME) + page_off;
                return (int)(NBPD_L3 - page_off);
        }
 
        /*
         * Level 2.
         */
-       pde_pa = (pde & PG_FRAME) + (pl2_pi(va) * sizeof(pd_entry_t));
+       pde_pa = (pde & PTE_FRAME) + (pl2_pi(va) * sizeof(pd_entry_t));
        if (_kvm_pread(kd, kd->pmfd, (void *)&pde, sizeof(pde),
            _kvm_pa2off(kd, pde_pa)) != sizeof(pde)) {
                _kvm_syserr(kd, 0, "could not read PT level 2 entry");
                goto lose;
        }
-       if ((pde & PG_V) == 0) {
+       if ((pde & PTE_P) == 0) {
                _kvm_err(kd, 0, "invalid translation (invalid level 2 PDE)");
                goto lose;
        }
-       if (pde & PG_PS) {
+       if (pde & PTE_PS) {
                page_off = va & (NBPD_L2 - 1);
-               *pa = (pde & PG_2MFRAME) + page_off;
+               *pa = (pde & PTE_2MFRAME) + page_off;
                return (int)(NBPD_L2 - page_off);
        }
 
        /*
         * Level 1.
         */
-       pte_pa = (pde & PG_FRAME) + (pl1_pi(va) * sizeof(pt_entry_t));
+       pte_pa = (pde & PTE_FRAME) + (pl1_pi(va) * sizeof(pt_entry_t));
        if (_kvm_pread(kd, kd->pmfd, (void *) &pte, sizeof(pte),
            _kvm_pa2off(kd, pte_pa)) != sizeof(pte)) {
                _kvm_syserr(kd, 0, "could not read PTE");
@@ -173,12 +173,12 @@
        /*
         * Validate the PTE and return the physical address.
         */
-       if ((pte & PG_V) == 0) {
+       if ((pte & PTE_P) == 0) {
                _kvm_err(kd, 0, "invalid translation (invalid PTE)");
                goto lose;
        }
        page_off = va & PGOFSET;
-       *pa = (pte & PG_FRAME) + page_off;
+       *pa = (pte & PTE_FRAME) + page_off;
        return (int)(NBPG - page_off);
 
  lose:
diff -r ee54c6b17722 -r 1a981e96f358 sys/arch/amd64/include/pte.h
--- a/sys/arch/amd64/include/pte.h      Sat Apr 25 00:07:27 2020 +0000
+++ b/sys/arch/amd64/include/pte.h      Sat Apr 25 05:17:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pte.h,v 1.12 2019/03/09 08:42:25 maxv Exp $    */
+/*     $NetBSD: pte.h,v 1.13 2020/04/25 05:17:16 maxv Exp $    */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -120,28 +120,6 @@
 #define PTE_FRAME      PTE_4KFRAME
 #define PTE_LGFRAME    PTE_2MFRAME
 
-/* XXX To be deleted. */
-#define PG_V           PTE_P
-#define PG_RW          PTE_W
-#define PG_u           PTE_U
-#define PG_WT          PTE_PWT
-#define PG_N           PTE_PCD
-#define PG_U           PTE_A
-#define PG_M           PTE_D
-#define PG_PAT         PTE_PAT
-#define PG_PS          PTE_PS
-#define PG_G           PTE_G
-#define PG_AVAIL1      PTE_AVL1
-#define PG_AVAIL2      PTE_AVL2
-#define PG_AVAIL3      PTE_AVL3
-#define PG_LGPAT       PTE_LGPAT
-#define PG_FRAME       PTE_FRAME
-#define PG_NX          PTE_NX
-#define PG_2MFRAME     PTE_2MFRAME
-#define PG_1GFRAME     PTE_1GFRAME
-#define PG_LGFRAME     PTE_LGFRAME
-#define PG_KW          PTE_W
-
 #include <x86/pte.h>
 
 #else   /*      !__x86_64__      */
diff -r ee54c6b17722 -r 1a981e96f358 sys/arch/i386/i386/genassym.cf
--- a/sys/arch/i386/i386/genassym.cf    Sat Apr 25 00:07:27 2020 +0000
+++ b/sys/arch/i386/i386/genassym.cf    Sat Apr 25 05:17:16 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.119 2020/02/17 09:09:48 skrll Exp $
+#      $NetBSD: genassym.cf,v 1.120 2020/04/25 05:17:16 maxv Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -138,9 +138,6 @@
 define KERNBASE                KERNBASE
 define KERNTEXTOFF             KERNTEXTOFF
 
-define PG_RW                   PG_RW
-define PG_V                    PG_V
-define PG_KW                   PG_KW
 define PTE_P                   PTE_P
 define PTE_W                   PTE_W
 define PGEX_U                  PGEX_U
diff -r ee54c6b17722 -r 1a981e96f358 sys/arch/i386/include/kcore.h
--- a/sys/arch/i386/include/kcore.h     Sat Apr 25 00:07:27 2020 +0000
+++ b/sys/arch/i386/include/kcore.h     Sat Apr 25 05:17:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kcore.h,v 1.5 2010/10/05 23:48:16 jym Exp $    */
+/*     $NetBSD: kcore.h,v 1.6 2020/04/25 05:17:16 maxv Exp $   */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -50,7 +50,7 @@
  * To avoid any kind of conflict with existing MMU bits, we chose one
  * ignored by hardware
  */



Home | Main Index | Thread Index | Old Index