rip away illusion of portability in ALIGN
[unix-history] / usr / src / sys / vax / include / param.h
index a279e95..fd04afd 100644 (file)
@@ -1,40 +1,23 @@
-/*
- * Copyright (c) 1982, 1986 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+/*-
+ * Copyright (c) 1982, 1986 The Regents of the University of California.
+ * All rights reserved.
  *
  *
- *     @(#)param.h     7.7 (Berkeley) %G%
- */
-
-/*
- * Machine dependent constants for vax.
+ * %sccs.include.proprietary.c%
+ *
+ *     @(#)param.h     7.21 (Berkeley) %G%
  */
 
  */
 
-#ifndef ENDIAN
 /*
 /*
- * Definitions for byte order,
- * according to byte significance from low address to high.
+ * Machine dependent constants for VAX.
  */
  */
-#define        LITTLE  1234            /* least-significant byte first (vax) */
-#define        BIG     4321            /* most-significant byte first */
-#define        PDP     3412            /* LSB first in word, MSW first in long (pdp) */
-#define        ENDIAN  LITTLE          /* byte order on vax */
+#define        MACHINE "vax"
 
 /*
 
 /*
- * Macros for network/external number representation conversion.
+ * Round p (pointer or byte index) up to a correctly-aligned value for all
+ * data types (int, long, ...).   The result is u_int and must be cast to
+ * any desired pointer type.
  */
  */
-#if ENDIAN == BIG && !defined(lint)
-#define        ntohl(x)        (x)
-#define        ntohs(x)        (x)
-#define        htonl(x)        (x)
-#define        htons(x)        (x)
-#else
-unsigned short ntohs(), htons();
-unsigned long  ntohl(), htonl();
-#endif
-
-#define        KERNBASE        0x80000000      /* start of kernel virtual */
-#define        BTOPKERNBASE    ((u_long)KERNBASE >> PGSHIFT)
+#define        ALIGN(p)        (((u_int)(p) + 3) &~ 3)
 
 #define        KERNBASE        0x80000000      /* start of kernel virtual */
 #define        BTOPKERNBASE    ((u_long)KERNBASE >> PGSHIFT)
 
 #define        KERNBASE        0x80000000      /* start of kernel virtual */
 #define        BTOPKERNBASE    ((u_long)KERNBASE >> PGSHIFT)
@@ -44,6 +27,10 @@ unsigned long        ntohl(), htonl();
 #define        PGSHIFT         9               /* LOG2(NBPG) */
 #define        NPTEPG          (NBPG/(sizeof (struct pte)))
 
 #define        PGSHIFT         9               /* LOG2(NBPG) */
 #define        NPTEPG          (NBPG/(sizeof (struct pte)))
 
+#define        KERNBASE        0x80000000      /* start of kernel virtual */
+#define        KERNTEXTOFF     KERNBASE        /* start of kernel text */
+#define        BTOPKERNBASE    ((u_long)KERNBASE >> PGSHIFT)
+
 #ifndef SECSIZE
 #define        DEV_BSIZE       512
 #define        DEV_BSHIFT      9               /* log2(DEV_BSIZE) */
 #ifndef SECSIZE
 #define        DEV_BSIZE       512
 #define        DEV_BSHIFT      9               /* log2(DEV_BSIZE) */
@@ -64,10 +51,42 @@ unsigned long       ntohl(), htonl();
 #define        CLSIZE          2
 #define        CLSIZELOG2      1
 
 #define        CLSIZE          2
 #define        CLSIZELOG2      1
 
+/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
 #define        SSIZE           4               /* initial stack size/NBPG */
 #define        SINCR           4               /* increment of stack/NBPG */
 
 #define        SSIZE           4               /* initial stack size/NBPG */
 #define        SINCR           4               /* increment of stack/NBPG */
 
-#define        UPAGES          10              /* pages of u-area */
+#define        UPAGES          16              /* pages of u-area */
+
+/*
+ * Constants related to network buffer management.
+ * MCLBYTES must be no larger than CLBYTES (the software page size), and,
+ * on machines that exchange pages of input or output buffers with mbuf
+ * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
+ * of the hardware page size.
+ */
+#define        MSIZE           128             /* size of an mbuf */
+#define        MAPPED_MBUFS                    /* can do scatter-gather I/O */
+#if CLBYTES > 1024
+#define        MCLBYTES        1024
+#define        MCLSHIFT        10
+#define        MCLOFSET        (MCLBYTES - 1)
+#else
+#define        MCLBYTES        CLBYTES
+#define        MCLSHIFT        CLSHIFT
+#define        MCLOFSET        CLOFSET
+#endif
+#ifdef GATEWAY
+#define        NMBCLUSTERS     512             /* map size, max cluster allocation */
+#else
+#define        NMBCLUSTERS     256             /* map size, max cluster allocation */
+#endif
+
+/*
+ * Size of kernel malloc arena in CLBYTES-sized logical pages
+ */ 
+#ifndef NKMEMCLUSTERS
+#define        NKMEMCLUSTERS   (512*1024/CLBYTES)
+#endif
 
 /*
  * Some macros for units conversion
 
 /*
  * Some macros for units conversion
@@ -125,7 +144,6 @@ int cpuspeed;
 #define        DELAY(n)        { register int N = cpuspeed * (n); while (--N > 0); }
 #endif
 
 #define        DELAY(n)        { register int N = cpuspeed * (n); while (--N > 0); }
 #endif
 
-#else KERNEL
+#else
 #define        DELAY(n)        { register int N = (n); while (--N > 0); }
 #define        DELAY(n)        { register int N = (n); while (--N > 0); }
-#endif KERNEL
-#endif ENDIAN
+#endif