s/sun3_/_/ in sun3_(round|trunc)_(page|seg) macros

This commit is contained in:
gwr 1997-03-13 15:58:49 +00:00
parent 7c7f4379a0
commit 032d13fc7d
9 changed files with 63 additions and 61 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pte.h,v 1.13 1997/01/27 19:41:08 gwr Exp $ */ /* $NetBSD: pte.h,v 1.14 1997/03/13 15:58:49 gwr Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -88,15 +88,16 @@
/* /*
* Mach derived conversion macros * Mach derived conversion macros
* Used only in sys/arch/_MACHINE
*/ */
#define sun3_round_seg(x) ((((unsigned)(x)) + SEGOFSET) & ~SEGOFSET) #define _round_seg(x) ((((unsigned)(x)) + SEGOFSET) & ~SEGOFSET)
#define sun3_trunc_seg(x) ((unsigned)(x) & ~SEGOFSET) #define _trunc_seg(x) ((unsigned)(x) & ~SEGOFSET)
#define sun3_btos(x) ((unsigned)(x) >> SEGSHIFT) #define _btos(x) ((unsigned)(x) >> SEGSHIFT)
#define sun3_stob(x) ((unsigned)(x) << SEGSHIFT) #define _stob(x) ((unsigned)(x) << SEGSHIFT)
#define sun3_round_page(x) ((((unsigned)(x)) + PGOFSET) & ~PGOFSET) #define _round_page(x) ((((unsigned)(x)) + PGOFSET) & ~PGOFSET)
#define sun3_trunc_page(x) ((unsigned)(x) & ~PGOFSET) #define _trunc_page(x) ((unsigned)(x) & ~PGOFSET)
#define sun3_btop(x) ((unsigned)(x) >> PGSHIFT) #define _btop(x) ((unsigned)(x) >> PGSHIFT)
#define sun3_ptob(x) ((unsigned)(x) << PGSHIFT) #define _ptob(x) ((unsigned)(x) << PGSHIFT)
#endif /* !_MACHINE_PTE_H*/ #endif /* !_MACHINE_PTE_H*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: pte3.h,v 1.13 1997/01/27 19:41:08 gwr Exp $ */ /* $NetBSD: pte3.h,v 1.14 1997/03/13 15:58:49 gwr Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -88,15 +88,16 @@
/* /*
* Mach derived conversion macros * Mach derived conversion macros
* Used only in sys/arch/_MACHINE
*/ */
#define sun3_round_seg(x) ((((unsigned)(x)) + SEGOFSET) & ~SEGOFSET) #define _round_seg(x) ((((unsigned)(x)) + SEGOFSET) & ~SEGOFSET)
#define sun3_trunc_seg(x) ((unsigned)(x) & ~SEGOFSET) #define _trunc_seg(x) ((unsigned)(x) & ~SEGOFSET)
#define sun3_btos(x) ((unsigned)(x) >> SEGSHIFT) #define _btos(x) ((unsigned)(x) >> SEGSHIFT)
#define sun3_stob(x) ((unsigned)(x) << SEGSHIFT) #define _stob(x) ((unsigned)(x) << SEGSHIFT)
#define sun3_round_page(x) ((((unsigned)(x)) + PGOFSET) & ~PGOFSET) #define _round_page(x) ((((unsigned)(x)) + PGOFSET) & ~PGOFSET)
#define sun3_trunc_page(x) ((unsigned)(x) & ~PGOFSET) #define _trunc_page(x) ((unsigned)(x) & ~PGOFSET)
#define sun3_btop(x) ((unsigned)(x) >> PGSHIFT) #define _btop(x) ((unsigned)(x) >> PGSHIFT)
#define sun3_ptob(x) ((unsigned)(x) << PGSHIFT) #define _ptob(x) ((unsigned)(x) << PGSHIFT)
#endif /* !_MACHINE_PTE_H*/ #endif /* !_MACHINE_PTE_H*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: dvma.c,v 1.7 1997/02/05 17:33:46 gwr Exp $ */ /* $NetBSD: dvma.c,v 1.8 1997/03/13 15:58:51 gwr Exp $ */
/* /*
* Copyright (c) 1995 Gordon W. Ross * Copyright (c) 1995 Gordon W. Ross
@ -106,7 +106,7 @@ dvma_mapout(char *addr, int len)
char * char *
dvma_alloc(int len) dvma_alloc(int len)
{ {
len = sun3_round_page(len); len = _round_page(len);
dvma_end -= len; dvma_end -= len;
return((char*)dvma_end); return((char*)dvma_end);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: promdev.c,v 1.7 1996/01/29 23:41:10 gwr Exp $ */ /* $NetBSD: promdev.c,v 1.8 1997/03/13 15:58:51 gwr Exp $ */
/* /*
* Copyright (c) 1995 Gordon W. Ross * Copyright (c) 1995 Gordon W. Ross
@ -105,7 +105,7 @@ prom_iopen(si)
/* try page-aligned address... */ /* try page-aligned address... */
size = dip->d_dmabytes + NBPG; size = dip->d_dmabytes + NBPG;
addr = (int) dvma_alloc(size); addr = (int) dvma_alloc(size);
addr = sun3_round_page(addr); addr = _round_page(addr);
si->si_dmaaddr = (char*) addr; si->si_dmaaddr = (char*) addr;
#ifdef DEBUG_PROM #ifdef DEBUG_PROM
if (debug) if (debug)

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_memrw.c,v 1.16 1997/01/27 20:43:53 gwr Exp $ */ /* $NetBSD: db_memrw.c,v 1.17 1997/03/13 15:58:52 gwr Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -117,7 +117,7 @@ db_write_text(dst, size, data)
if (size <= 0) if (size <= 0)
return; return;
pgva = sun3_trunc_page((long)dst); pgva = _trunc_page((long)dst);
goto firstpage; goto firstpage;
do { do {
@ -127,7 +127,7 @@ db_write_text(dst, size, data)
* for the previous page, and make the new * for the previous page, and make the new
* page writable. * page writable.
*/ */
pgva = sun3_trunc_page((long)dst); pgva = _trunc_page((long)dst);
if (pgva != prevpg) { if (pgva != prevpg) {
/* /*
* Restore old PTE. No cache flush, * Restore old PTE. No cache flush,

View File

@ -1,4 +1,4 @@
/* $NetBSD: dvma.c,v 1.8 1997/01/27 20:43:54 gwr Exp $ */ /* $NetBSD: dvma.c,v 1.9 1997/03/13 15:58:53 gwr Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -115,7 +115,7 @@ caddr_t dvma_malloc(bytes)
if (!bytes) if (!bytes)
return NULL; return NULL;
new_size = sun3_round_page(bytes); new_size = _round_page(bytes);
new_mem = (caddr_t) kmem_alloc(phys_map, new_size); new_mem = (caddr_t) kmem_alloc(phys_map, new_size);
if (!new_mem) if (!new_mem)
panic("dvma_malloc: no space in phys_map"); panic("dvma_malloc: no space in phys_map");
@ -130,7 +130,7 @@ void dvma_free(addr, size)
caddr_t addr; caddr_t addr;
size_t size; size_t size;
{ {
vm_size_t sz = sun3_round_page(size); vm_size_t sz = _round_page(size);
kmem_free(phys_map, (vm_offset_t)addr, sz); kmem_free(phys_map, (vm_offset_t)addr, sz);
} }
@ -185,7 +185,7 @@ caddr_t dvma_mapin(char *kva, int len)
seg_kva -= seg_off; seg_kva -= seg_off;
seg_len += seg_off; seg_len += seg_off;
/* seg-align length */ /* seg-align length */
seg_len = sun3_round_seg(seg_len); seg_len = _round_seg(seg_len);
s = splimp(); s = splimp();
@ -244,7 +244,7 @@ void dvma_mapout(char *dma, int len)
seg_dma -= seg_off; seg_dma -= seg_off;
seg_len += seg_off; seg_len += seg_off;
/* seg-align length */ /* seg-align length */
seg_len = sun3_round_seg(seg_len); seg_len = _round_seg(seg_len);
s = splimp(); s = splimp();

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore2.c,v 1.63 1997/02/18 15:30:01 gwr Exp $ */ /* $NetBSD: locore2.c,v 1.64 1997/03/13 15:58:56 gwr Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -318,7 +318,7 @@ _vm_init(kehp)
/* This will advance esym past the symbols. */ /* This will advance esym past the symbols. */
_save_symtab(kehp); _save_symtab(kehp);
#endif #endif
virtual_avail = sun3_round_page(esym); virtual_avail = _round_page(esym);
virtual_end = VM_MAX_KERNEL_ADDRESS; virtual_end = VM_MAX_KERNEL_ADDRESS;
/* /*
@ -335,7 +335,7 @@ _vm_init(kehp)
/* PROM version 1 or later. */ /* PROM version 1 or later. */
avail_end = *rvec->memoryAvail; avail_end = *rvec->memoryAvail;
} }
avail_end = sun3_trunc_page(avail_end); avail_end = _trunc_page(avail_end);
/* /*
* Steal some special-purpose, already mapped pages. * Steal some special-purpose, already mapped pages.
@ -396,7 +396,7 @@ _vm_init(kehp)
* clean out the rest of the last used segment. * clean out the rest of the last used segment.
* After this point, virtual_avail is seg-aligned. * After this point, virtual_avail is seg-aligned.
*/ */
virtual_avail = sun3_round_seg(virtual_avail); virtual_avail = _round_seg(virtual_avail);
while (va < virtual_avail) { while (va < virtual_avail) {
set_pte(va, PG_INVAL); set_pte(va, PG_INVAL);
va += NBPG; va += NBPG;
@ -439,8 +439,8 @@ _vm_init(kehp)
* Clear-out pmegs left in DVMA space by the PROM. * Clear-out pmegs left in DVMA space by the PROM.
* DO NOT kill the last one! (owned by the PROM!) * DO NOT kill the last one! (owned by the PROM!)
*/ */
va = sun3_trunc_seg(DVMA_SPACE_START); va = _trunc_seg(DVMA_SPACE_START);
eva = sun3_trunc_seg(DVMA_SPACE_END); /* Yes trunc! */ eva = _trunc_seg(DVMA_SPACE_END); /* Yes trunc! */
while (va < eva) { while (va < eva) {
set_segmap(va, SEGINV); set_segmap(va, SEGINV);
va += NBSG; va += NBSG;
@ -510,7 +510,7 @@ _vm_init(kehp)
/* text */ /* text */
va = (vm_offset_t) kernel_text; va = (vm_offset_t) kernel_text;
eva = sun3_trunc_page(etext); eva = _trunc_page(etext);
while (va < eva) { while (va < eva) {
pte = get_pte(va); pte = get_pte(va);
if ((pte & (PG_VALID|PG_TYPE)) != PG_VALID) { if ((pte & (PG_VALID|PG_TYPE)) != PG_VALID) {
@ -524,7 +524,7 @@ _vm_init(kehp)
} }
/* data and bss */ /* data and bss */
eva = sun3_round_page(end); eva = _round_page(end);
while (va < eva) { while (va < eva) {
pte = get_pte(va); pte = get_pte(va);
if ((pte & (PG_VALID|PG_TYPE)) != PG_VALID) { if ((pte & (PG_VALID|PG_TYPE)) != PG_VALID) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.70 1997/02/28 19:55:37 gwr Exp $ */ /* $NetBSD: pmap.c,v 1.71 1997/03/13 15:58:55 gwr Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -525,7 +525,7 @@ context_free(pmap) /* :) */
panic("context_free: unknown sme at va=0x%x", va); panic("context_free: unknown sme at va=0x%x", va);
if (pmap_debug & PMD_SEGMAP) if (pmap_debug & PMD_SEGMAP)
printf("pmap: set_segmap ctx=%d v=%x old=%x new=ff (cf)\n", printf("pmap: set_segmap ctx=%d v=%x old=%x new=ff (cf)\n",
ctxnum, sun3_trunc_seg(va), sme); ctxnum, _trunc_seg(va), sme);
#endif #endif
/* Did cache flush above (whole context). */ /* Did cache flush above (whole context). */
set_segmap(va, SEGINV); set_segmap(va, SEGINV);
@ -1550,7 +1550,7 @@ pmap_next_page(paddr)
{ {
/* Is it time to skip over the hole? */ /* Is it time to skip over the hole? */
if (avail_next == hole_start) if (avail_next == hole_start)
avail_next += sun3_round_page(hole_size); avail_next += _round_page(hole_size);
/* Any available memory remaining? */ /* Any available memory remaining? */
if (avail_next >= avail_end) if (avail_next >= avail_end)
@ -1795,7 +1795,7 @@ pmap_remove_range_mmu(pmap, sva, eva)
} }
#endif #endif
va = sun3_trunc_seg(sva); va = _trunc_seg(sva);
sme = get_segmap(va); sme = get_segmap(va);
#ifdef DIAGNOSTIC #ifdef DIAGNOSTIC
/* Make sure it is valid and known. */ /* Make sure it is valid and known. */
@ -1885,7 +1885,7 @@ pmap_remove_range_mmu(pmap, sva, eva)
#ifdef PMAP_DEBUG #ifdef PMAP_DEBUG
if (pmap_debug & PMD_SEGMAP) { if (pmap_debug & PMD_SEGMAP) {
printf("pmap: set_segmap ctx=%d v=%x old=%x new=ff (rm2)\n", printf("pmap: set_segmap ctx=%d v=%x old=%x new=ff (rm2)\n",
get_context(), sun3_trunc_seg(sva), get_context(), _trunc_seg(sva),
pmegp->pmeg_index); pmegp->pmeg_index);
} }
#endif #endif
@ -1970,7 +1970,7 @@ pmap_remove_range(pmap, sva, eva)
PMAP_LOCK(); PMAP_LOCK();
#ifdef DIAGNOSTIC #ifdef DIAGNOSTIC
if (sun3_trunc_seg(sva) != sun3_trunc_seg(eva-NBPG)) if (_trunc_seg(sva) != _trunc_seg(eva-NBPG))
panic("pmap_remove_range: bad range!"); panic("pmap_remove_range: bad range!");
#endif #endif
@ -2054,7 +2054,7 @@ pmap_remove(pmap, sva, eva)
va = sva; va = sva;
while (va < eva) { while (va < eva) {
neva = sun3_trunc_seg(va) + NBSG; neva = _trunc_seg(va) + NBSG;
if (neva > eva) if (neva > eva)
neva = eva; neva = eva;
pmap_remove_range(pmap, va, neva); pmap_remove_range(pmap, va, neva);
@ -2115,14 +2115,14 @@ pmap_enter_kernel(va, pa, prot, wired, new_pte)
new_pte |= PG_NC; new_pte |= PG_NC;
} }
seg_va = sun3_trunc_seg(va); seg_va = _trunc_seg(va);
do_pv = TRUE; do_pv = TRUE;
PMAP_LOCK(); PMAP_LOCK();
sme = get_segmap(va); sme = get_segmap(va);
if (sme == SEGINV) { if (sme == SEGINV) {
pmegp = pmeg_allocate(kernel_pmap, sun3_trunc_seg(va)); pmegp = pmeg_allocate(kernel_pmap, _trunc_seg(va));
sme = pmegp->pmeg_index; sme = pmegp->pmeg_index;
set_segmap_allctx(va, sme); set_segmap_allctx(va, sme);
#ifdef PMAP_DEBUG #ifdef PMAP_DEBUG
@ -2130,7 +2130,7 @@ pmap_enter_kernel(va, pa, prot, wired, new_pte)
printf("pmap: set_segmap pmap=%p va=%x sme=%x (ek1)\n", printf("pmap: set_segmap pmap=%p va=%x sme=%x (ek1)\n",
kernel_pmap, seg_va, sme); kernel_pmap, seg_va, sme);
} }
pmeg_verify_empty(sun3_trunc_seg(va)); pmeg_verify_empty(_trunc_seg(va));
#endif #endif
/* There are no existing mappings to deal with. */ /* There are no existing mappings to deal with. */
old_pte = 0; old_pte = 0;
@ -2255,7 +2255,7 @@ pmap_enter_user(pmap, va, pa, prot, wired, new_pte)
#endif #endif
segnum = VA_SEGNUM(va); segnum = VA_SEGNUM(va);
seg_va = sun3_trunc_seg(va); seg_va = _trunc_seg(va);
do_pv = TRUE; do_pv = TRUE;
PMAP_LOCK(); PMAP_LOCK();
@ -2552,7 +2552,7 @@ int pmap_fault_reload(pmap, va, ftype)
} }
if (va >= VM_MAXUSER_ADDRESS) if (va >= VM_MAXUSER_ADDRESS)
return (0); return (0);
seg_va = sun3_trunc_seg(va); seg_va = _trunc_seg(va);
/* Make sure context is correct. */ /* Make sure context is correct. */
ctx = get_context(); ctx = get_context();
@ -2901,7 +2901,7 @@ pmap_protect_range_mmu(pmap, sva, eva)
} }
#endif #endif
va = sun3_trunc_seg(sva); va = _trunc_seg(sva);
sme = get_segmap(va); sme = get_segmap(va);
#ifdef DIAGNOSTIC #ifdef DIAGNOSTIC
/* Make sure it is valid and known. */ /* Make sure it is valid and known. */
@ -3030,7 +3030,7 @@ pmap_protect_range(pmap, sva, eva)
printf("pmap_protect_range(%p, %x, %x)\n", pmap, sva, eva); printf("pmap_protect_range(%p, %x, %x)\n", pmap, sva, eva);
#endif #endif
#ifdef DIAGNOSTIC #ifdef DIAGNOSTIC
if (sun3_trunc_seg(sva) != sun3_trunc_seg(eva-NBPG)) if (_trunc_seg(sva) != _trunc_seg(eva-NBPG))
panic("pmap_protect_range: bad range!"); panic("pmap_protect_range: bad range!");
#endif #endif
@ -3123,7 +3123,7 @@ pmap_protect(pmap, sva, eva, prot)
va = sva; va = sva;
while (va < eva) { while (va < eva) {
neva = sun3_trunc_seg(va) + NBSG; neva = _trunc_seg(va) + NBSG;
if (neva > eva) if (neva > eva)
neva = eva; neva = eva;
pmap_protect_range(pmap, va, neva); pmap_protect_range(pmap, va, neva);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sun3_startup.c,v 1.63 1997/02/18 15:30:01 gwr Exp $ */ /* $NetBSD: sun3_startup.c,v 1.64 1997/03/13 15:58:56 gwr Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -318,7 +318,7 @@ _vm_init(kehp)
/* This will advance esym past the symbols. */ /* This will advance esym past the symbols. */
_save_symtab(kehp); _save_symtab(kehp);
#endif #endif
virtual_avail = sun3_round_page(esym); virtual_avail = _round_page(esym);
virtual_end = VM_MAX_KERNEL_ADDRESS; virtual_end = VM_MAX_KERNEL_ADDRESS;
/* /*
@ -335,7 +335,7 @@ _vm_init(kehp)
/* PROM version 1 or later. */ /* PROM version 1 or later. */
avail_end = *rvec->memoryAvail; avail_end = *rvec->memoryAvail;
} }
avail_end = sun3_trunc_page(avail_end); avail_end = _trunc_page(avail_end);
/* /*
* Steal some special-purpose, already mapped pages. * Steal some special-purpose, already mapped pages.
@ -396,7 +396,7 @@ _vm_init(kehp)
* clean out the rest of the last used segment. * clean out the rest of the last used segment.
* After this point, virtual_avail is seg-aligned. * After this point, virtual_avail is seg-aligned.
*/ */
virtual_avail = sun3_round_seg(virtual_avail); virtual_avail = _round_seg(virtual_avail);
while (va < virtual_avail) { while (va < virtual_avail) {
set_pte(va, PG_INVAL); set_pte(va, PG_INVAL);
va += NBPG; va += NBPG;
@ -439,8 +439,8 @@ _vm_init(kehp)
* Clear-out pmegs left in DVMA space by the PROM. * Clear-out pmegs left in DVMA space by the PROM.
* DO NOT kill the last one! (owned by the PROM!) * DO NOT kill the last one! (owned by the PROM!)
*/ */
va = sun3_trunc_seg(DVMA_SPACE_START); va = _trunc_seg(DVMA_SPACE_START);
eva = sun3_trunc_seg(DVMA_SPACE_END); /* Yes trunc! */ eva = _trunc_seg(DVMA_SPACE_END); /* Yes trunc! */
while (va < eva) { while (va < eva) {
set_segmap(va, SEGINV); set_segmap(va, SEGINV);
va += NBSG; va += NBSG;
@ -510,7 +510,7 @@ _vm_init(kehp)
/* text */ /* text */
va = (vm_offset_t) kernel_text; va = (vm_offset_t) kernel_text;
eva = sun3_trunc_page(etext); eva = _trunc_page(etext);
while (va < eva) { while (va < eva) {
pte = get_pte(va); pte = get_pte(va);
if ((pte & (PG_VALID|PG_TYPE)) != PG_VALID) { if ((pte & (PG_VALID|PG_TYPE)) != PG_VALID) {
@ -524,7 +524,7 @@ _vm_init(kehp)
} }
/* data and bss */ /* data and bss */
eva = sun3_round_page(end); eva = _round_page(end);
while (va < eva) { while (va < eva) {
pte = get_pte(va); pte = get_pte(va);
if ((pte & (PG_VALID|PG_TYPE)) != PG_VALID) { if ((pte & (PG_VALID|PG_TYPE)) != PG_VALID) {