Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips Define (but not use) separate kernel and user ...



details:   https://anonhg.NetBSD.org/src/rev/f7bf6dd15f53
branches:  trunk
changeset: 808993:f7bf6dd15f53
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Jun 11 15:50:17 2015 +0000

description:
Define (but not use) separate kernel and user pagetables.
Move to the new names.

diffstat:

 sys/arch/mips/include/cpu.h      |  10 +++++++---
 sys/arch/mips/include/pmap.h     |  11 ++++++-----
 sys/arch/mips/mips/cpu_subr.c    |   8 ++++----
 sys/arch/mips/mips/genassym.cf   |   8 +++++---
 sys/arch/mips/mips/pmap.c        |  12 +++++-------
 sys/arch/mips/mips/pmap_segtab.c |  19 ++++++++++---------
 sys/arch/mips/mips/trap.c        |  11 ++++++-----
 7 files changed, 43 insertions(+), 36 deletions(-)

diffs (232 lines):

diff -r 16b2627bd640 -r f7bf6dd15f53 sys/arch/mips/include/cpu.h
--- a/sys/arch/mips/include/cpu.h       Thu Jun 11 15:48:57 2015 +0000
+++ b/sys/arch/mips/include/cpu.h       Thu Jun 11 15:50:17 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.116 2015/06/10 22:31:00 matt Exp $   */
+/*     $NetBSD: cpu.h,v 1.117 2015/06/11 15:50:17 matt Exp $   */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -115,9 +115,13 @@
        int ci_tlb_slot;                /* reserved tlb entry for cpu_info */
        u_int ci_pmap_asid_cur;         /* current ASID */
        struct pmap_tlb_info *ci_tlb_info; /* tlb information for this cpu */
-       union segtab *ci_pmap_seg0tab;
+       union pmap_segtab *ci_pmap_segtabs[2];
+#define ci_pmap_user_segtab    ci_pmap_segtabs[0]
+#define ci_pmap_kern_segtab    ci_pmap_segtabs[1]
 #ifdef _LP64
-       union segtab *ci_pmap_segtab;
+       union pmap_segtab *ci_pmap_seg0tabs[2];
+#define ci_pmap_user_seg0tab   ci_pmap_seg0tabs[0]
+#define ci_pmap_kern_seg0tab   ci_pmap_seg0tabs[1]
 #else
        vaddr_t ci_pmap_srcbase;        /* starting VA of ephemeral src space */
        vaddr_t ci_pmap_dstbase;        /* starting VA of ephemeral dst space */
diff -r 16b2627bd640 -r f7bf6dd15f53 sys/arch/mips/include/pmap.h
--- a/sys/arch/mips/include/pmap.h      Thu Jun 11 15:48:57 2015 +0000
+++ b/sys/arch/mips/include/pmap.h      Thu Jun 11 15:50:17 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.66 2015/06/11 08:22:09 matt Exp $   */
+/*     $NetBSD: pmap.h,v 1.67 2015/06/11 15:50:17 matt Exp $   */
 
 /*
  * Copyright (c) 1992, 1993
@@ -108,6 +108,7 @@
 #define pmap_trunc_seg(x)      ((vaddr_t)(x) & ~SEGOFSET)
 #define pmap_round_seg(x)      (((vaddr_t)(x) + SEGOFSET) & ~SEGOFSET)
 
+#define PMAP_INVALID_SEGTAB    NULL
 #ifdef _LP64
 #define PMAP_SEGTABSIZE                NSEGPG
 #else
@@ -116,16 +117,16 @@
 
 union pt_entry;
 
-union segtab {
+union pmap_segtab {
 #ifdef _LP64
-       union segtab    *seg_seg[PMAP_SEGTABSIZE];
+       union pmap_segtab       *seg_seg[PMAP_SEGTABSIZE];
 #else
-       union segtab    *seg_seg[1];
+       union pmap_segtab       *seg_seg[1];
 #endif
        union pt_entry  *seg_tab[PMAP_SEGTABSIZE];
 };
 
-typedef union segtab pmap_segtab_t;
+typedef union pmap_segtab pmap_segtab_t;
 
 /*
  * Structure defining an tlb entry data set.
diff -r 16b2627bd640 -r f7bf6dd15f53 sys/arch/mips/mips/cpu_subr.c
--- a/sys/arch/mips/mips/cpu_subr.c     Thu Jun 11 15:48:57 2015 +0000
+++ b/sys/arch/mips/mips/cpu_subr.c     Thu Jun 11 15:50:17 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu_subr.c,v 1.25 2015/06/11 08:22:09 matt Exp $       */
+/*     $NetBSD: cpu_subr.c,v 1.26 2015/06/11 15:50:17 matt Exp $       */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.25 2015/06/11 08:22:09 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.26 2015/06/11 15:50:17 matt Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -80,9 +80,9 @@
     = {
        .ci_curlwp = &lwp0,
        .ci_tlb_info = &pmap_tlb0_info,
-       .ci_pmap_seg0tab = (void *)(MIPS_KSEG2_START + 0x1eadbeef),
+       .ci_pmap_user_segtab = (void *)(MIPS_KSEG2_START + 0x1eadbeef),
 #ifdef _LP64
-       .ci_pmap_segtab = (void *)(MIPS_KSEG2_START + 0x1eadbeef),
+       .ci_pmap_user_seg0tab = (void *)(MIPS_KSEG2_START + 0x1eadbeef),
 #endif
        .ci_cpl = IPL_HIGH,
        .ci_tlb_slot = -1,
diff -r 16b2627bd640 -r f7bf6dd15f53 sys/arch/mips/mips/genassym.cf
--- a/sys/arch/mips/mips/genassym.cf    Thu Jun 11 15:48:57 2015 +0000
+++ b/sys/arch/mips/mips/genassym.cf    Thu Jun 11 15:50:17 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.60 2015/06/11 08:16:47 matt Exp $
+#      $NetBSD: genassym.cf,v 1.61 2015/06/11 15:50:17 matt Exp $
 #
 # Copyright (c) 1992, 1993
 #      The Regents of the University of California.  All rights reserved.
@@ -290,9 +290,11 @@
 define CPU_INFO_CURLWP         offsetof(struct cpu_info, ci_curlwp)
 define CPU_INFO_IDLELWP        offsetof(struct cpu_info, ci_data.cpu_idlelwp)
 define CPU_INFO_EV_TLBMISSES   offsetof(struct cpu_info, ci_ev_tlbmisses.ev_count)
-define CPU_INFO_PMAP_SEG0TAB   offsetof(struct cpu_info, ci_pmap_seg0tab)
 ifdef _LP64
-define CPU_INFO_PMAP_SEGTAB    offsetof(struct cpu_info, ci_pmap_segtab)
+define CPU_INFO_PMAP_SEGTAB    offsetof(struct cpu_info, ci_pmap_segtabs[0])
+define CPU_INFO_PMAP_SEG0TAB   offsetof(struct cpu_info, ci_pmap_seg0tabs[0])
+else
+define CPU_INFO_PMAP_SEG0TAB   offsetof(struct cpu_info, ci_pmap_segtabs[0])
 endif
 define CPU_INFO_DIVISOR_DELAY  offsetof(struct cpu_info, ci_divisor_delay)
 define CPU_INFO_MTX_COUNT      offsetof(struct cpu_info, ci_mtx_count)
diff -r 16b2627bd640 -r f7bf6dd15f53 sys/arch/mips/mips/pmap.c
--- a/sys/arch/mips/mips/pmap.c Thu Jun 11 15:48:57 2015 +0000
+++ b/sys/arch/mips/mips/pmap.c Thu Jun 11 15:50:17 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.217 2015/06/11 15:13:34 matt Exp $  */
+/*     $NetBSD: pmap.c,v 1.218 2015/06/11 15:50:17 matt Exp $  */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.217 2015/06/11 15:13:34 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.218 2015/06/11 15:50:17 matt Exp $");
 
 /*
  *     Manages physical address maps.
@@ -907,11 +907,9 @@
 
        kpreempt_disable();
        KASSERT(l == curlwp || l->l_cpu == curlwp->l_cpu);
+       curcpu()->ci_pmap_user_segtab = (void *)(MIPS_KSEG2_START + 0x1eadbeef);
 #ifdef _LP64
-       curcpu()->ci_pmap_segtab = (void *)(MIPS_KSEG2_START + 0x1eadbeef);
-       curcpu()->ci_pmap_seg0tab = NULL;
-#else
-       curcpu()->ci_pmap_seg0tab = (void *)(MIPS_KSEG2_START + 0x1eadbeef);
+       curcpu()->ci_pmap_user_seg0tab = NULL;
 #endif
        pmap_tlb_asid_deactivate(l->l_proc->p_vmspace->vm_map.pmap);
        kpreempt_enable();
@@ -1631,7 +1629,7 @@
 #ifdef DEBUG
                if (pmapdebug & PDB_ENTER)
                        printf("pmap_enter: flush I cache va %#"PRIxVADDR" (%#"PRIxPADDR")\n",
-                           va - (vaddr_t)NBPG, pa);
+                           va - NBPG, pa);
 #endif
                PMAP_COUNT(exec_mappings);
                if (!PG_MD_EXECPAGE_P(md) && PG_MD_CACHED_P(md)) {
diff -r 16b2627bd640 -r f7bf6dd15f53 sys/arch/mips/mips/pmap_segtab.c
--- a/sys/arch/mips/mips/pmap_segtab.c  Thu Jun 11 15:48:57 2015 +0000
+++ b/sys/arch/mips/mips/pmap_segtab.c  Thu Jun 11 15:50:17 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_segtab.c,v 1.9 2015/06/11 08:22:09 matt Exp $     */
+/*     $NetBSD: pmap_segtab.c,v 1.10 2015/06/11 15:50:17 matt Exp $    */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.9 2015/06/11 08:22:09 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.10 2015/06/11 15:50:17 matt Exp $");
 
 /*
  *     Manages physical address maps.
@@ -349,16 +349,17 @@
 {
        if (l == curlwp) {
                KASSERT(pm == l->l_proc->p_vmspace->vm_map.pmap);
+               if (pm == pmap_kernel()) {
+                       l->l_cpu->ci_pmap_user_segtab = PMAP_INVALID_SEGTAB;
 #ifdef _LP64
-               l->l_cpu->ci_pmap_segtab = pm->pm_segtab;
-               if (pm != pmap_kernel()) {
-                       l->l_cpu->ci_pmap_seg0tab = pm->pm_segtab->seg_seg[0];
+                       l->l_cpu->ci_pmap_user_seg0tab = PMAP_INVALID_SEGTAB;
+#endif
                } else {
-                       l->l_cpu->ci_pmap_seg0tab = NULL;
+                       l->l_cpu->ci_pmap_user_segtab = pm->pm_segtab;
+#ifdef _LP64
+                       l->l_cpu->ci_pmap_user_seg0tab = pm->pm_segtab->seg_seg[0];
+#endif
                }
-#else
-               l->l_cpu->ci_pmap_seg0tab = pm->pm_segtab;
-#endif
        }
 }
 
diff -r 16b2627bd640 -r f7bf6dd15f53 sys/arch/mips/mips/trap.c
--- a/sys/arch/mips/mips/trap.c Thu Jun 11 15:48:57 2015 +0000
+++ b/sys/arch/mips/mips/trap.c Thu Jun 11 15:50:17 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.237 2015/06/06 20:53:38 matt Exp $  */
+/*     $NetBSD: trap.c,v 1.238 2015/06/11 15:50:17 matt Exp $  */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.237 2015/06/06 20:53:38 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.238 2015/06/11 15:50:17 matt Exp $");
 
 #include "opt_cputype.h"       /* which mips CPU levels do we support? */
 #include "opt_ddb.h"
@@ -381,9 +381,10 @@
                 */
                struct cpu_info * const ci = curcpu();
                if ((va >> XSEGSHIFT) == 0 &&
-                   __predict_false(ci->ci_pmap_seg0tab == NULL
-                               && ci->ci_pmap_segtab->seg_seg[0] != NULL)) {
-                       ci->ci_pmap_seg0tab = ci->ci_pmap_segtab->seg_seg[0];
+                   __predict_false(ci->ci_pmap_user_seg0tab == NULL
+                               && ci->ci_pmap_user_segtab->seg_seg[0] != NULL)) {
+                       ci->ci_pmap_user_seg0tab =
+                           ci->ci_pmap_user_segtab->seg_seg[0];
                        kpreempt_enable();
                        if (type & T_USER) {
                                userret(l);



Home | Main Index | Thread Index | Old Index