Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sun3 Refactoring MD segment related definitions on ...
details: https://anonhg.NetBSD.org/src/rev/810a6dda6128
branches: trunk
changeset: 749858:810a6dda6128
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Fri Dec 11 13:52:57 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 sun3 pmap sources
and instead define and use sun3_round_seg() and sun3_trunc_seg()
since they are quite pmap implementation dependent
diffstat:
sys/arch/sun3/include/param3.h | 6 +-----
sys/arch/sun3/include/param3x.h | 6 +-----
sys/arch/sun3/include/pmap3.h | 11 ++++++++++-
sys/arch/sun3/include/pmap3x.h | 11 ++++++++++-
sys/arch/sun3/sun3/dvma.c | 8 ++++----
sys/arch/sun3/sun3/pmap.c | 34 +++++++++++++++++-----------------
6 files changed, 43 insertions(+), 33 deletions(-)
diffs (273 lines):
diff -r 5f7e12a0ca63 -r 810a6dda6128 sys/arch/sun3/include/param3.h
--- a/sys/arch/sun3/include/param3.h Fri Dec 11 13:30:11 2009 +0000
+++ b/sys/arch/sun3/include/param3.h Fri Dec 11 13:52:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param3.h,v 1.51 2005/12/11 12:19:21 christos Exp $ */
+/* $NetBSD: param3.h,v 1.52 2009/12/11 13:52:57 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -82,9 +82,5 @@
#define KERNTEXTOFF 0x0E004000 /* start of kernel text */
#define KERN_END 0x0FE00000 /* end of kernel virtual */
-#define SEGSHIFT 17 /* LOG2(NBSG) */
-#define NBSG (1 << SEGSHIFT) /* bytes/segment */
-#define SEGOFSET (NBSG-1) /* byte offset into segment */
-
#define MAXBSIZE 0x8000 /* max FS block size */
#define MAXPHYS 0xe000
diff -r 5f7e12a0ca63 -r 810a6dda6128 sys/arch/sun3/include/param3x.h
--- a/sys/arch/sun3/include/param3x.h Fri Dec 11 13:30:11 2009 +0000
+++ b/sys/arch/sun3/include/param3x.h Fri Dec 11 13:52:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param3x.h,v 1.14 2005/12/11 12:19:21 christos Exp $ */
+/* $NetBSD: param3x.h,v 1.15 2009/12/11 13:52:57 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -82,9 +82,5 @@
#define KERNTEXTOFF 0xF8004000 /* start of kernel text */
#define KERN_END 0xFE000000 /* end of kernel virtual */
-#define SEGSHIFT 19 /* LOG2(NBSG) */
-#define NBSG (1 << SEGSHIFT) /* bytes/segment */
-#define SEGOFSET (NBSG-1) /* byte offset into segment */
-
#define MAXBSIZE 0x8000 /* max FS block size */
diff -r 5f7e12a0ca63 -r 810a6dda6128 sys/arch/sun3/include/pmap3.h
--- a/sys/arch/sun3/include/pmap3.h Fri Dec 11 13:30:11 2009 +0000
+++ b/sys/arch/sun3/include/pmap3.h Fri Dec 11 13:52:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap3.h,v 1.45 2008/12/09 20:45:45 pooka Exp $ */
+/* $NetBSD: pmap3.h,v 1.46 2009/12/11 13:52:57 tsutsui Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -95,4 +95,13 @@
#define PMAP_NC 0x10 /* tells pmap_enter to set PG_NC */
#define PMAP_SPEC 0x1C /* mask to get all above. */
+/* MMU specific segment size */
+#define SEGSHIFT 17 /* LOG2(NBSG) */
+#define NBSG (1 << SEGSHIFT) /* bytes/segment */
+#define SEGOFSET (NBSG - 1) /* byte offset into segment */
+
+#define sun3_round_seg(x) ((((vaddr_t)(x)) + SEGOFSET) & ~SEGOFSET)
+#define sun3_trunc_seg(x) ((vaddr_t)(x) & ~SEGOFSET)
+#define sun3_seg_offset(x) ((vaddr_t)(x) & SEGOFSET)
+
#endif /* _KERNEL */
diff -r 5f7e12a0ca63 -r 810a6dda6128 sys/arch/sun3/include/pmap3x.h
--- a/sys/arch/sun3/include/pmap3x.h Fri Dec 11 13:30:11 2009 +0000
+++ b/sys/arch/sun3/include/pmap3x.h Fri Dec 11 13:52:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap3x.h,v 1.26 2008/12/09 20:45:45 pooka Exp $ */
+/* $NetBSD: pmap3x.h,v 1.27 2009/12/11 13:52:57 tsutsui Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -80,4 +80,13 @@
#define PMAP_NC 0x40 /* tells pmap_enter to set PTE_CI */
#define PMAP_SPEC 0xFF /* mask to get all above. */
+/* MMU specific segment size */
+#define SEGSHIFT 19 /* LOG2(NBSG) */
+#define NBSG (1 << SEGSHIFT) /* bytes/segment */
+#define SEGOFSET (NBSG - 1) /* byte offset into segment */
+
+#define sun3x_round_seg(x) ((((vaddr_t)(x)) + SEGOFSET) & ~SEGOFSET)
+#define sun3x_trunc_seg(x) ((vaddr_t)(x) & ~SEGOFSET)
+#define sun3x_seg_offset(x) ((vaddr_t)(x) & SEGOFSET)
+
#endif /* _KERNEL */
diff -r 5f7e12a0ca63 -r 810a6dda6128 sys/arch/sun3/sun3/dvma.c
--- a/sys/arch/sun3/sun3/dvma.c Fri Dec 11 13:30:11 2009 +0000
+++ b/sys/arch/sun3/sun3/dvma.c Fri Dec 11 13:52:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dvma.c,v 1.35 2009/11/21 04:16:52 rmind Exp $ */
+/* $NetBSD: dvma.c,v 1.36 2009/12/11 13:52:57 tsutsui Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dvma.c,v 1.35 2009/11/21 04:16:52 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dvma.c,v 1.36 2009/12/11 13:52:57 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -183,7 +183,7 @@
seg_len = (vsize_t)len;
seg_off = seg_kva & SEGOFSET;
seg_kva -= seg_off;
- seg_len = m68k_round_seg(seg_len + seg_off);
+ seg_len = sun3_round_seg(seg_len + seg_off);
s = splvm();
@@ -245,7 +245,7 @@
seg_len = (vsize_t)len;
seg_off = seg_dma & SEGOFSET;
seg_dma -= seg_off;
- seg_len = m68k_round_seg(seg_len + seg_off);
+ seg_len = sun3_round_seg(seg_len + seg_off);
s = splvm();
diff -r 5f7e12a0ca63 -r 810a6dda6128 sys/arch/sun3/sun3/pmap.c
--- a/sys/arch/sun3/sun3/pmap.c Fri Dec 11 13:30:11 2009 +0000
+++ b/sys/arch/sun3/sun3/pmap.c Fri Dec 11 13:52:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.163 2009/11/21 04:16:53 rmind Exp $ */
+/* $NetBSD: pmap.c,v 1.164 2009/12/11 13:52:57 tsutsui Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.163 2009/11/21 04:16:53 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.164 2009/12/11 13:52:57 tsutsui Exp $");
#include "opt_ddb.h"
#include "opt_pmap_debug.h"
@@ -1516,7 +1516,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 = sun3_round_seg(nextva);
virtual_end = VM_MAX_KERNEL_ADDRESS;
/*
@@ -2056,7 +2056,7 @@
new_pte |= PG_NC;
}
- segva = m68k_trunc_seg(pgva);
+ segva = sun3_trunc_seg(pgva);
do_pv = true;
/* Do we have a PMEG? */
@@ -2199,7 +2199,7 @@
return;
}
- segva = m68k_trunc_seg(pgva);
+ segva = sun3_trunc_seg(pgva);
do_pv = true;
/*
@@ -2388,7 +2388,7 @@
new_pte |= PG_NC;
}
- segva = m68k_trunc_seg(va);
+ segva = sun3_trunc_seg(va);
s = splvm();
@@ -2456,7 +2456,7 @@
s = splvm();
segnum = VA_SEGNUM(va);
for (eva = va + len; va < eva; va = neva, segnum++) {
- neva = m68k_trunc_seg(va) + NBSG;
+ neva = sun3_trunc_seg(va) + NBSG;
if (neva > eva) {
neva = eva;
}
@@ -2464,7 +2464,7 @@
continue;
}
- segva = m68k_trunc_seg(va);
+ segva = sun3_trunc_seg(va);
sme = get_segmap(segva);
pmegp = pmeg_p(sme);
@@ -2612,7 +2612,7 @@
if (pmap->pm_segmap[VA_SEGNUM(pgva)] == SEGINV)
return (0);
- segva = m68k_trunc_seg(pgva);
+ segva = sun3_trunc_seg(pgva);
chkpte = PG_VALID;
if (ftype & VM_PROT_WRITE)
chkpte |= PG_WRITE;
@@ -2983,7 +2983,7 @@
va = sva;
segnum = VA_SEGNUM(va);
while (va < eva) {
- neva = m68k_trunc_seg(va) + NBSG;
+ neva = sun3_trunc_seg(va) + NBSG;
if (neva > eva)
neva = eva;
if (pmap->pm_segmap[segnum] != SEGINV)
@@ -3007,7 +3007,7 @@
s = splvm();
#ifdef DIAGNOSTIC
- if (m68k_trunc_seg(sva) != m68k_trunc_seg(eva-1))
+ if (sun3_trunc_seg(sva) != sun3_trunc_seg(eva-1))
panic("pmap_protect1: bad range!");
#endif
@@ -3069,7 +3069,7 @@
}
#endif
- segva = m68k_trunc_seg(sva);
+ segva = sun3_trunc_seg(sva);
sme = get_segmap(segva);
#ifdef DIAGNOSTIC
@@ -3150,7 +3150,7 @@
panic("pmap_protect_noctx: null segmap");
#endif
- segva = m68k_trunc_seg(sva);
+ segva = sun3_trunc_seg(sva);
segnum = VA_SEGNUM(segva);
sme = pmap->pm_segmap[segnum];
if (sme == SEGINV)
@@ -3211,7 +3211,7 @@
va = sva;
segnum = VA_SEGNUM(va);
while (va < eva) {
- neva = m68k_trunc_seg(va) + NBSG;
+ neva = sun3_trunc_seg(va) + NBSG;
if (neva > eva)
neva = eva;
if (pmap->pm_segmap[segnum] != SEGINV)
@@ -3233,7 +3233,7 @@
s = splvm();
#ifdef DIAGNOSTIC
- if (m68k_trunc_seg(sva) != m68k_trunc_seg(eva-1))
+ if (sun3_trunc_seg(sva) != sun3_trunc_seg(eva-1))
panic("pmap_remove1: bad range!");
#endif
@@ -3296,7 +3296,7 @@
}
#endif
- segva = m68k_trunc_seg(sva);
+ segva = sun3_trunc_seg(sva);
sme = get_segmap(segva);
#ifdef DIAGNOSTIC
@@ -3425,7 +3425,7 @@
panic("pmap_remove_noctx: null segmap");
#endif
- segva = m68k_trunc_seg(sva);
+ segva = sun3_trunc_seg(sva);
segnum = VA_SEGNUM(segva);
sme = pmap->pm_segmap[segnum];
if (sme == SEGINV)
Home |
Main Index |
Thread Index |
Old Index