Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sun2 Refactoring MD segment related definitions on ...
details: https://anonhg.NetBSD.org/src/rev/5ba79673d722
branches: trunk
changeset: 749859:5ba79673d722
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Fri Dec 11 13:56:15 2009 +0000
description:
Refactoring MD segment related definitions on m68k ports:
- move macro SEGSHIFT, NBSG, and SEGOFFSET from <machine/param.h>
to <machine/pmap.h> where they should belong
- don't use m68k_round_seg() and m68k_trunc_seg() in sun2 pmap sources
and instead define and use sun2_round_seg() and sun2_trunc_seg()
since they are quite pmap implementation dependent
diffstat:
sys/arch/sun2/include/param.h | 6 +-----
sys/arch/sun2/include/pmap.h | 11 ++++++++++-
sys/arch/sun2/sun2/pmap.c | 34 +++++++++++++++++-----------------
3 files changed, 28 insertions(+), 23 deletions(-)
diffs (196 lines):
diff -r 810a6dda6128 -r 5ba79673d722 sys/arch/sun2/include/param.h
--- a/sys/arch/sun2/include/param.h Fri Dec 11 13:52:57 2009 +0000
+++ b/sys/arch/sun2/include/param.h Fri Dec 11 13:56:15 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.10 2008/07/02 17:28:57 ad Exp $ */
+/* $NetBSD: param.h,v 1.11 2009/12/11 13:56:15 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -102,10 +102,6 @@
#define KERNBASE 0x00006000 /* start of kernel virtual */
#define KERN_END 0x00E00000 /* end of kernel virtual */
-#define SEGSHIFT 15 /* LOG2(NBSG) */
-#define NBSG (1 << SEGSHIFT) /* bytes/segment */
-#define SEGOFSET (NBSG-1) /* byte offset into segment */
-
#define MAXBSIZE 0x4000 /* max FS block size */
#define MAXPHYS 0xe000
diff -r 810a6dda6128 -r 5ba79673d722 sys/arch/sun2/include/pmap.h
--- a/sys/arch/sun2/include/pmap.h Fri Dec 11 13:52:57 2009 +0000
+++ b/sys/arch/sun2/include/pmap.h Fri Dec 11 13:56:15 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.21 2008/12/09 20:45:45 pooka Exp $ */
+/* $NetBSD: pmap.h,v 1.22 2009/12/11 13:56:15 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -104,4 +104,13 @@
void pmap_procwr(struct proc *, vaddr_t, size_t);
+/* MMU specific segment value */
+#define SEGSHIFT 15 /* LOG2(NBSG) */
+#define NBSG (1 << SEGSHIFT) /* bytes/segment */
+#define SEGOFSET (NBSG - 1) /* byte offset into segment */
+
+#define sun2_round_seg(x) ((((vaddr_t)(x)) + SEGOFSET) & ~SEGOFSET)
+#define sun2_trunc_seg(x) ((vaddr_t)(x) & ~SEGOFSET)
+#define sun2_seg_offset(x) ((vaddr_t)(x) & SEGOFSET)
+
#endif /* _MACHINE_PMAP_H */
diff -r 810a6dda6128 -r 5ba79673d722 sys/arch/sun2/sun2/pmap.c
--- a/sys/arch/sun2/sun2/pmap.c Fri Dec 11 13:52:57 2009 +0000
+++ b/sys/arch/sun2/sun2/pmap.c Fri Dec 11 13:56:15 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.42 2009/11/21 04:16:52 rmind Exp $ */
+/* $NetBSD: pmap.c,v 1.43 2009/12/11 13:56:16 tsutsui Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -82,7 +82,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.42 2009/11/21 04:16:52 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.43 2009/12/11 13:56:16 tsutsui Exp $");
#include "opt_ddb.h"
#include "opt_pmap_debug.h"
@@ -1510,7 +1510,7 @@
* Determine the range of kernel virtual space available.
* It is segment-aligned to simplify PMEG management.
*/
- virtual_avail = m68k_round_seg(nextva);
+ virtual_avail = sun2_round_seg(nextva);
virtual_end = VM_MAX_KERNEL_ADDRESS;
/*
@@ -2029,7 +2029,7 @@
new_pte |= PG_NC;
}
- segva = m68k_trunc_seg(pgva);
+ segva = sun2_trunc_seg(pgva);
do_pv = true;
/* Do we have a PMEG? */
@@ -2173,7 +2173,7 @@
return;
}
- segva = m68k_trunc_seg(pgva);
+ segva = sun2_trunc_seg(pgva);
do_pv = true;
/*
@@ -2365,7 +2365,7 @@
new_pte |= PG_NC;
}
- segva = m68k_trunc_seg(va);
+ segva = sun2_trunc_seg(va);
s = splvm();
@@ -2437,7 +2437,7 @@
set_context(KERNEL_CONTEXT);
segnum = VA_SEGNUM(va);
for (eva = va + len; va < eva; va = neva, segnum++) {
- neva = m68k_trunc_seg(va) + NBSG;
+ neva = sun2_trunc_seg(va) + NBSG;
if (neva > eva) {
neva = eva;
}
@@ -2445,7 +2445,7 @@
continue;
}
- segva = m68k_trunc_seg(va);
+ segva = sun2_trunc_seg(va);
sme = get_segmap(segva);
pmegp = pmeg_p(sme);
@@ -2594,7 +2594,7 @@
if (pmap->pm_segmap[VA_SEGNUM(pgva)] == SEGINV)
return (0);
- segva = m68k_trunc_seg(pgva);
+ segva = sun2_trunc_seg(pgva);
chkpte = PG_VALID;
if (ftype & VM_PROT_WRITE)
chkpte |= PG_WRITE;
@@ -3006,7 +3006,7 @@
va = sva;
segnum = VA_SEGNUM(va);
while (va < eva) {
- neva = m68k_trunc_seg(va) + NBSG;
+ neva = sun2_trunc_seg(va) + NBSG;
if (neva > eva)
neva = eva;
if (pmap->pm_segmap[segnum] != SEGINV)
@@ -3030,7 +3030,7 @@
s = splvm();
#ifdef DIAGNOSTIC
- if (m68k_trunc_seg(sva) != m68k_trunc_seg(eva-1))
+ if (sun2_trunc_seg(sva) != sun2_trunc_seg(eva-1))
panic("pmap_protect1: bad range!");
#endif
@@ -3093,7 +3093,7 @@
panic("pmap_protect_mmu: wrong context");
#endif
- segva = m68k_trunc_seg(sva);
+ segva = sun2_trunc_seg(sva);
sme = get_segmap(segva);
#ifdef DIAGNOSTIC
@@ -3174,7 +3174,7 @@
panic("pmap_protect_noctx: null segmap");
#endif
- segva = m68k_trunc_seg(sva);
+ segva = sun2_trunc_seg(sva);
segnum = VA_SEGNUM(segva);
sme = pmap->pm_segmap[segnum];
if (sme == SEGINV)
@@ -3245,7 +3245,7 @@
va = sva;
segnum = VA_SEGNUM(va);
while (va < eva) {
- neva = m68k_trunc_seg(va) + NBSG;
+ neva = sun2_trunc_seg(va) + NBSG;
if (neva > eva)
neva = eva;
if (pmap->pm_segmap[segnum] != SEGINV)
@@ -3267,7 +3267,7 @@
s = splvm();
#ifdef DIAGNOSTIC
- if (m68k_trunc_seg(sva) != m68k_trunc_seg(eva-1))
+ if (sun2_trunc_seg(sva) != sun2_trunc_seg(eva-1))
panic("pmap_remove1: bad range!");
#endif
@@ -3331,7 +3331,7 @@
panic("pmap_remove_mmu: wrong context");
#endif
- segva = m68k_trunc_seg(sva);
+ segva = sun2_trunc_seg(sva);
sme = get_segmap(segva);
#ifdef DIAGNOSTIC
@@ -3460,7 +3460,7 @@
panic("pmap_remove_noctx: null segmap");
#endif
- segva = m68k_trunc_seg(sva);
+ segva = sun2_trunc_seg(sva);
segnum = VA_SEGNUM(segva);
sme = pmap->pm_segmap[segnum];
if (sme == SEGINV)
Home |
Main Index |
Thread Index |
Old Index