1: /*
   2:  * Copyright (c) 1986 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)machparam.h	1.4 (2.11BSD GTE) 1998/9/15
   7:  */
   8: 
   9: /*
  10:  * Machine dependent constants for PDP.
  11:  */
  12: #ifndef ENDIAN
  13: /*
  14:  * Definitions for byte order,
  15:  * according to byte significance from low address to high.
  16:  */
  17: #define LITTLE  1234        /* least-significant byte first (vax) */
  18: #define BIG 4321        /* most-significant byte first */
  19: #define PDP 3412        /* LSB first in word, MSW first in long (pdp) */
  20: #define ENDIAN  PDP     /* byte order on pdp */
  21: 
  22: /*
  23:  * Macros for network/external number representation conversion.
  24:  */
  25: #if ENDIAN == BIG && !defined(lint)
  26: #define ntohl(x)    (x)
  27: #define ntohs(x)    (x)
  28: #define htonl(x)    (x)
  29: #define htons(x)    (x)
  30: #else
  31: #include <sys/types.h>
  32: u_short ntohs(), htons();
  33: u_long  ntohl(), htonl();
  34: #endif
  35: 
  36: #define CHAR_BIT    NBBY
  37: #define CHAR_MAX    0x7f
  38: #define CHAR_MIN    0x80
  39: #define CLK_TCK     60          /* for times() */
  40: #define INT_MAX     0x7fff
  41: #define INT_MIN     0x8000
  42: #define LONG_MAX    0x7fffffff
  43: #define LONG_MIN    0x80000000
  44: #define SCHAR_MAX   0x7f
  45: #define SCHAR_MIN   0x80
  46: #define SHRT_MAX    0x7fff
  47: #define SHRT_MIN    0x8000
  48: #define UCHAR_MAX   0xff
  49: #define UINT_MAX    ((unsigned int)0xffff)
  50: #define ULONG_MAX   0x7fffffff
  51: #define USHRT_MAX   ((unsigned short)0xffff)
  52: 
  53: #define NBPG        512     /* bytes/page */
  54: #define PGOFSET     (NBPG-1)    /* byte offset into page */
  55: #define PGSHIFT     9       /* LOG2(NBPG) */
  56: 
  57: #define DEV_BSIZE   1024
  58: #define DEV_BSHIFT  10      /* log2(DEV_BSIZE) */
  59: #define DEV_BMASK   0x3ffL      /* DEV_BSIZE - 1 */
  60: 
  61: #define CLSIZE      2
  62: #define CLSIZELOG2  1
  63: 
  64: #define SSIZE   20          /* initial stack size (*64 bytes) */
  65: #define SINCR   20          /* increment of stack (*64 bytes) */
  66: 
  67: /* machine dependent stuff for core files */
  68: #define TXTRNDSIZ   8192L
  69: #define stacktop(siz)   (0x10000L)
  70: #define stackbas(siz)   (0x10000L-(siz))
  71: 
  72: /*
  73:  * User area: a user structure, followed by a stack for the networking code
  74:  * (running in supervisor space on the PDP-11), followed by the kernel
  75:  * stack.  The numbers for NET_SSIZE and KERN_SSIZE are determined
  76:  * empirically.
  77:  *
  78:  * Note that the SBASE and STOP constants are only used by the assembly code,
  79:  * but are defined here to localize information about the user area's
  80:  * layout (see pdp/genassym.c).  Note also that a networking stack is always
  81:  * allocated even for non-networking systems.  This prevents problems with
  82:  * applications having to be recompiled for networking versus non-networking
  83:  * systems.
  84:  */
  85: #define NET_SSIZE   16  /* size of the network stack (*64) */
  86: #define KERN_SSIZE  32  /* size of the kernel stack (*64) */
  87: #define USIZE       (btoc(sizeof(struct user)) + NET_SSIZE + KERN_SSIZE)
  88: 
  89: #define NET_SBASE   ctob(btoc(sizeof(struct user)))
  90: #define NET_STOP    (NET_SBASE + ctob(NET_SSIZE))
  91: #define KERN_SBASE  NET_STOP
  92: #define KERN_STOP   (KERN_SBASE + ctob(KERN_SSIZE))
  93: 
  94: /*
  95:  * Some macros for units conversion
  96:  */
  97: /* Core clicks (64 bytes) to segments and vice versa */
  98: #define ctos(x) (((x)+127)/128)
  99: #define stoc(x) ((x)*128)
 100: 
 101: /* Core clicks (64 bytes) to disk blocks */
 102: #define ctod(x) (((x)+7)>>3)
 103: 
 104: /* clicks to bytes */
 105: #define ctob(x) ((x)<<6)
 106: 
 107: /* bytes to clicks */
 108: #define btoc(x) ((((unsigned)(x)+63)>>6))
 109: 
 110: /* these should be fixed to use unsigned longs, if we ever get them. */
 111: #define btodb(bytes)        /* calculates (bytes / DEV_BSIZE) */ \
 112:     ((long)(bytes) >> DEV_BSHIFT)
 113: #define dbtob(db)       /* calculates (db * DEV_BSIZE) */ \
 114:     ((long)(db) << DEV_BSHIFT)
 115: 
 116: /* clicks to KB */
 117: #define ctok(x) (((x)>>4)&07777)
 118: 
 119: /*
 120:  * Macros to decode processor status word.
 121:  */
 122: #define SUPVMODE(ps)    (((ps) & PSL_CURMOD) == PSL_CURSUP)
 123: #define USERMODE(ps)    (((ps) & PSL_USERSET) == PSL_USERSET)
 124: #define BASEPRI(ps) (((ps) & PSL_IPL) == 0)
 125: 
 126: #define DELAY(n)    { long N = ((long)(n))<<1; while (--N > 0); }
 127: 
 128: /*
 129:  * Treat ps as byte, to allow restoring value from mfps/movb.
 130:  * (see splfix.*.sed)
 131:  */
 132: #define PS_LOBYTE   ((char *)0177776)
 133: #define splx(ops)   (*PS_LOBYTE = ((char)(ops)))
 134: 
 135: /*
 136:  * high int of a long
 137:  * low int of a long
 138:  */
 139: #define hiint(long) (((int *)&(long))[0])
 140: #define loint(long) (((int *)&(long))[1])
 141: 
 142: /*
 143:  * SUPERADD is used to distinguish a supervisor-mode address from a
 144:  * kernel mode address to insure uniqueness over both address spaces.
 145:  */
 146: #define SUPERADD(add)   ((int)(add)|01)
 147: #define KERNELADD(add)  ((int)(add)&~01)
 148: #define ISSUPERADD(add) ((int)(add)&01)
 149: 
 150: #endif ENDIAN

Defined macros

BASEPRI defined in line 124; used 2 times
BIG defined in line 18; used 5 times
CHAR_BIT defined in line 36; never used
CHAR_MAX defined in line 37; never used
CHAR_MIN defined in line 38; never used
CLK_TCK defined in line 39; used 4 times
CLSIZELOG2 defined in line 62; used 1 times
DEV_BSHIFT defined in line 58; used 9 times
DEV_BSIZE defined in line 57; used 249 times
ENDIAN defined in line 20; used 3 times
INT_MAX defined in line 40; used 3 times
INT_MIN defined in line 41; used 3 times
ISSUPERADD defined in line 148; used 1 times
KERNELADD defined in line 147; used 1 times
KERN_SBASE defined in line 91; used 2 times
KERN_SSIZE defined in line 86; used 2 times
KERN_STOP defined in line 92; used 1 times
LITTLE defined in line 17; never used
LONG_MAX defined in line 42; never used
LONG_MIN defined in line 43; never used
NET_SBASE defined in line 89; used 2 times
NET_SSIZE defined in line 85; used 2 times
NET_STOP defined in line 90; used 2 times
PDP defined in line 19; used 1 times
  • in line 20
PGOFSET defined in line 54; never used
PS_LOBYTE defined in line 132; used 1 times
SCHAR_MAX defined in line 44; never used
SCHAR_MIN defined in line 45; never used
SHRT_MAX defined in line 46; never used
SHRT_MIN defined in line 47; never used
SINCR defined in line 65; used 1 times
SSIZE defined in line 64; used 1 times
SUPERADD defined in line 146; used 3 times
SUPVMODE defined in line 122; used 1 times
TXTRNDSIZ defined in line 68; used 8 times
UCHAR_MAX defined in line 48; never used
UINT_MAX defined in line 49; never used
ULONG_MAX defined in line 50; never used
USHRT_MAX defined in line 51; used 8 times
btoc defined in line 108; used 84 times
ctob defined in line 105; used 115 times
ctok defined in line 117; used 2 times
htons defined in line 29; used 128 times
ntohl defined in line 26; used 139 times
ntohs defined in line 27; used 156 times
splx defined in line 133; used 324 times
stackbas defined in line 70; used 2 times
stacktop defined in line 69; used 2 times

Usage of this include

Last modified: 1998-09-16
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 355
Valid CSS Valid XHTML 1.0 Strict