From 2584642119258a591c7b4e1344f55ed14b8c2513 Mon Sep 17 00:00:00 2001 From: martin Date: Sat, 30 Aug 2008 20:45:31 +0000 Subject: [PATCH] replace TRUNC_PAGE by trunc_page and ROUND_PAGE by round_page plus cast to vaddr_t where necassary from Miod's todo list ok miod@ --- sys/arch/vax/include/pmap.h | 6 +----- sys/arch/vax/vax/locore.c | 4 ++-- sys/arch/vax/vax/pmap.c | 12 ++++++------ sys/arch/vax/vsa/vsbus.c | 10 +++++----- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/sys/arch/vax/include/pmap.h b/sys/arch/vax/include/pmap.h index 2388a77b77b..79088650d0e 100644 --- a/sys/arch/vax/include/pmap.h +++ b/sys/arch/vax/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.29 2007/12/15 17:24:07 deraadt Exp $ */ +/* $OpenBSD: pmap.h,v 1.30 2008/08/30 20:45:31 martin Exp $ */ /* $NetBSD: pmap.h,v 1.37 1999/08/01 13:48:07 ragge Exp $ */ /* @@ -85,10 +85,6 @@ struct pv_entry { struct pmap *pv_pmap; /* pmap this entry belongs to */ }; -/* 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; \ diff --git a/sys/arch/vax/vax/locore.c b/sys/arch/vax/vax/locore.c index d9e457574cc..afc378436e6 100644 --- a/sys/arch/vax/vax/locore.c +++ b/sys/arch/vax/vax/locore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.c,v 1.34 2008/08/18 23:19:29 miod Exp $ */ +/* $OpenBSD: locore.c,v 1.35 2008/08/30 20:45:31 martin Exp $ */ /* $NetBSD: locore.c,v 1.43 2000/03/26 11:39:45 ragge Exp $ */ /* * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. @@ -369,7 +369,7 @@ start(struct rpb *prpb) } } - avail_end = TRUNC_PAGE(avail_end); /* be sure */ + avail_end = trunc_page(avail_end); /* be sure */ proc0.p_addr = (struct user *)proc0paddr; /* XXX */ bzero((struct user *)proc0paddr, sizeof(struct user)); diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c index e77c81d48ee..2bf2c257396 100644 --- a/sys/arch/vax/vax/pmap.c +++ b/sys/arch/vax/vax/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.48 2008/08/30 18:58:24 martin Exp $ */ +/* $OpenBSD: pmap.c,v 1.49 2008/08/30 20:45:31 martin Exp $ */ /* $NetBSD: pmap.c,v 1.74 1999/11/13 21:32:25 matt Exp $ */ /* * Copyright (c) 1994, 1998, 1999 Ludd, University of Lule}, Sweden. @@ -174,7 +174,7 @@ pmap_bootstrap() mtpr((unsigned)Sysmap - KERNBASE, PR_SBR); /* Map Interrupt stack and set red zone */ - istack = (vaddr_t)Sysmap + ROUND_PAGE(sysptsize * 4); + istack = (vaddr_t)Sysmap + round_page(sysptsize * 4); mtpr(istack + ISTACK_SIZE, PR_ISP); *kvtopte(istack) &= ~PG_V; @@ -212,9 +212,9 @@ pmap_bootstrap() if (dep_call->cpu_init) (*dep_call->cpu_init)(); - 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 */ @@ -1016,7 +1016,7 @@ if (startpmapdebug) pte = (pt_entry_t *)mfpr(PR_P0BR); pte += PG_PFNUM(addr); if (bits & 2) { /* PTE reference */ - pte = (pt_entry_t *)TRUNC_PAGE(pte); + pte = (pt_entry_t *)trunc_page((vaddr_t)pte); pte = kvtopte(pte); if (pte[0] == 0) /* Check for CVAX bug */ return 1; diff --git a/sys/arch/vax/vsa/vsbus.c b/sys/arch/vax/vsa/vsbus.c index 0c6069ddd80..77c1e9c1e59 100644 --- a/sys/arch/vax/vsa/vsbus.c +++ b/sys/arch/vax/vsa/vsbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vsbus.c,v 1.19 2008/08/15 22:40:07 miod Exp $ */ +/* $OpenBSD: vsbus.c,v 1.20 2008/08/30 20:45:31 martin Exp $ */ /* $NetBSD: vsbus.c,v 1.29 2000/06/29 07:14:37 mrg Exp $ */ /* * Copyright (c) 1996, 1999 Ludd, University of Lule}, Sweden. @@ -331,9 +331,9 @@ vsbus_copytoproc(struct proc *p, caddr_t from, caddr_t to, int len) 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_FRAME) << VAX_PGSHIFT) | (NBPG - cz) | KERNBASE; @@ -363,9 +363,9 @@ vsbus_copyfromproc(struct proc *p, caddr_t from, caddr_t to, int len) 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_FRAME) << VAX_PGSHIFT) | (NBPG - cz) | KERNBASE; -- 2.20.1