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*31162Sbostic * @(#)param.h 7.7 (Berkeley) 05/21/87 723264Smckusick */ 89118Ssam 99118Ssam /* 109118Ssam * Machine dependent constants for vax. 119118Ssam */ 1229953Skarels 13*31162Sbostic #define MACHINE "vax" 14*31162Sbostic 1529953Skarels #ifndef ENDIAN 1629953Skarels /* 1729953Skarels * Definitions for byte order, 1829953Skarels * according to byte significance from low address to high. 1929953Skarels */ 2029953Skarels #define LITTLE 1234 /* least-significant byte first (vax) */ 2129953Skarels #define BIG 4321 /* most-significant byte first */ 2229953Skarels #define PDP 3412 /* LSB first in word, MSW first in long (pdp) */ 2329953Skarels #define ENDIAN LITTLE /* byte order on vax */ 2429953Skarels 2530403Skarels /* 2630403Skarels * Macros for network/external number representation conversion. 2730403Skarels */ 2830403Skarels #if ENDIAN == BIG && !defined(lint) 2930403Skarels #define ntohl(x) (x) 3030403Skarels #define ntohs(x) (x) 3130403Skarels #define htonl(x) (x) 3230403Skarels #define htons(x) (x) 3330403Skarels #else 3431108Skarels unsigned short ntohs(), htons(); 3531108Skarels unsigned long ntohl(), htonl(); 3630403Skarels #endif 3730403Skarels 3830766Skarels #define KERNBASE 0x80000000 /* start of kernel virtual */ 3930766Skarels #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 4030766Skarels 4130407Skarels #define NBPG 512 /* bytes/page */ 4230407Skarels #define PGOFSET (NBPG-1) /* byte offset into page */ 4330407Skarels #define PGSHIFT 9 /* LOG2(NBPG) */ 4430407Skarels #define NPTEPG (NBPG/(sizeof (struct pte))) 459118Ssam 4630407Skarels #define DEV_BSIZE 512 4730407Skarels #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 4830407Skarels #define BLKDEV_IOSIZE 2048 4930766Skarels #define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ 5030407Skarels 519118Ssam #define CLSIZE 2 529118Ssam #define CLSIZELOG2 1 539118Ssam 5430407Skarels #define SSIZE 4 /* initial stack size/NBPG */ 5530407Skarels #define SINCR 4 /* increment of stack/NBPG */ 569118Ssam 5730407Skarels #define UPAGES 10 /* pages of u-area */ 589118Ssam 599118Ssam /* 609118Ssam * Some macros for units conversion 619118Ssam */ 629118Ssam /* Core clicks (512 bytes) to segments and vice versa */ 639118Ssam #define ctos(x) (x) 649118Ssam #define stoc(x) (x) 659118Ssam 669118Ssam /* Core clicks (512 bytes) to disk blocks */ 679118Ssam #define ctod(x) (x) 689118Ssam #define dtoc(x) (x) 6930766Skarels #define dtob(x) ((x)<<PGSHIFT) 709118Ssam 719118Ssam /* clicks to bytes */ 729118Ssam #define ctob(x) ((x)<<9) 739118Ssam 749118Ssam /* bytes to clicks */ 759118Ssam #define btoc(x) ((((unsigned)(x)+511)>>9)) 769118Ssam 7730407Skarels #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 7830407Skarels ((unsigned)(bytes) >> DEV_BSHIFT) 7930407Skarels #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 8030407Skarels ((unsigned)(db) << DEV_BSHIFT) 8130407Skarels 829118Ssam /* 8330407Skarels * Map a ``block device block'' to a file system block. 8430407Skarels * This should be device dependent, and will be if we 8530407Skarels * add an entry to cdevsw/bdevsw for that purpose. 8630407Skarels * For now though just use DEV_BSIZE. 8730407Skarels */ 8830407Skarels #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 8930407Skarels 9030407Skarels /* 919118Ssam * Macros to decode processor status word. 929118Ssam */ 939118Ssam #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) 949600Ssam #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) 959118Ssam 9624887Skarels #ifdef KERNEL 9724887Skarels #ifndef LOCORE 9824887Skarels int cpuspeed; 9929953Skarels #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } 10024887Skarels #endif 10124887Skarels 10224887Skarels #else KERNEL 1039118Ssam #define DELAY(n) { register int N = (n); while (--N > 0); } 10424887Skarels #endif KERNEL 10530403Skarels #endif ENDIAN 106