1*32564Sbostic /* param.h 1.10 87/10/28 */ 225681Ssam 3*32564Sbostic #ifndef ENDIAN 425681Ssam /* 525681Ssam * Machine dependent constants for TAHOE. 625681Ssam */ 731163Sbostic #define MACHINE "tahoe" 831163Sbostic 9*32564Sbostic #define CHAR_BIT NBBY 10*32564Sbostic #define CHAR_MAX 0x7f 11*32564Sbostic #define CHAR_MIN 0x80 12*32564Sbostic #define CLK_TCK UNDEFINED_FOR_NOW 13*32564Sbostic #define INT_MAX 0x7fffffff 14*32564Sbostic #define INT_MIN 0x80000000 15*32564Sbostic #define LONG_MAX 0x7fffffff 16*32564Sbostic #define LONG_MIN 0x80000000 17*32564Sbostic #define SCHAR_MAX 0x7f 18*32564Sbostic #define SCHAR_MIN 0x80 19*32564Sbostic #define SHRT_MAX 0x7fff 20*32564Sbostic #define SHRT_MIN 0x8000 21*32564Sbostic #define UCHAR_MAX 0xff 22*32564Sbostic #define UINT_MAX 0xffffffff 23*32564Sbostic #define ULONG_MAX 0xffffffff 24*32564Sbostic #define USHRT_MAX 0xffff 25*32564Sbostic 2629950Skarels /* 2729950Skarels * Definitions for byte order, 2829950Skarels * according to byte significance from low address to high. 2929950Skarels */ 3029950Skarels #define LITTLE 1234 /* least-significant byte first (vax) */ 3129950Skarels #define BIG 4321 /* most-significant byte first */ 3229950Skarels #define PDP 3412 /* LSB first in word, MSW first in long (pdp) */ 3329950Skarels #define ENDIAN BIG /* byte order on tahoe */ 3429950Skarels 3530402Skarels /* 3630402Skarels * Macros for network/external number representation conversion. 3730402Skarels */ 3830402Skarels #if ENDIAN == BIG && !defined(lint) 3930402Skarels #define ntohl(x) (x) 4030402Skarels #define ntohs(x) (x) 4130402Skarels #define htonl(x) (x) 4230402Skarels #define htons(x) (x) 4330402Skarels #else 4431107Skarels unsigned short ntohs(), htons(); 4531107Skarels unsigned long ntohl(), htonl(); 4630402Skarels #endif 4730402Skarels 4830407Skarels #define NBPG 1024 /* bytes/page */ 4930407Skarels #define PGOFSET (NBPG-1) /* byte offset into page */ 5030407Skarels #define PGSHIFT 10 /* LOG2(NBPG) */ 5130407Skarels #define NPTEPG (NBPG/(sizeof (struct pte))) 5225681Ssam 5330752Skarels #define KERNBASE 0xc0000000 /* start of kernel virtual */ 5430752Skarels #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 5530752Skarels 5630407Skarels #define DEV_BSIZE 1024 5730407Skarels #define DEV_BSHIFT 10 /* log2(DEV_BSIZE) */ 5830407Skarels #define BLKDEV_IOSIZE 1024 /* NBPG for physical controllers */ 5930752Skarels #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 6030407Skarels 6125681Ssam #define CLSIZE 1 6225681Ssam #define CLSIZELOG2 0 6325681Ssam 6430407Skarels #define SSIZE 2 /* initial stack size/NBPG */ 6530407Skarels #define SINCR 2 /* increment of stack/NBPG */ 6630407Skarels #define UPAGES 6 /* pages of u-area (2 stack pages) */ 6725681Ssam 6825681Ssam #define MAXCKEY 255 /* maximal allowed code key */ 6925681Ssam #define MAXDKEY 255 /* maximal allowed data key */ 7025681Ssam #define NCKEY (MAXCKEY+1) /* # code keys, including 0 (reserved) */ 7125681Ssam #define NDKEY (MAXDKEY+1) /* # data keys, including 0 (reserved) */ 7225681Ssam 7325681Ssam /* 7425681Ssam * Some macros for units conversion 7525681Ssam */ 7625681Ssam /* Core clicks (1024 bytes) to segments and vice versa */ 7725681Ssam #define ctos(x) (x) 7825681Ssam #define stoc(x) (x) 7925681Ssam 8025681Ssam /* Core clicks (1024 bytes) to disk blocks */ 8125681Ssam #define ctod(x) (x) 8225681Ssam #define dtoc(x) (x) 8325681Ssam #define dtob(x) ((x)<<PGSHIFT) 8425681Ssam 8525681Ssam /* clicks to bytes */ 8625681Ssam #define ctob(x) ((x)<<PGSHIFT) 8725681Ssam 8825681Ssam /* bytes to clicks */ 8925681Ssam #define btoc(x) ((((unsigned)(x)+NBPG-1) >> PGSHIFT)) 9025681Ssam 9130407Skarels #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 9230407Skarels ((unsigned)(bytes) >> DEV_BSHIFT) 9330407Skarels #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 9430407Skarels ((unsigned)(db) << DEV_BSHIFT) 9530407Skarels 9625681Ssam /* 9730407Skarels * Map a ``block device block'' to a file system block. 9830407Skarels * This should be device dependent, and will be if we 9930407Skarels * add an entry to cdevsw/bdevsw for that purpose. 10030407Skarels * For now though just use DEV_BSIZE. 10130407Skarels */ 10230407Skarels #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 10330407Skarels 10430407Skarels /* 10525681Ssam * Macros to decode processor status word. 10625681Ssam */ 10725681Ssam #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) 10825681Ssam #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) 10925681Ssam 11025681Ssam #define DELAY(n) { register int N = 3*(n); while (--N > 0); } 11129950Skarels #endif 112