summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2013-03-21 21:51:02 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2013-03-21 21:51:02 +0000
commite1e64eb73e18e7813429c9bc8c24371a2f87189c (patch)
tree445fe2ebbd78a57482fa2957d8c2ac4128301237 /sys
parent7181ac8638a4f9a5e5e67d83ad4e902988843517 (diff)
NBPG -> PAGE_SIZE, PGSHIFT -> PAGE_SHIFT, PGOFSET -> PAGE_MASK
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/stand/loadfile_subr.c4
-rw-r--r--sys/arch/amd64/stand/libsa/memprobe.c4
-rw-r--r--sys/arch/hp300/stand/uboot/srt0.S8
-rw-r--r--sys/arch/i386/stand/boot/crt0.c6
-rw-r--r--sys/arch/i386/stand/libsa/apmprobe.c4
-rw-r--r--sys/arch/i386/stand/libsa/memprobe.c4
-rw-r--r--sys/arch/macppc/stand/alloc.c6
-rw-r--r--sys/arch/macppc/stand/main.c4
-rw-r--r--sys/arch/sparc/stand/common/mmu.c16
-rw-r--r--sys/arch/sparc/stand/common/promdev.c14
-rw-r--r--sys/arch/sparc64/stand/ofwboot/alloc.c6
-rw-r--r--sys/arch/sparc64/stand/ofwboot/boot.c5
-rw-r--r--sys/arch/sparc64/stand/ofwboot/elf64_exec.c6
13 files changed, 44 insertions, 43 deletions
diff --git a/sys/arch/alpha/stand/loadfile_subr.c b/sys/arch/alpha/stand/loadfile_subr.c
index b70fa8bf16f..f124b00c2ef 100644
--- a/sys/arch/alpha/stand/loadfile_subr.c
+++ b/sys/arch/alpha/stand/loadfile_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loadfile_subr.c,v 1.2 2012/06/26 16:19:02 deraadt Exp $ */
+/* $OpenBSD: loadfile_subr.c,v 1.3 2013/03/21 21:50:59 deraadt Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -26,7 +26,7 @@
#include <machine/alpha_cpu.h>
#include <machine/rpb.h>
-#define ptoa(a) ((a) << PGSHIFT)
+#define ptoa(a) ((a) << PAGE_SHIFT)
/*
* Prevent loading a kernel if it would overlap the SRM.
diff --git a/sys/arch/amd64/stand/libsa/memprobe.c b/sys/arch/amd64/stand/libsa/memprobe.c
index a890bea4695..fd331e6608d 100644
--- a/sys/arch/amd64/stand/libsa/memprobe.c
+++ b/sys/arch/amd64/stand/libsa/memprobe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: memprobe.c,v 1.11 2012/10/30 14:06:29 jsing Exp $ */
+/* $OpenBSD: memprobe.c,v 1.12 2013/03/21 21:51:00 deraadt Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
@@ -431,7 +431,7 @@ mem_delete(long long sa, long long ea)
register int64_t sp = p->addr, ep = p->addr + p->size;
/* can we eat it as a whole? */
- if ((sa - sp) <= NBPG && (ep - ea) <= NBPG) {
+ if ((sa - sp) <= PAGE_SIZE && (ep - ea) <= PAGE_SIZE) {
bcopy(p + 1, p, (char *)bios_memmap +
sizeof(bios_memmap) - (char *)p);
break;
diff --git a/sys/arch/hp300/stand/uboot/srt0.S b/sys/arch/hp300/stand/uboot/srt0.S
index ac305efcc8b..9d2104addf5 100644
--- a/sys/arch/hp300/stand/uboot/srt0.S
+++ b/sys/arch/hp300/stand/uboot/srt0.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: srt0.S,v 1.8 2013/02/02 13:34:29 miod Exp $ */
+/* $OpenBSD: srt0.S,v 1.9 2013/03/21 21:51:00 deraadt Exp $ */
/* $NetBSD: srt0.S,v 1.4 1997/05/12 07:56:00 thorpej Exp $ */
/*
@@ -55,7 +55,7 @@
NMIRESET = 0xffffff9c | reset vector
BUSERR = 0xfffffffc
MAXADDR = 0xfffff000
- NBPG = 4096
+ PAGE_SIZE =4096
MMUCMD = 0x005f400c | MMU command/status register
.data
@@ -255,8 +255,8 @@ boot1:
* Must preserve the scratch area for the BOOT ROM.
* Round up to the next 8k boundary.
*/
- addl #((2*NBPG)-1),%d0
- andl #-(2*NBPG),%d0
+ addl #((2*PAGE_SIZE)-1),%d0
+ andl #-(2*PAGE_SIZE),%d0
movl %d0,_C_LABEL(lowram) | stash that value
start:
movl #_C_LABEL(edata),%a2 | start of BSS
diff --git a/sys/arch/i386/stand/boot/crt0.c b/sys/arch/i386/stand/boot/crt0.c
index 812d1612454..c92e293b5a2 100644
--- a/sys/arch/i386/stand/boot/crt0.c
+++ b/sys/arch/i386/stand/boot/crt0.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crt0.c,v 1.5 2003/06/03 20:22:11 mickey Exp $ */
+/* $OpenBSD: crt0.c,v 1.6 2013/03/21 21:51:00 deraadt Exp $ */
/*
* Copyright (c) 1997-1998 Michael Shalayeff
@@ -62,10 +62,10 @@ static void
domap()
{
extern char end[];
- register caddr_t p = (caddr_t)(((u_long)end + PGOFSET) & ~PGOFSET);
+ register caddr_t p = (caddr_t)(((u_long)end + PAGE_MASK) & ~PAGE_MASK);
/* map heap */
- if ( (p = ummap(p, 32*NBPG, PROT_READ|PROT_WRITE,
+ if ( (p = ummap(p, 32*PAGE_SIZE, PROT_READ|PROT_WRITE,
MAP_FIXED|MAP_ANON, -1, 0)) == (caddr_t)-1) {
printf("mmap failed: %d\n", errno);
uexit(1);
diff --git a/sys/arch/i386/stand/libsa/apmprobe.c b/sys/arch/i386/stand/libsa/apmprobe.c
index ce09fa388d5..ed509886cfe 100644
--- a/sys/arch/i386/stand/libsa/apmprobe.c
+++ b/sys/arch/i386/stand/libsa/apmprobe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apmprobe.c,v 1.15 2007/09/13 06:58:47 weingart Exp $ */
+/* $OpenBSD: apmprobe.c,v 1.16 2013/03/21 21:51:00 deraadt Exp $ */
/*
* Copyright (c) 1997-2000 Michael Shalayeff
@@ -139,7 +139,7 @@ apm_connect(bios_apminfo_t *ai)
ai->apm_data_len = 0xffff - (ai->apm_data_base & 0xffff);
#endif
if (ai->apm_data_base < BOOTARG_OFF)
- ai->apm_data_len = NBPG - (ai->apm_data_base & PGOFSET) - 1;
+ ai->apm_data_len = PAGE_SIZE - (ai->apm_data_base & PAGE_MASK) - 1;
#ifdef DEBUG
if (debug)
diff --git a/sys/arch/i386/stand/libsa/memprobe.c b/sys/arch/i386/stand/libsa/memprobe.c
index 74c43c4d169..10645562b64 100644
--- a/sys/arch/i386/stand/libsa/memprobe.c
+++ b/sys/arch/i386/stand/libsa/memprobe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: memprobe.c,v 1.51 2012/10/30 14:06:29 jsing Exp $ */
+/* $OpenBSD: memprobe.c,v 1.52 2013/03/21 21:51:00 deraadt Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
@@ -421,7 +421,7 @@ mem_delete(long long sa, long long ea)
register int64_t sp = p->addr, ep = p->addr + p->size;
/* can we eat it as a whole? */
- if ((sa - sp) <= NBPG && (ep - ea) <= NBPG) {
+ if ((sa - sp) <= PAGE_SIZE && (ep - ea) <= PAGE_SIZE) {
bcopy(p + 1, p, (char *)bios_memmap +
sizeof(bios_memmap) - (char *)p);
break;
diff --git a/sys/arch/macppc/stand/alloc.c b/sys/arch/macppc/stand/alloc.c
index 1981e842f0f..051cdc0bc7f 100644
--- a/sys/arch/macppc/stand/alloc.c
+++ b/sys/arch/macppc/stand/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.6 2008/05/25 16:55:31 miod Exp $ */
+/* $OpenBSD: alloc.c,v 1.7 2013/03/21 21:51:00 deraadt Exp $ */
/* $NetBSD: alloc.c,v 1.1 1997/04/16 20:29:16 thorpej Exp $ */
/*
@@ -140,8 +140,8 @@ alloc(unsigned size)
* Allocate memory from the OpenFirmware, rounded
* to page size, and record the chunk size.
*/
- size = roundup(size, NBPG);
- help = OF_claim(0, size, NBPG);
+ size = roundup(size, PAGE_SIZE);
+ help = OF_claim(0, size, PAGE_SIZE);
if (help == (char *)-1)
panic("alloc: out of memory");
diff --git a/sys/arch/macppc/stand/main.c b/sys/arch/macppc/stand/main.c
index e327ea45212..2378bfaf3d9 100644
--- a/sys/arch/macppc/stand/main.c
+++ b/sys/arch/macppc/stand/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.7 2013/02/09 20:38:44 miod Exp $ */
+/* $OpenBSD: main.c,v 1.8 2013/03/21 21:51:00 deraadt Exp $ */
/* $NetBSD: boot.c,v 1.1 1997/04/16 20:29:17 thorpej Exp $ */
/*
@@ -206,7 +206,7 @@ run_loadfile(u_long *marks, int howto)
esym = (void *)marks[MARK_END];
{
u_int32_t lastpage;
- lastpage = roundup(marks[MARK_END], NBPG);
+ lastpage = roundup(marks[MARK_END], PAGE_SIZE);
OF_release((void*)lastpage, CLAIM_LIMIT - lastpage);
}
diff --git a/sys/arch/sparc/stand/common/mmu.c b/sys/arch/sparc/stand/common/mmu.c
index c11df529db2..af36f53d32a 100644
--- a/sys/arch/sparc/stand/common/mmu.c
+++ b/sys/arch/sparc/stand/common/mmu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mmu.c,v 1.3 2010/07/06 20:41:06 miod Exp $ */
+/* $OpenBSD: mmu.c,v 1.4 2013/03/21 21:51:00 deraadt Exp $ */
/* $NetBSD: mmu.c,v 1.8 2008/04/28 20:23:36 martin Exp $ */
/*-
@@ -99,7 +99,7 @@ mmu_init(void)
int
pmap_map4(vaddr_t va, paddr_t pa, psize_t size)
{
- u_int n = (size + NBPG - 1) >> PGSHIFT;
+ u_int n = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
u_int pte;
if (sun4_mmu3l)
@@ -110,10 +110,10 @@ pmap_map4(vaddr_t va, paddr_t pa, psize_t size)
#endif
setsegmap((va & -NBPSG), ++scookie);
while (n--) {
- pte = PG_S | PG_V | PG_W | PG_NC | ((pa >> PGSHIFT) & PG_PFNUM);
+ pte = PG_S | PG_V | PG_W | PG_NC | ((pa >> PAGE_SHIFT) & PG_PFNUM);
setpte4(va, pte);
- va += NBPG;
- pa += NBPG;
+ va += PAGE_SIZE;
+ pa += PAGE_SIZE;
if ((va & (NBPSG - 1)) == 0) {
#ifdef DEBUG
printf("%d ", scookie);
@@ -132,12 +132,12 @@ pmap_extract4(vaddr_t va, paddr_t *ppa)
{
u_int pte;
- va &= -NBPG;
+ va &= -PAGE_SIZE;
pte = getpte4(va);
if ((pte & PG_V) == 0)
return (EFAULT);
- *ppa = (pte & PG_PFNUM) << PGSHIFT;
+ *ppa = (pte & PG_PFNUM) << PAGE_SHIFT;
return (0);
}
@@ -168,7 +168,7 @@ pmap_extract_srmmu(vaddr_t va, paddr_t *ppa)
char buf[32];
u_int pte;
- va &= -NBPG;
+ va &= -PAGE_SIZE;
snprintf(buf, sizeof buf, "%lx pgmap@ %lx L!", va, (u_long)&pte);
prom_interpret(buf);
if ((pte & SRMMU_TETYPE) != SRMMU_TEPTE)
diff --git a/sys/arch/sparc/stand/common/promdev.c b/sys/arch/sparc/stand/common/promdev.c
index a928091972c..1414379265d 100644
--- a/sys/arch/sparc/stand/common/promdev.c
+++ b/sys/arch/sparc/stand/common/promdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: promdev.c,v 1.14 2011/04/14 18:27:49 miod Exp $ */
+/* $OpenBSD: promdev.c,v 1.15 2013/03/21 21:51:00 deraadt Exp $ */
/* $NetBSD: promdev.c,v 1.16 1995/11/14 15:04:01 pk Exp $ */
/*
@@ -889,7 +889,7 @@ prom0_iopen(pd)
#ifdef DEBUG_PROM
printf("prom_iopen: devaddr=0x%x pte=0x%x\n",
si->si_devaddr,
- getpte((u_long)si->si_devaddr & ~PGOFSET));
+ getpte((u_long)si->si_devaddr & ~PAGE_MASK));
#endif
}
@@ -974,7 +974,7 @@ prom_mapin(physaddr, length, maptype)
{
int i, pa, pte, va;
- if (length > (4*NBPG))
+ if (length > (4*PAGE_SIZE))
panic("prom_mapin: length=%d", length);
for (i = 0; i < prom_mapinfo_cnt; i++)
@@ -987,16 +987,16 @@ found:
pte |= (PG_V|PG_W|PG_S|PG_NC);
pa = prom_mapinfo[i].base;
pa += physaddr;
- pte |= ((pa >> PGSHIFT) & PG_PFNUM);
+ pte |= ((pa >> PAGE_SHIFT) & PG_PFNUM);
va = prom_devmap;
do {
setpte(va, pte);
- va += NBPG;
+ va += PAGE_SIZE;
pte += 1;
- length -= NBPG;
+ length -= PAGE_SIZE;
} while (length > 0);
- return ((char *)(prom_devmap | (pa & PGOFSET)));
+ return ((char *)(prom_devmap | (pa & PAGE_MASK)));
}
void
diff --git a/sys/arch/sparc64/stand/ofwboot/alloc.c b/sys/arch/sparc64/stand/ofwboot/alloc.c
index be69b061944..7e856657bfd 100644
--- a/sys/arch/sparc64/stand/ofwboot/alloc.c
+++ b/sys/arch/sparc64/stand/ofwboot/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.5 2009/08/17 14:23:09 jsing Exp $ */
+/* $OpenBSD: alloc.c,v 1.6 2013/03/21 21:51:01 deraadt Exp $ */
/* $NetBSD: alloc.c,v 1.1 2000/08/20 14:58:37 mrg Exp $ */
/*
@@ -140,8 +140,8 @@ alloc(unsigned size)
* Allocate memory from the OpenFirmware, rounded
* to page size, and record the chunk size.
*/
- size = roundup(size, NBPG);
- help = OF_claim(0, size, NBPG);
+ size = roundup(size, PAGE_SIZE);
+ help = OF_claim(0, size, PAGE_SIZE);
if (help == (char *)-1)
panic("alloc: out of memory");
diff --git a/sys/arch/sparc64/stand/ofwboot/boot.c b/sys/arch/sparc64/stand/ofwboot/boot.c
index eae7ac736a8..f1eb43e2286 100644
--- a/sys/arch/sparc64/stand/ofwboot/boot.c
+++ b/sys/arch/sparc64/stand/ofwboot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.18 2010/08/25 12:53:38 jsing Exp $ */
+/* $OpenBSD: boot.c,v 1.19 2013/03/21 21:51:01 deraadt Exp $ */
/* $NetBSD: boot.c,v 1.3 2001/05/31 08:55:19 mrg Exp $ */
/*
* Copyright (c) 1997, 1999 Eduardo E. Horvath. All rights reserved.
@@ -202,7 +202,8 @@ chain(u_int64_t pentry, char *args, void *ssym, void *esym)
#endif
/* if -D is set then pause in the PROM. */
if (debug > 1) OF_enter();
- OF_chain((void *)RELOC, ((end - (char *)RELOC)+NBPG)%NBPG, entry, args, l);
+ OF_chain((void *)RELOC, ((end - (char *)RELOC)+PAGE_SIZE)%PAGE_SIZE,
+ entry, args, l);
panic("chain");
}
diff --git a/sys/arch/sparc64/stand/ofwboot/elf64_exec.c b/sys/arch/sparc64/stand/ofwboot/elf64_exec.c
index 56ba5a27c2f..0597468f9e4 100644
--- a/sys/arch/sparc64/stand/ofwboot/elf64_exec.c
+++ b/sys/arch/sparc64/stand/ofwboot/elf64_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: elf64_exec.c,v 1.2 2010/08/25 12:53:38 jsing Exp $ */
+/* $OpenBSD: elf64_exec.c,v 1.3 2013/03/21 21:51:01 deraadt Exp $ */
/* $NetBSD: elfXX_exec.c,v 1.2 2001/08/15 20:08:15 eeh Exp $ */
/*
@@ -97,7 +97,7 @@ elf64_exec(int fd, Elf_Ehdr *elf, u_int64_t *entryp, void **ssymp, void **esymp)
align = 4 * MB;
if (phdr.p_filesz < phdr.p_memsz)
phdr.p_memsz = roundup(phdr.p_memsz, 4 * MB);
- phdr.p_memsz = roundup(phdr.p_memsz, NBPG);
+ phdr.p_memsz = roundup(phdr.p_memsz, PAGE_SIZE);
if (OF_claim((void *)(long)phdr.p_vaddr, phdr.p_memsz, align) ==
(void *)-1)
panic("cannot claim memory");
@@ -147,7 +147,7 @@ elf64_exec(int fd, Elf_Ehdr *elf, u_int64_t *entryp, void **ssymp, void **esymp)
/*
* Reserve memory for the symbols.
*/
- if ((addr = OF_claim(0, roundup(size, NBPG), NBPG)) == (void *)-1)
+ if ((addr = OF_claim(0, roundup(size, PAGE_SIZE), PAGE_SIZE)) == (void *)-1)
panic("no space for symbol table");
/*