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*31108Skarels * @(#)param.h 7.6 (Berkeley) 05/12/87 723264Smckusick */ 89118Ssam 99118Ssam /* 109118Ssam * Machine dependent constants for vax. 119118Ssam */ 1229953Skarels 1329953Skarels #ifndef ENDIAN 1429953Skarels /* 1529953Skarels * Definitions for byte order, 1629953Skarels * according to byte significance from low address to high. 1729953Skarels */ 1829953Skarels #define LITTLE 1234 /* least-significant byte first (vax) */ 1929953Skarels #define BIG 4321 /* most-significant byte first */ 2029953Skarels #define PDP 3412 /* LSB first in word, MSW first in long (pdp) */ 2129953Skarels #define ENDIAN LITTLE /* byte order on vax */ 2229953Skarels 2330403Skarels /* 2430403Skarels * Macros for network/external number representation conversion. 2530403Skarels */ 2630403Skarels #if ENDIAN == BIG && !defined(lint) 2730403Skarels #define ntohl(x) (x) 2830403Skarels #define ntohs(x) (x) 2930403Skarels #define htonl(x) (x) 3030403Skarels #define htons(x) (x) 3130403Skarels #else 32*31108Skarels unsigned short ntohs(), htons(); 33*31108Skarels unsigned long ntohl(), htonl(); 3430403Skarels #endif 3530403Skarels 3630766Skarels #define KERNBASE 0x80000000 /* start of kernel virtual */ 3730766Skarels #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 3830766Skarels 3930407Skarels #define NBPG 512 /* bytes/page */ 4030407Skarels #define PGOFSET (NBPG-1) /* byte offset into page */ 4130407Skarels #define PGSHIFT 9 /* LOG2(NBPG) */ 4230407Skarels #define NPTEPG (NBPG/(sizeof (struct pte))) 439118Ssam 4430407Skarels #define DEV_BSIZE 512 4530407Skarels #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 4630407Skarels #define BLKDEV_IOSIZE 2048 4730766Skarels #define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ 4830407Skarels 499118Ssam #define CLSIZE 2 509118Ssam #define CLSIZELOG2 1 519118Ssam 5230407Skarels #define SSIZE 4 /* initial stack size/NBPG */ 5330407Skarels #define SINCR 4 /* increment of stack/NBPG */ 549118Ssam 5530407Skarels #define UPAGES 10 /* pages of u-area */ 569118Ssam 579118Ssam /* 589118Ssam * Some macros for units conversion 599118Ssam */ 609118Ssam /* Core clicks (512 bytes) to segments and vice versa */ 619118Ssam #define ctos(x) (x) 629118Ssam #define stoc(x) (x) 639118Ssam 649118Ssam /* Core clicks (512 bytes) to disk blocks */ 659118Ssam #define ctod(x) (x) 669118Ssam #define dtoc(x) (x) 6730766Skarels #define dtob(x) ((x)<<PGSHIFT) 689118Ssam 699118Ssam /* clicks to bytes */ 709118Ssam #define ctob(x) ((x)<<9) 719118Ssam 729118Ssam /* bytes to clicks */ 739118Ssam #define btoc(x) ((((unsigned)(x)+511)>>9)) 749118Ssam 7530407Skarels #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 7630407Skarels ((unsigned)(bytes) >> DEV_BSHIFT) 7730407Skarels #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 7830407Skarels ((unsigned)(db) << DEV_BSHIFT) 7930407Skarels 809118Ssam /* 8130407Skarels * Map a ``block device block'' to a file system block. 8230407Skarels * This should be device dependent, and will be if we 8330407Skarels * add an entry to cdevsw/bdevsw for that purpose. 8430407Skarels * For now though just use DEV_BSIZE. 8530407Skarels */ 8630407Skarels #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 8730407Skarels 8830407Skarels /* 899118Ssam * Macros to decode processor status word. 909118Ssam */ 919118Ssam #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) 929600Ssam #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) 939118Ssam 9424887Skarels #ifdef KERNEL 9524887Skarels #ifndef LOCORE 9624887Skarels int cpuspeed; 9729953Skarels #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } 9824887Skarels #endif 9924887Skarels 10024887Skarels #else KERNEL 1019118Ssam #define DELAY(n) { register int N = (n); while (--N > 0); } 10224887Skarels #endif KERNEL 10330403Skarels #endif ENDIAN 104