123264Smckusick /* 229186Smckusick * Copyright (c) 1982, 1986 Regents of the University of California. 323264Smckusick * All rights reserved. The Berkeley software License Agreement 423264Smckusick * specifies the terms and conditions for redistribution. 523264Smckusick * 6*33278Sbostic * @(#)param.h 7.9 (Berkeley) 01/07/88 723264Smckusick */ 89118Ssam 99118Ssam /* 10*33278Sbostic * Machine dependent constants for VAX. 119118Ssam */ 1231162Sbostic #define MACHINE "vax" 1331162Sbostic 14*33278Sbostic #ifndef ENDIAN 15*33278Sbostic #include <machine/endian.h> 16*33278Sbostic #endif 17*33278Sbostic 1832563Sbostic #define CHAR_BIT NBBY 1932563Sbostic #define CHAR_MAX 0x7f 2032563Sbostic #define CHAR_MIN 0x80 21*33278Sbostic #define CLK_TCK 60 /* for times() */ 2232563Sbostic #define INT_MAX 0x7fffffff 2332563Sbostic #define INT_MIN 0x80000000 2432563Sbostic #define LONG_MAX 0x7fffffff 2532563Sbostic #define LONG_MIN 0x80000000 2632563Sbostic #define SCHAR_MAX 0x7f 2732563Sbostic #define SCHAR_MIN 0x80 2832563Sbostic #define SHRT_MAX 0x7fff 2932563Sbostic #define SHRT_MIN 0x8000 3032563Sbostic #define UCHAR_MAX 0xff 3132563Sbostic #define UINT_MAX 0xffffffff 3232563Sbostic #define ULONG_MAX 0xffffffff 3332563Sbostic #define USHRT_MAX 0xffff 3432563Sbostic 3530407Skarels #define NBPG 512 /* bytes/page */ 3630407Skarels #define PGOFSET (NBPG-1) /* byte offset into page */ 3730407Skarels #define PGSHIFT 9 /* LOG2(NBPG) */ 3830407Skarels #define NPTEPG (NBPG/(sizeof (struct pte))) 399118Ssam 40*33278Sbostic #define KERNBASE 0x80000000 /* start of kernel virtual */ 41*33278Sbostic #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 42*33278Sbostic 4330407Skarels #define DEV_BSIZE 512 4430407Skarels #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 4530407Skarels #define BLKDEV_IOSIZE 2048 4630766Skarels #define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ 4730407Skarels 489118Ssam #define CLSIZE 2 499118Ssam #define CLSIZELOG2 1 509118Ssam 5130407Skarels #define SSIZE 4 /* initial stack size/NBPG */ 5230407Skarels #define SINCR 4 /* increment of stack/NBPG */ 539118Ssam 5430407Skarels #define UPAGES 10 /* pages of u-area */ 559118Ssam 569118Ssam /* 579118Ssam * Some macros for units conversion 589118Ssam */ 599118Ssam /* Core clicks (512 bytes) to segments and vice versa */ 609118Ssam #define ctos(x) (x) 619118Ssam #define stoc(x) (x) 629118Ssam 639118Ssam /* Core clicks (512 bytes) to disk blocks */ 649118Ssam #define ctod(x) (x) 659118Ssam #define dtoc(x) (x) 6630766Skarels #define dtob(x) ((x)<<PGSHIFT) 679118Ssam 689118Ssam /* clicks to bytes */ 699118Ssam #define ctob(x) ((x)<<9) 709118Ssam 719118Ssam /* bytes to clicks */ 729118Ssam #define btoc(x) ((((unsigned)(x)+511)>>9)) 739118Ssam 7430407Skarels #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 7530407Skarels ((unsigned)(bytes) >> DEV_BSHIFT) 7630407Skarels #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 7730407Skarels ((unsigned)(db) << DEV_BSHIFT) 7830407Skarels 799118Ssam /* 8030407Skarels * Map a ``block device block'' to a file system block. 8130407Skarels * This should be device dependent, and will be if we 8230407Skarels * add an entry to cdevsw/bdevsw for that purpose. 8330407Skarels * For now though just use DEV_BSIZE. 8430407Skarels */ 8530407Skarels #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 8630407Skarels 8730407Skarels /* 889118Ssam * Macros to decode processor status word. 899118Ssam */ 909118Ssam #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) 919600Ssam #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) 929118Ssam 9324887Skarels #ifdef KERNEL 9424887Skarels #ifndef LOCORE 9524887Skarels int cpuspeed; 9629953Skarels #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } 9724887Skarels #endif 9824887Skarels 9924887Skarels #else KERNEL 1009118Ssam #define DELAY(n) { register int N = (n); while (--N > 0); } 10124887Skarels #endif KERNEL 102