Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Introduce PDIR_SLOT_USERLIM, which indicates the li...



details:   https://anonhg.NetBSD.org/src/rev/ae3b33ff7796
branches:  trunk
changeset: 365327:ae3b33ff7796
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Aug 12 12:23:33 2018 +0000

description:
Introduce PDIR_SLOT_USERLIM, which indicates the limit of the user slots.
Use it instead of PDIR_SLOT_PTE when we just want to iterate over the
user slots. Also use it in SVS, I had hardcoded 255 because there was no
proper define (which there now is).

diffstat:

 sys/arch/amd64/include/pmap.h |  3 ++-
 sys/arch/x86/x86/pmap.c       |  6 +++---
 sys/arch/x86/x86/svs.c        |  8 ++++----
 sys/arch/xen/x86/cpu.c        |  6 +++---
 4 files changed, 12 insertions(+), 11 deletions(-)

diffs (107 lines):

diff -r 7c74008fec6e -r ae3b33ff7796 sys/arch/amd64/include/pmap.h
--- a/sys/arch/amd64/include/pmap.h     Sun Aug 12 12:06:53 2018 +0000
+++ b/sys/arch/amd64/include/pmap.h     Sun Aug 12 12:23:33 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.50 2018/08/12 10:50:35 maxv Exp $   */
+/*     $NetBSD: pmap.h,v 1.51 2018/08/12 12:23:33 maxv Exp $   */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -141,6 +141,7 @@
 #define L4_SLOT_KERN           slotspace.area[SLAREA_MAIN].sslot
 #define L4_SLOT_KERNBASE       511 /* pl4_i(KERNBASE) */
 
+#define PDIR_SLOT_USERLIM      255
 #define PDIR_SLOT_KERN L4_SLOT_KERN
 #define PDIR_SLOT_PTE  L4_SLOT_PTE
 
diff -r 7c74008fec6e -r ae3b33ff7796 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Sun Aug 12 12:06:53 2018 +0000
+++ b/sys/arch/x86/x86/pmap.c   Sun Aug 12 12:23:33 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.299 2018/08/12 11:51:42 maxv Exp $  */
+/*     $NetBSD: pmap.c,v 1.300 2018/08/12 12:23:33 maxv Exp $  */
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -157,7 +157,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.299 2018/08/12 11:51:42 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.300 2018/08/12 12:23:33 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -2571,7 +2571,7 @@
                if (ci->ci_pmap == pmap)
                        panic("destroying pmap being used");
 #if defined(XEN) && defined(__x86_64__)
-               for (int i = 0; i < PDIR_SLOT_PTE; i++) {
+               for (int i = 0; i < PDIR_SLOT_USERLIM; i++) {
                        if (pmap->pm_pdir[i] != 0 &&
                            ci->ci_kpm_pdir[i] == pmap->pm_pdir[i]) {
                                printf("pmap_destroy(%p) pmap_kernel %p "
diff -r 7c74008fec6e -r ae3b33ff7796 sys/arch/x86/x86/svs.c
--- a/sys/arch/x86/x86/svs.c    Sun Aug 12 12:06:53 2018 +0000
+++ b/sys/arch/x86/x86/svs.c    Sun Aug 12 12:23:33 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: svs.c,v 1.19 2018/07/12 19:48:16 maxv Exp $    */
+/*     $NetBSD: svs.c,v 1.20 2018/08/12 12:23:33 maxv Exp $    */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.19 2018/07/12 19:48:16 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.20 2018/08/12 12:23:33 maxv Exp $");
 
 #include "opt_svs.h"
 
@@ -460,7 +460,7 @@
        KASSERT(pmap != pmap_kernel());
        KASSERT(mutex_owned(pmap->pm_lock));
        KASSERT(kpreempt_disabled());
-       KASSERT(index < 255);
+       KASSERT(index < PDIR_SLOT_USERLIM);
 
        for (CPU_INFO_FOREACH(cii, ci)) {
                cid = cpu_index(ci);
@@ -558,7 +558,7 @@
        mutex_enter(&ci->ci_svs_mtx);
 
        /* User slots. */
-       for (i = 0; i < 255; i++) {
+       for (i = 0; i < PDIR_SLOT_USERLIM; i++) {
                pte = svs_pte_atomic_read(pmap, i);
                ci->ci_svs_updir[i] = pte;
        }
diff -r 7c74008fec6e -r ae3b33ff7796 sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c    Sun Aug 12 12:06:53 2018 +0000
+++ b/sys/arch/xen/x86/cpu.c    Sun Aug 12 12:23:33 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.125 2018/07/27 09:37:31 maxv Exp $   */
+/*     $NetBSD: cpu.c,v 1.126 2018/08/12 12:23:33 maxv Exp $   */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.125 2018/07/27 09:37:31 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.126 2018/08/12 12:23:33 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1136,7 +1136,7 @@
        KASSERT(pmap == ci->ci_pmap);
 
        /* Copy user pmap L4 PDEs (in user addr. range) to per-cpu L4 */
-       for (i = 0; i < PDIR_SLOT_PTE; i++) {
+       for (i = 0; i < PDIR_SLOT_USERLIM; i++) {
                KASSERT(pmap != pmap_kernel() || new_pgd[i] == 0);
                if (ci->ci_kpm_pdir[i] != new_pgd[i]) {
                        xpq_queue_pte_update(l4_pd_ma + i * sizeof(pd_entry_t),



Home | Main Index | Thread Index | Old Index