1 /* param.h 1.6 87/01/16 */ 2 3 /* 4 * Machine dependent constants for TAHOE. 5 */ 6 7 #ifndef ENDIAN 8 /* 9 * Definitions for byte order, 10 * according to byte significance from low address to high. 11 */ 12 #define LITTLE 1234 /* least-significant byte first (vax) */ 13 #define BIG 4321 /* most-significant byte first */ 14 #define PDP 3412 /* LSB first in word, MSW first in long (pdp) */ 15 #define ENDIAN BIG /* byte order on tahoe */ 16 17 /* 18 * Macros for network/external number representation conversion. 19 */ 20 #if ENDIAN == BIG && !defined(lint) 21 #define ntohl(x) (x) 22 #define ntohs(x) (x) 23 #define htonl(x) (x) 24 #define htons(x) (x) 25 #else 26 u_short ntohs(), htons(); 27 u_long ntohl(), htonl(); 28 #endif 29 30 #define NBPG 1024 /* bytes/page */ 31 #define PGOFSET (NBPG-1) /* byte offset into page */ 32 #define PGSHIFT 10 /* LOG2(NBPG) */ 33 #define NPTEPG (NBPG/(sizeof (struct pte))) 34 35 #define DEV_BSIZE 1024 36 #define DEV_BSHIFT 10 /* log2(DEV_BSIZE) */ 37 #define BLKDEV_IOSIZE 1024 /* NBPG for physical controllers */ 38 39 #define CLSIZE 1 40 #define CLSIZELOG2 0 41 42 #define SSIZE 2 /* initial stack size/NBPG */ 43 #define SINCR 2 /* increment of stack/NBPG */ 44 #define UPAGES 6 /* pages of u-area (2 stack pages) */ 45 46 #define MAXCKEY 255 /* maximal allowed code key */ 47 #define MAXDKEY 255 /* maximal allowed data key */ 48 #define NCKEY (MAXCKEY+1) /* # code keys, including 0 (reserved) */ 49 #define NDKEY (MAXDKEY+1) /* # data keys, including 0 (reserved) */ 50 51 /* 52 * Some macros for units conversion 53 */ 54 /* Core clicks (1024 bytes) to segments and vice versa */ 55 #define ctos(x) (x) 56 #define stoc(x) (x) 57 58 /* Core clicks (1024 bytes) to disk blocks */ 59 #define ctod(x) (x) 60 #define dtoc(x) (x) 61 #define dtob(x) ((x)<<PGSHIFT) 62 63 /* clicks to bytes */ 64 #define ctob(x) ((x)<<PGSHIFT) 65 66 /* bytes to clicks */ 67 #define btoc(x) ((((unsigned)(x)+NBPG-1) >> PGSHIFT)) 68 69 #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 70 ((unsigned)(bytes) >> DEV_BSHIFT) 71 #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 72 ((unsigned)(db) << DEV_BSHIFT) 73 74 /* 75 * Map a ``block device block'' to a file system block. 76 * This should be device dependent, and will be if we 77 * add an entry to cdevsw/bdevsw for that purpose. 78 * For now though just use DEV_BSIZE. 79 */ 80 #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 81 82 /* 83 * Macros to decode processor status word. 84 */ 85 #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) 86 #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) 87 88 #define DELAY(n) { register int N = 3*(n); while (--N > 0); } 89 #endif 90