summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/alpha/machdep.c4
-rw-r--r--sys/arch/alpha/include/param.h6
-rw-r--r--sys/compat/osf1/osf1_misc.c6
-rw-r--r--sys/dev/ic/aic7xxx_openbsd.h4
-rw-r--r--sys/dev/pci/bktr/bktr_core.c4
-rw-r--r--sys/kern/kern_exec.c8
-rw-r--r--sys/kern/kern_malloc.c4
-rw-r--r--sys/kern/sysv_shm.c14
-rw-r--r--sys/kern/vfs_bio.c38
-rw-r--r--sys/uvm/uvm_map.c8
-rw-r--r--sys/uvm/uvm_unix.c8
11 files changed, 50 insertions, 54 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c
index 00ed77c1d76..ce9d237b8d8 100644
--- a/sys/arch/alpha/alpha/machdep.c
+++ b/sys/arch/alpha/alpha/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.111 2007/08/25 21:49:05 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.112 2007/09/15 10:10:37 martin Exp $ */
/* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */
/*-
@@ -1493,7 +1493,7 @@ sendsig(catcher, sig, mask, code, type, val)
psp->ps_sigstk.ss_flags |= SS_ONSTACK;
} else
scp = (struct sigcontext *)(alpha_pal_rdusp() - rndfsize);
- if ((u_long)scp <= USRSTACK - ctob(p->p_vmspace->vm_ssize))
+ if ((u_long)scp <= USRSTACK - ptoa(p->p_vmspace->vm_ssize))
(void)uvm_grow(p, (u_long)scp);
#ifdef DEBUG
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
diff --git a/sys/arch/alpha/include/param.h b/sys/arch/alpha/include/param.h
index b4808698759..721367e8939 100644
--- a/sys/arch/alpha/include/param.h
+++ b/sys/arch/alpha/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.32 2007/05/28 21:02:49 thib Exp $ */
+/* $OpenBSD: param.h,v 1.33 2007/09/15 10:10:37 martin Exp $ */
/* $NetBSD: param.h,v 1.30 2000/06/09 16:03:04 thorpej Exp $ */
/*
@@ -108,10 +108,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/compat/osf1/osf1_misc.c b/sys/compat/osf1/osf1_misc.c
index 00894f90375..e97a714e898 100644
--- a/sys/compat/osf1/osf1_misc.c
+++ b/sys/compat/osf1/osf1_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: osf1_misc.c,v 1.17 2004/06/25 16:28:51 deraadt Exp $ */
+/* $OpenBSD: osf1_misc.c,v 1.18 2007/09/15 10:10:37 martin Exp $ */
/* $NetBSD: osf1_misc.c,v 1.55 2000/06/28 15:39:33 mrg Exp $ */
/*
@@ -132,8 +132,8 @@ osf1_sys_set_program_attributes(p, v, retval)
struct osf1_sys_set_program_attributes_args *uap = v;
segsz_t tsize, dsize;
- tsize = btoc(SCARG(uap, tsize));
- dsize = btoc(SCARG(uap, dsize));
+ tsize = atop(SCARG(uap, tsize));
+ dsize = atop(SCARG(uap, dsize));
if (dsize > p->p_rlimit[RLIMIT_DATA].rlim_cur)
return (ENOMEM);
diff --git a/sys/dev/ic/aic7xxx_openbsd.h b/sys/dev/ic/aic7xxx_openbsd.h
index f697ba71116..4c68e918460 100644
--- a/sys/dev/ic/aic7xxx_openbsd.h
+++ b/sys/dev/ic/aic7xxx_openbsd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic7xxx_openbsd.h,v 1.18 2007/05/02 02:20:37 krw Exp $ */
+/* $OpenBSD: aic7xxx_openbsd.h,v 1.19 2007/09/15 10:10:37 martin Exp $ */
/* $NetBSD: aic7xxx_osm.h,v 1.7 2003/11/02 11:07:44 wiz Exp $ */
/*
@@ -122,7 +122,7 @@ typedef struct pci_attach_args * ahc_dev_softc_t;
* multiple of 16 which should align us on even the largest of cacheline
* boundaries.
*/
-#define AHC_NSEG (roundup(btoc(MAXPHYS) + 1, 16))
+#define AHC_NSEG (roundup(atop(MAXPHYS) + 1, 16))
/* This driver supports target mode */
//#define AHC_TARGET_MODE 1
diff --git a/sys/dev/pci/bktr/bktr_core.c b/sys/dev/pci/bktr/bktr_core.c
index 3ffed6e1394..138414d5a5e 100644
--- a/sys/dev/pci/bktr/bktr_core.c
+++ b/sys/dev/pci/bktr/bktr_core.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bktr_core.c,v 1.24 2007/07/25 23:11:52 art Exp $ */
+/* $OpenBSD: bktr_core.c,v 1.25 2007/09/15 10:10:37 martin Exp $ */
/* $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.114 2000/10/31 13:09:56 roger Exp $ */
/*
@@ -1554,7 +1554,7 @@ video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct pro
/* meteor_mem structure for SYNC Capture */
if (geo->frames > 1) temp += PAGE_SIZE;
- temp = btoc(temp);
+ temp = atop(round_page(temp));
if ((int) temp > bktr->alloc_pages
&& bktr->video.addr == 0) {
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index e7c598f460c..f262c99a7bb 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.102 2007/03/15 10:22:30 art Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.103 2007/09/15 10:10:37 martin Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -411,11 +411,11 @@ sys_execve(struct proc *p, void *v, register_t *retval)
vm = p->p_vmspace;
/* Now map address space */
vm->vm_taddr = (char *)pack.ep_taddr;
- vm->vm_tsize = btoc(pack.ep_tsize);
+ vm->vm_tsize = atop(round_page(pack.ep_tsize));
vm->vm_daddr = (char *)pack.ep_daddr;
- vm->vm_dsize = btoc(pack.ep_dsize);
+ vm->vm_dsize = atop(round_page(pack.ep_dsize));
vm->vm_dused = 0;
- vm->vm_ssize = btoc(pack.ep_ssize);
+ vm->vm_ssize = atop(round_page(pack.ep_ssize));
vm->vm_maxsaddr = (char *)pack.ep_maxsaddr;
vm->vm_minsaddr = (char *)pack.ep_minsaddr;
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index d0bdf1bba23..a344160b7ed 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_malloc.c,v 1.72 2007/09/07 10:22:15 art Exp $ */
+/* $OpenBSD: kern_malloc.c,v 1.73 2007/09/15 10:10:37 martin Exp $ */
/* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */
/*
@@ -201,7 +201,7 @@ malloc(unsigned long size, int type, int flags)
allocsize = round_page(size);
else
allocsize = 1 << indx;
- npg = btoc(allocsize);
+ npg = atop(round_page(allocsize));
va = (caddr_t) uvm_km_kmemalloc(kmem_map, NULL,
(vsize_t)ptoa(npg),
((flags & M_NOWAIT) ? UVM_KMF_NOWAIT : 0) |
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index 538f530efaf..9d1c0ccf2ef 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_shm.c,v 1.48 2007/09/07 15:00:20 art Exp $ */
+/* $OpenBSD: sysv_shm.c,v 1.49 2007/09/15 10:10:37 martin Exp $ */
/* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */
/*
@@ -155,7 +155,7 @@ shm_deallocate_segment(struct shmid_ds *shmseg)
size = round_page(shmseg->shm_segsz);
uao_detach(shm_handle->shm_object);
pool_put(&shm_pool, shmseg);
- shm_committed -= btoc(size);
+ shm_committed -= atop(size);
shm_nused--;
}
@@ -400,10 +400,10 @@ shmget_allocate_segment(struct proc *p,
if (shm_nused >= shminfo.shmmni) /* any shmids left? */
return (ENOSPC);
size = round_page(SCARG(uap, size));
- if (shm_committed + btoc(size) > shminfo.shmall)
+ if (shm_committed + atop(size) > shminfo.shmall)
return (ENOMEM);
shm_nused++;
- shm_committed += btoc(size);
+ shm_committed += atop(size);
/*
* If a key has been specified and we had to wait for memory
@@ -417,7 +417,7 @@ shmget_allocate_segment(struct proc *p,
if (shm_find_segment_by_key(key) != -1) {
pool_put(&shm_pool, shmseg);
shm_nused--;
- shm_committed -= btoc(size);
+ shm_committed -= atop(size);
return (EAGAIN);
}
}
@@ -576,8 +576,8 @@ sysctl_sysvshm(int *name, u_int namelen, void *oldp, size_t *oldlenp,
return (error);
/* If new shmmax > shmall, crank shmall */
- if (btoc(round_page(shminfo.shmmax)) > shminfo.shmall)
- shminfo.shmall = btoc(round_page(shminfo.shmmax));
+ if (atop(round_page(shminfo.shmmax)) > shminfo.shmall)
+ shminfo.shmall = atop(round_page(shminfo.shmmax));
return (0);
case KERN_SHMINFO_SHMMIN:
val = shminfo.shmmin;
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index d70e8d577c4..b40113a0844 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_bio.c,v 1.99 2007/08/07 04:32:45 beck Exp $ */
+/* $OpenBSD: vfs_bio.c,v 1.100 2007/09/15 10:10:37 martin Exp $ */
/* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */
/*-
@@ -180,14 +180,14 @@ bremfree(struct buf *bp)
if (dp == &bufqueues[BQUEUES])
panic("bremfree: lost tail");
}
- numfreepages -= btoc(bp->b_bufsize);
+ numfreepages -= atop(bp->b_bufsize);
if (!ISSET(bp->b_flags, B_DELWRI)) {
int qs = bp->b_bufsize;
queue = size2cqueue(&qs);
- numcleanpages -= btoc(bp->b_bufsize);
- bqpages[queue] -= btoc(bp->b_bufsize);
+ numcleanpages -= atop(bp->b_bufsize);
+ bqpages[queue] -= atop(bp->b_bufsize);
} else
- numdirtypages -= btoc(bp->b_bufsize);
+ numdirtypages -= atop(bp->b_bufsize);
TAILQ_REMOVE(dp, bp, b_freelist);
}
@@ -198,7 +198,7 @@ buf_init(struct buf *bp, int size)
splassert(IPL_BIO);
- npages = btoc(size);
+ npages = atop(size);
bzero((char *)bp, sizeof *bp);
bp->b_vnbufs.le_next = NOLIST;
bp->b_freelist.tqe_next = NOLIST;
@@ -274,7 +274,7 @@ buf_get(size_t size)
size = round_page(size);
qs = size;
queue = size2cqueue(&qs);
- npages = btoc(qs);
+ npages = atop(qs);
if (numbufpages + npages > bufpages)
return (NULL);
@@ -323,7 +323,7 @@ buf_put(struct buf *bp)
if (bp->b_data != NULL) {
bremhash(bp);
- numbufpages -= btoc(bp->b_bufsize);
+ numbufpages -= atop(bp->b_bufsize);
uvm_km_free(buf_map, (vaddr_t)bp->b_data, bp->b_bufsize);
}
@@ -365,8 +365,8 @@ bufinit(void)
*/
hicleanpages = bufpages / 2;
locleanpages = hicleanpages / 2;
- if (locleanpages < btoc(2 * MAXBSIZE))
- locleanpages = btoc(2 * MAXBSIZE);
+ if (locleanpages < atop(2 * MAXBSIZE))
+ locleanpages = atop(2 * MAXBSIZE);
if (locleanpages > bufpages / 4)
locleanpages = bufpages / 4;
@@ -782,8 +782,8 @@ brelse(struct buf *bp)
qs = bp->b_bufsize;
queue = size2cqueue(&qs);
- numcleanpages += btoc(bp->b_bufsize);
- bqpages[queue] += btoc(bp->b_bufsize);
+ numcleanpages += atop(bp->b_bufsize);
+ bqpages[queue] += atop(bp->b_bufsize);
if (maxcleanpages < numcleanpages)
maxcleanpages = numcleanpages;
binsheadfree(bp, &bufqueues[queue]);
@@ -793,18 +793,18 @@ brelse(struct buf *bp)
* queue, so that it'll stick around for as long as possible.
*/
int queue, qs;
- numfreepages += btoc(bp->b_bufsize);
+ numfreepages += atop(bp->b_bufsize);
qs = bp->b_bufsize;
queue = size2cqueue(&qs);
if (!ISSET(bp->b_flags, B_DELWRI)) {
- numcleanpages += btoc(bp->b_bufsize);
- bqpages[queue] += btoc(bp->b_bufsize);
+ numcleanpages += atop(bp->b_bufsize);
+ bqpages[queue] += atop(bp->b_bufsize);
if (maxcleanpages < numcleanpages)
maxcleanpages = numcleanpages;
bufq = &bufqueues[queue];
} else {
- numdirtypages += btoc(bp->b_bufsize);
+ numdirtypages += atop(bp->b_bufsize);
bufq = &bufqueues[BQ_DIRTY];
}
if (ISSET(bp->b_flags, B_AGE)) {
@@ -1110,8 +1110,8 @@ buf_daemon(struct proc *p)
buf_countdeps(bp, 0, 0)) {
SET(bp->b_flags, B_DEFERRED);
s = splbio();
- numfreepages += btoc(bp->b_bufsize);
- numdirtypages += btoc(bp->b_bufsize);
+ numfreepages += atop(bp->b_bufsize);
+ numdirtypages += atop(bp->b_bufsize);
binstailfree(bp, &bufqueues[BQ_DIRTY]);
CLR(bp->b_flags, B_BUSY);
continue;
@@ -1237,7 +1237,7 @@ vfs_bufstats(void)
TAILQ_FOREACH(bp, dp, b_freelist) {
counts[bp->b_bufsize/PAGE_SIZE]++;
count++;
- pages += btoc(bp->b_bufsize);
+ pages += atop(bp->b_bufsize);
}
totals[i] = count;
ptotals[i] = pages;
diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c
index d4e055464c1..bc605570b0d 100644
--- a/sys/uvm/uvm_map.c
+++ b/sys/uvm/uvm_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_map.c,v 1.98 2007/09/10 18:49:45 miod Exp $ */
+/* $OpenBSD: uvm_map.c,v 1.99 2007/09/15 10:10:37 martin Exp $ */
/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
/*
@@ -855,7 +855,7 @@ uvm_map_p(struct vm_map *map, vaddr_t *startp, vsize_t size,
uvm_rb_fixup(map, prev_entry);
map->size += size;
if (p && uobj == NULL)
- p->p_vmspace->vm_dused += btoc(size);
+ p->p_vmspace->vm_dused += atop(size);
uvm_tree_sanity(map, "map leave 2");
@@ -922,7 +922,7 @@ step3:
map->size += size;
if (p && uobj == NULL)
- p->p_vmspace->vm_dused += btoc(size);
+ p->p_vmspace->vm_dused += atop(size);
/*
@@ -1437,7 +1437,7 @@ uvm_unmap_remove(struct vm_map *map, vaddr_t start, vaddr_t end,
next = entry->next;
len = entry->end - entry->start;
if (p && entry->object.uvm_obj == NULL)
- p->p_vmspace->vm_dused -= btoc(len);
+ p->p_vmspace->vm_dused -= atop(len);
/*
* unwire before removing addresses from the pmap; otherwise
diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c
index 18adecc2107..1683515fc1b 100644
--- a/sys/uvm/uvm_unix.c
+++ b/sys/uvm/uvm_unix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_unix.c,v 1.29 2007/09/01 15:14:44 martin Exp $ */
+/* $OpenBSD: uvm_unix.c,v 1.30 2007/09/15 10:10:37 martin Exp $ */
/* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */
/*
@@ -144,11 +144,11 @@ uvm_grow(p, sp)
* Really need to check vs limit and increment stack size if ok.
*/
#ifdef MACHINE_STACK_GROWS_UP
- si = btoc(sp - USRSTACK) - vm->vm_ssize;
+ si = atop(sp - USRSTACK) - vm->vm_ssize;
#else
- si = btoc(USRSTACK - sp) - vm->vm_ssize;
+ si = atop(USRSTACK - sp) - vm->vm_ssize;
#endif
- if (vm->vm_ssize + si <= btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur))
+ if (vm->vm_ssize + si <= atop(p->p_rlimit[RLIMIT_STACK].rlim_cur))
vm->vm_ssize += si;
}