diff options
author | Martin Reindl <martin@cvs.openbsd.org> | 2008-05-04 09:57:48 +0000 |
---|---|---|
committer | Martin Reindl <martin@cvs.openbsd.org> | 2008-05-04 09:57:48 +0000 |
commit | ac601af741ec6b7286d79ec95cef84354dcf0cfe (patch) | |
tree | 30e30d5498181365c90c7a66f100a09adcd4a2d0 /sys/arch | |
parent | 36fc7f0644092574a9ce2540ddf97cbffd75da71 (diff) |
convert arm and mips64 platforms to ptoa/atop
tested by maja@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm/arm/arm32_machdep.c | 8 | ||||
-rw-r--r-- | sys/arch/arm/arm/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/arm/include/param.h | 7 | ||||
-rw-r--r-- | sys/arch/mips64/include/param.h | 6 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/sendsig.c | 4 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/machdep.c | 8 |
7 files changed, 16 insertions, 25 deletions
diff --git a/sys/arch/arm/arm/arm32_machdep.c b/sys/arch/arm/arm/arm32_machdep.c index ddb653e6ec9..011e4700ab6 100644 --- a/sys/arch/arm/arm/arm32_machdep.c +++ b/sys/arch/arm/arm/arm32_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arm32_machdep.c,v 1.28 2008/03/23 17:05:41 deraadt Exp $ */ +/* $OpenBSD: arm32_machdep.c,v 1.29 2008/05/04 09:57:46 martin Exp $ */ /* $NetBSD: arm32_machdep.c,v 1.42 2003/12/30 12:33:15 pk Exp $ */ /* @@ -273,7 +273,7 @@ cpu_startup() */ /* msgbufphys was setup during the secondary boot strap */ - for (loop = 0; loop < btoc(MSGBUFSIZE); ++loop) + for (loop = 0; loop < atop(MSGBUFSIZE); ++loop) pmap_kenter_pa((vaddr_t)msgbufaddr + loop * PAGE_SIZE, msgbufphys + loop * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE); pmap_update(pmap_kernel()); @@ -285,8 +285,8 @@ cpu_startup() */ printf(version); - printf("real mem = %u (%uMB)\n", ctob(physmem), - ctob(physmem)/1024/1024); + printf("real mem = %u (%uMB)\n", ptoa(physmem), + ptoa(physmem)/1024/1024); /* * Find out how much space we need, allocate it, diff --git a/sys/arch/arm/arm/mem.c b/sys/arch/arm/arm/mem.c index bcf8367e212..7c5ee6a6b0b 100644 --- a/sys/arch/arm/arm/mem.c +++ b/sys/arch/arm/arm/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.7 2007/10/06 23:50:54 krw Exp $ */ +/* $OpenBSD: mem.c,v 1.8 2008/05/04 09:57:46 martin Exp $ */ /* $NetBSD: mem.c,v 1.11 2003/10/16 12:02:58 jdolecek Exp $ */ /* @@ -256,7 +256,7 @@ mmmmap(dev, off, prot) /* minor device 0 is physical memory */ - if ((paddr_t)off >= ctob((paddr_t)physmem) && + if ((paddr_t)off >= ptoa((paddr_t)physmem) && suser(p, 0) != 0) return -1; return atop(off); diff --git a/sys/arch/arm/include/param.h b/sys/arch/arm/include/param.h index ae7022c4ead..542b1fbc20c 100644 --- a/sys/arch/arm/include/param.h +++ b/sys/arch/arm/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.11 2007/05/28 21:02:49 thib Exp $ */ +/* $OpenBSD: param.h,v 1.12 2008/05/04 09:57:47 martin Exp $ */ /* $NetBSD: param.h,v 1.9 2002/03/24 03:37:23 thorpej Exp $ */ /* @@ -157,11 +157,6 @@ void delay (unsigned); #define dtoc(x) ((x) >> (PAGE_SHIFT - DEV_BSHIFT)) /*#define dtob(x) ((x) << DEV_BSHIFT)*/ -#define ctob(x) ((x) << PAGE_SHIFT) - -/* bytes to pages */ -#define btoc(x) (((x) + PAGE_MASK) >> PAGE_SHIFT) - #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ ((bytes) >> DEV_BSHIFT) #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ diff --git a/sys/arch/mips64/include/param.h b/sys/arch/mips64/include/param.h index 526d0927187..33cb7050b92 100644 --- a/sys/arch/mips64/include/param.h +++ b/sys/arch/mips64/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.17 2007/05/28 21:02:49 thib Exp $ */ +/* $OpenBSD: param.h,v 1.18 2008/05/04 09:57:47 martin Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -106,10 +106,6 @@ #define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) #define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) -/* pages to bytes */ -#define ctob(x) ((x) << PGSHIFT) -#define btoc(x) (((x) + PGOFSET) >> PGSHIFT) - /* bytes to disk blocks */ #define btodb(x) ((x) >> DEV_BSHIFT) #define dbtob(x) ((x) << DEV_BSHIFT) diff --git a/sys/arch/mips64/mips64/mem.c b/sys/arch/mips64/mips64/mem.c index 965a00d085f..906ce0f09d9 100644 --- a/sys/arch/mips64/mips64/mem.c +++ b/sys/arch/mips64/mips64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.11 2008/03/31 04:03:32 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.12 2008/05/04 09:57:47 martin Exp $ */ /* $NetBSD: mem.c,v 1.6 1995/04/10 11:55:03 mycroft Exp $ */ /* @@ -113,7 +113,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) case 0: v = uio->uio_offset; c = iov->iov_len; - if (v + c > ctob(physmem)) + if (v + c > ptoa(physmem)) return (EFAULT); v = (vaddr_t)PHYS_TO_XKPHYS(v, CCA_NONCOHERENT); error = uiomove((caddr_t)v, c, uio); diff --git a/sys/arch/mips64/mips64/sendsig.c b/sys/arch/mips64/mips64/sendsig.c index 698697f2aad..474591aad89 100644 --- a/sys/arch/mips64/mips64/sendsig.c +++ b/sys/arch/mips64/mips64/sendsig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sendsig.c,v 1.9 2006/03/04 19:33:21 miod Exp $ */ +/* $OpenBSD: sendsig.c,v 1.10 2008/05/04 09:57:47 martin Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -131,7 +131,7 @@ sendsig(catcher, sig, mask, code, type, val) psp->ps_sigstk.ss_flags |= SA_ONSTACK; } else fp = (struct sigframe *)(regs->sp - fsize); - if ((vaddr_t)fp <= USRSTACK - ctob(p->p_vmspace->vm_ssize)) + if ((vaddr_t)fp <= USRSTACK - ptoa(p->p_vmspace->vm_ssize)) (void)uvm_grow(p, (vaddr_t)fp); #ifdef DEBUG if ((sigdebug & SDB_FOLLOW) || diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c index 514002d1db6..1124284c924 100644 --- a/sys/arch/sgi/sgi/machdep.c +++ b/sys/arch/sgi/sgi/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.58 2008/04/29 12:47:19 jsing Exp $ */ +/* $OpenBSD: machdep.c,v 1.59 2008/05/04 09:57:47 martin Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -863,10 +863,10 @@ dumpconf(void) return; dumpsize = ptoa(physmem); - if (dumpsize > btoc(dbtob(nblks - dumplo))) - dumpsize = btoc(dbtob(nblks - dumplo)); + if (dumpsize > atop(round_page(dbtob(nblks - dumplo)))) + dumpsize = atop(round_page(dbtob(nblks - dumplo))); else if (dumplo == 0) - dumplo = nblks - btodb(ctob(physmem)); + dumplo = nblks - btodb(ptoa(physmem)); /* * Don't dump on the first page in case the dump device includes a |