eliminate TRUNC_PAGE() and ROUND_PAGE() in favor of their

lowercase counterparts.  also, a little misc cleanup.
This commit is contained in:
chs 2000-11-21 05:49:07 +00:00
parent 290a66c213
commit 2116915a30
5 changed files with 32 additions and 46 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.40 2000/08/08 19:06:53 ragge Exp $ */
/* $NetBSD: pmap.h,v 1.41 2000/11/21 05:49:07 chs Exp $ */
/*
* Copyright (c) 1987 Carnegie-Mellon University
@ -87,10 +87,6 @@ struct pv_entry {
int pv_attr; /* write/modified bits */
};
/* ROUND_PAGE used before vm system is initialized */
#define ROUND_PAGE(x) (((uint)(x) + PGOFSET) & ~PGOFSET)
#define TRUNC_PAGE(x) ((uint)(x) & ~PGOFSET)
/* Mapping macros used when allocating SPT */
#define MAPVIRT(ptr, count) \
(vaddr_t)ptr = virtual_avail; \

View File

@ -1,4 +1,4 @@
/* $NetBSD: pte.h,v 1.17 2000/10/15 11:00:38 ragge Exp $ */
/* $NetBSD: pte.h,v 1.18 2000/11/21 05:49:08 chs Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -91,19 +91,19 @@ extern pt_entry_t *Sysmap;
r; \
})
#define kvtophys(va) ({ \
long r; \
paddr_t r; \
asm("extzv $9,$21,%1,%0;ashl $9,*" VAX_SYSMAP "[%0],%0;insv %1,$0,$9,%0" \
: "=&r"(r) : "g"(va) : "cc"); \
r; \
})
#else /* __GNUC__ */
#define kvtophys(va) \
(((kvtopte(va))->pg_pfn << VAX_PGSHIFT) | ((int)(va) & VAX_PGOFSET))
(((kvtopte(va))->pg_pfn << VAX_PGSHIFT) | ((paddr_t)(va) & VAX_PGOFSET))
#define kvtopte(va) (&Sysmap[PG_PFNUM(va)])
#endif /* __GNUC__ */
#define uvtopte(va, pcb) \
(((unsigned)va < 0x40000000) ? \
&((pcb->P0BR)[PG_PFNUM(va)]) : \
&((pcb->P1BR)[PG_PFNUM(va)]))
(((vaddr_t)va < 0x40000000) ? \
&(((pcb)->P0BR)[PG_PFNUM(va)]) : \
&(((pcb)->P1BR)[PG_PFNUM(va)]))
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.c,v 1.52 2000/09/04 11:46:33 ragge Exp $ */
/* $NetBSD: locore.c,v 1.53 2000/11/21 05:49:08 chs Exp $ */
/*
* Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -271,7 +271,7 @@ _start(struct rpb *prpb)
avail_end += VAX_NBPG * 128;
boothowto = prpb->rpb_bootr5;
avail_end = TRUNC_PAGE(avail_end); /* be sure */
avail_end &= ~PGOFSET; /* be sure */
proc0.p_addr = (void *)proc0paddr; /* XXX */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.89 2000/10/31 20:15:09 ragge Exp $ */
/* $NetBSD: pmap.c,v 1.90 2000/11/21 05:49:08 chs Exp $ */
/*
* Copyright (c) 1994, 1998, 1999 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -150,6 +150,10 @@ pmap_bootstrap()
struct pcb *pcb = (struct pcb *)proc0paddr;
pmap_t pmap = pmap_kernel();
/* Set logical page size */
uvmexp.pagesize = NBPG;
uvm_setpagesize();
/*
* Calculation of the System Page Table is somewhat a pain,
* because it must be in contiguous physical memory and all
@ -201,17 +205,17 @@ pmap_bootstrap()
mtpr((unsigned)Sysmap - KERNBASE, PR_SBR);
/* Map Interrupt stack and set red zone */
istack = (unsigned)Sysmap + ROUND_PAGE(sysptsize * 4);
istack = (unsigned)Sysmap + round_page(sysptsize * 4);
mtpr(istack + ISTACK_SIZE, PR_ISP);
kvtopte(istack)->pg_v = 0;
/* Some scratch pages */
scratch = ((u_int)istack + ISTACK_SIZE);
scratch = istack + ISTACK_SIZE;
/* Physical-to-virtual translation table */
(unsigned)pv_table = scratch + 4 * VAX_NBPG;
pv_table = (struct pv_entry *)(scratch + 4 * VAX_NBPG);
avail_start = (unsigned)pv_table + (ROUND_PAGE(avail_end >> PGSHIFT)) *
avail_start = (vaddr_t)pv_table + (round_page(avail_end >> PGSHIFT)) *
sizeof(struct pv_entry) - KERNBASE;
/* Kernel message buffer */
@ -221,10 +225,6 @@ pmap_bootstrap()
/* zero all mapped physical memory from Sysmap to here */
memset((void *)istack, 0, (avail_start + KERNBASE) - istack);
/* Set logical page size */
uvmexp.pagesize = NBPG;
uvm_setpagesize();
/* QDSS console mapping hack */
#if NQD > 0
qdearly();
@ -243,9 +243,9 @@ pmap_bootstrap()
if (dep_call->cpu_steal_pages)
(*dep_call->cpu_steal_pages)();
avail_start = ROUND_PAGE(avail_start);
virtual_avail = ROUND_PAGE(virtual_avail);
virtual_end = TRUNC_PAGE(virtual_end);
avail_start = round_page(avail_start);
virtual_avail = round_page(virtual_avail);
virtual_end = trunc_page(virtual_end);
#if 0 /* Breaks cninit() on some machines */
@ -500,8 +500,6 @@ pmap_destroy(pmap)
#ifdef PMAPDEBUG
if(startpmapdebug)printf("pmap_destroy: pmap %p\n",pmap);
#endif
if (pmap == NULL)
return;
simple_lock(&pmap->pm_lock);
count = --pmap->ref_count;
@ -509,7 +507,7 @@ if(startpmapdebug)printf("pmap_destroy: pmap %p\n",pmap);
if (count == 0) {
pmap_release(pmap);
FREE((caddr_t)pmap, M_VMPMAP);
FREE(pmap, M_VMPMAP);
}
}
@ -674,9 +672,6 @@ if (startpmapdebug)
printf("pmap_enter: pmap %p v %lx p %lx prot %x wired %d access %x\n",
pmap, v, p, prot, wired, flags & VM_PROT_ALL);
#endif
/* Can this happen with UVM??? */
if (pmap == 0)
return (KERN_SUCCESS);
RECURSESTART;
/* Find addess of correct pte */
@ -690,9 +685,6 @@ if (startpmapdebug)
i = (v >> VAX_PGSHIFT);
if (i >= (pmap->pm_p0lr & ~AST_MASK))
panic("P0 too small in pmap_enter");
patch = (int *)pmap->pm_p0br;
newpte = (p >> VAX_PGSHIFT) |
(prot & VM_PROT_WRITE ? PG_RW : PG_RO);
} else {
patch = (int *)pmap->pm_p1br;
i = (v - 0x40000000) >> VAX_PGSHIFT;
@ -700,9 +692,9 @@ if (startpmapdebug)
panic("pmap_enter: must expand P1");
if (v < pmap->pm_stack)
pmap->pm_stack = v;
}
newpte = (p >> VAX_PGSHIFT) |
(prot & VM_PROT_WRITE ? PG_RW : PG_RO);
}
/*
* Check if a pte page must be mapped in.
@ -745,7 +737,6 @@ if (startpmapdebug)
newpte |= PG_W;
oldpte = patch[i] & ~(PG_V|PG_M);
pv = pv_table + (p >> PGSHIFT);
/* wiring change? */
@ -1025,8 +1016,7 @@ if (startpmapdebug)
pte = (u_int *)mfpr(PR_P0BR);
pte += PG_PFNUM(addr);
if (bits & 2) { /* PTE reference */
pte = (u_int *)TRUNC_PAGE(pte);
pte = (u_int *)kvtopte(pte);
pte = (u_int *)kvtopte(trunc_page((vaddr_t)pte));
if (pte[0] == 0) /* Check for CVAX bug */
return 1;
pa = (u_int)pte & ~KERNBASE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vsbus.c,v 1.29 2000/06/29 07:14:37 mrg Exp $ */
/* $NetBSD: vsbus.c,v 1.30 2000/11/21 05:49:08 chs Exp $ */
/*
* Copyright (c) 1996, 1999 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -301,13 +301,13 @@ vsbus_copytoproc(struct proc *p, caddr_t from, caddr_t to, int len)
struct pte *pte;
paddr_t pa;
if ((long)to & KERNBASE) { /* In kernel space */
if ((vaddr_t)to & KERNBASE) { /* In kernel space */
bcopy(from, to, len);
return;
}
pte = uvtopte(TRUNC_PAGE(to), (&p->p_addr->u_pcb));
pte = uvtopte(trunc_page((vaddr_t)to), &p->p_addr->u_pcb);
if ((vaddr_t)to & PGOFSET) {
int cz = ROUND_PAGE(to) - (vaddr_t)to;
int cz = round_page((vaddr_t)to) - (vaddr_t)to;
pa = (pte->pg_pfn << VAX_PGSHIFT) | (NBPG - cz) | KERNBASE;
bcopy(from, (caddr_t)pa, min(cz, len));
@ -332,13 +332,13 @@ vsbus_copyfromproc(struct proc *p, caddr_t from, caddr_t to, int len)
struct pte *pte;
paddr_t pa;
if ((long)from & KERNBASE) { /* In kernel space */
if ((vaddr_t)from & KERNBASE) { /* In kernel space */
bcopy(from, to, len);
return;
}
pte = uvtopte(TRUNC_PAGE(from), (&p->p_addr->u_pcb));
pte = uvtopte(trunc_page((vaddr_t)from), &p->p_addr->u_pcb);
if ((vaddr_t)from & PGOFSET) {
int cz = ROUND_PAGE(from) - (vaddr_t)from;
int cz = round_page((vaddr_t)from) - (vaddr_t)from;
pa = (pte->pg_pfn << VAX_PGSHIFT) | (NBPG - cz) | KERNBASE;
bcopy((caddr_t)pa, to, min(cz, len));