summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-05-02 10:43:17 +0000
committerphk <phk@FreeBSD.org>1996-05-02 10:43:17 +0000
commit779840c457bb3a546512321e6b47d89829e421ca (patch)
treecb8228f2628c3afe7a8e21ed27769c79832dab3b /sys/kern
parent2476b0058a968684c543c328f819404038e7c419 (diff)
downloadFreeBSD-src-779840c457bb3a546512321e6b47d89829e421ca.zip
FreeBSD-src-779840c457bb3a546512321e6b47d89829e421ca.tar.gz
First pass at cleaning up macros relating to pages, clusters and all that.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/imgact_aout.c13
-rw-r--r--sys/kern/imgact_gzip.c13
-rw-r--r--sys/kern/kern_malloc.c14
-rw-r--r--sys/kern/subr_param.c4
4 files changed, 21 insertions, 23 deletions
diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c
index 9174d32..0455da5 100644
--- a/sys/kern/imgact_aout.c
+++ b/sys/kern/imgact_aout.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: imgact_aout.c,v 1.26 1996/04/08 01:21:57 davidg Exp $
+ * $Id: imgact_aout.c,v 1.27 1996/05/01 02:42:41 bde Exp $
*/
#include <sys/param.h>
@@ -80,14 +80,14 @@ exec_aout_imgact(imgp)
case ZMAGIC:
virtual_offset = 0;
if (a_out->a_text) {
- file_offset = NBPG;
+ file_offset = PAGE_SIZE;
} else {
/* Bill's "screwball mode" */
file_offset = 0;
}
break;
case QMAGIC:
- virtual_offset = NBPG;
+ virtual_offset = PAGE_SIZE;
file_offset = 0;
break;
default:
@@ -95,7 +95,7 @@ exec_aout_imgact(imgp)
switch ((int)(ntohl(a_out->a_magic) & 0xffff)) {
case ZMAGIC:
case QMAGIC:
- virtual_offset = NBPG;
+ virtual_offset = PAGE_SIZE;
file_offset = 0;
break;
default:
@@ -103,7 +103,7 @@ exec_aout_imgact(imgp)
}
}
- bss_size = roundup(a_out->a_bss, NBPG);
+ bss_size = roundup(a_out->a_bss, PAGE_SIZE);
/*
* Check various fields in header for validity/bounds.
@@ -113,8 +113,7 @@ exec_aout_imgact(imgp)
a_out->a_entry >= virtual_offset + a_out->a_text ||
/* text and data size must each be page rounded */
- a_out->a_text % NBPG ||
- a_out->a_data % NBPG)
+ a_out->a_text & PAGE_MASK || a_out->a_data & PAGE_MASK)
return (-1);
/* text + data can't exceed file size */
diff --git a/sys/kern/imgact_gzip.c b/sys/kern/imgact_gzip.c
index 83c1547..5253e68 100644
--- a/sys/kern/imgact_gzip.c
+++ b/sys/kern/imgact_gzip.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: imgact_gzip.c,v 1.20 1996/03/19 15:02:47 bde Exp $
+ * $Id: imgact_gzip.c,v 1.21 1996/05/01 02:42:50 bde Exp $
*
* This module handles execution of a.out files which have been run through
* "gzip". This saves diskspace, but wastes cpu-cycles and VM.
@@ -148,14 +148,14 @@ do_aout_hdr(struct imgact_gzip * gz)
case ZMAGIC:
gz->virtual_offset = 0;
if (gz->a_out.a_text) {
- gz->file_offset = NBPG;
+ gz->file_offset = PAGE_SIZE;
} else {
/* Bill's "screwball mode" */
gz->file_offset = 0;
}
break;
case QMAGIC:
- gz->virtual_offset = NBPG;
+ gz->virtual_offset = PAGE_SIZE;
gz->file_offset = 0;
break;
default:
@@ -163,7 +163,7 @@ do_aout_hdr(struct imgact_gzip * gz)
switch ((int) (ntohl(gz->a_out.a_magic) & 0xffff)) {
case ZMAGIC:
case QMAGIC:
- gz->virtual_offset = NBPG;
+ gz->virtual_offset = PAGE_SIZE;
gz->file_offset = 0;
break;
default:
@@ -172,7 +172,7 @@ do_aout_hdr(struct imgact_gzip * gz)
}
}
- gz->bss_size = roundup(gz->a_out.a_bss, NBPG);
+ gz->bss_size = roundup(gz->a_out.a_bss, PAGE_SIZE);
/*
* Check various fields in header for validity/bounds.
@@ -182,8 +182,7 @@ do_aout_hdr(struct imgact_gzip * gz)
gz->a_out.a_entry >= gz->virtual_offset + gz->a_out.a_text ||
/* text and data size must each be page rounded */
- gz->a_out.a_text % NBPG ||
- gz->a_out.a_data % NBPG) {
+ gz->a_out.a_text & PAGE_MASK || gz->a_out.a_data & PAGE_MASK) {
gz->where = __LINE__;
return (-1);
}
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 033d913..3bd7721 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94
- * $Id: kern_malloc.c,v 1.18 1996/01/29 09:58:34 davidg Exp $
+ * $Id: kern_malloc.c,v 1.19 1996/01/29 11:12:37 davidg Exp $
*/
#include <sys/param.h>
@@ -138,7 +138,7 @@ malloc(size, type, flags)
if (kbp->kb_next == NULL) {
kbp->kb_last = NULL;
if (size > MAXALLOCSAVE)
- allocsize = roundup(size, CLBYTES);
+ allocsize = roundup(size, PAGE_SIZE);
else
allocsize = 1 << indx;
npg = clrnd(btoc(allocsize));
@@ -287,8 +287,8 @@ free(addr, type)
* Check for returns of data that do not point to the
* beginning of the allocation.
*/
- if (size > NBPG * CLSIZE)
- alloc = addrmask[BUCKETINDX(NBPG * CLSIZE)];
+ if (size > PAGE_SIZE)
+ alloc = addrmask[BUCKETINDX(PAGE_SIZE)];
else
alloc = addrmask[kup->ku_indx];
if (((u_long)addr & alloc) != 0)
@@ -377,7 +377,7 @@ kmeminit(dummy)
#if (MAXALLOCSAVE > MINALLOCSIZE * 32768)
ERROR!_kmeminit:_MAXALLOCSAVE_too_big
#endif
-#if (MAXALLOCSAVE < CLBYTES)
+#if (MAXALLOCSAVE < PAGE_SIZE)
ERROR!_kmeminit:_MAXALLOCSAVE_too_small
#endif
npg = (nmbclusters * MCLBYTES + VM_KMEM_SIZE) / PAGE_SIZE;
@@ -389,10 +389,10 @@ kmeminit(dummy)
FALSE);
#ifdef KMEMSTATS
for (indx = 0; indx < MINBUCKET + 16; indx++) {
- if (1 << indx >= CLBYTES)
+ if (1 << indx >= PAGE_SIZE)
bucket[indx].kb_elmpercl = 1;
else
- bucket[indx].kb_elmpercl = CLBYTES / (1 << indx);
+ bucket[indx].kb_elmpercl = PAGE_SIZE / (1 << indx);
bucket[indx].kb_highwat = 5 * bucket[indx].kb_elmpercl;
}
/*
diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c
index 3de8e11..a49c1d0 100644
--- a/sys/kern/subr_param.c
+++ b/sys/kern/subr_param.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)param.c 8.3 (Berkeley) 8/20/94
- * $Id: param.c,v 1.15 1996/03/02 18:23:57 peter Exp $
+ * $Id: param.c,v 1.16 1996/03/11 05:52:50 hsu Exp $
*/
#include "opt_sysvipc.h"
@@ -103,7 +103,7 @@ int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */
*/
#ifdef SYSVSHM
#ifndef SHMMAX
-#define SHMMAX (SHMMAXPGS*NBPG)
+#define SHMMAX (SHMMAXPGS*PAGE_SIZE)
#endif
#ifndef SHMMIN
#define SHMMIN 1
OpenPOWER on IntegriCloud