Module Name: src Committed By: tsutsui Date: Fri Dec 11 13:56:16 UTC 2009
Modified Files: src/sys/arch/sun2/include: param.h pmap.h src/sys/arch/sun2/sun2: pmap.c Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sun2/include/param.h cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sun2/include/pmap.h cvs rdiff -u -r1.42 -r1.43 src/sys/arch/sun2/sun2/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/sun2/include/param.h diff -u src/sys/arch/sun2/include/param.h:1.10 src/sys/arch/sun2/include/param.h:1.11 --- src/sys/arch/sun2/include/param.h:1.10 Wed Jul 2 17:28:57 2008 +++ src/sys/arch/sun2/include/param.h Fri Dec 11 13:56:15 2009 @@ -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 Index: src/sys/arch/sun2/include/pmap.h diff -u src/sys/arch/sun2/include/pmap.h:1.21 src/sys/arch/sun2/include/pmap.h:1.22 --- src/sys/arch/sun2/include/pmap.h:1.21 Tue Dec 9 20:45:45 2008 +++ src/sys/arch/sun2/include/pmap.h Fri Dec 11 13:56:15 2009 @@ -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 */ Index: src/sys/arch/sun2/sun2/pmap.c diff -u src/sys/arch/sun2/sun2/pmap.c:1.42 src/sys/arch/sun2/sun2/pmap.c:1.43 --- src/sys/arch/sun2/sun2/pmap.c:1.42 Sat Nov 21 04:16:52 2009 +++ src/sys/arch/sun2/sun2/pmap.c Fri Dec 11 13:56:16 2009 @@ -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)