1 /* 2 * Copyright (c) 1982, 1986 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)param.h 7.3 (Berkeley) 01/16/87 7 */ 8 9 /* 10 * Machine dependent constants for vax. 11 */ 12 13 #ifndef ENDIAN 14 /* 15 * Definitions for byte order, 16 * according to byte significance from low address to high. 17 */ 18 #define LITTLE 1234 /* least-significant byte first (vax) */ 19 #define BIG 4321 /* most-significant byte first */ 20 #define PDP 3412 /* LSB first in word, MSW first in long (pdp) */ 21 #define ENDIAN LITTLE /* byte order on vax */ 22 23 /* 24 * Macros for network/external number representation conversion. 25 */ 26 #if ENDIAN == BIG && !defined(lint) 27 #define ntohl(x) (x) 28 #define ntohs(x) (x) 29 #define htonl(x) (x) 30 #define htons(x) (x) 31 #else 32 u_short ntohs(), htons(); 33 u_long ntohl(), htonl(); 34 #endif 35 36 #define NBPG 512 /* bytes/page */ 37 #define PGOFSET (NBPG-1) /* byte offset into page */ 38 #define PGSHIFT 9 /* LOG2(NBPG) */ 39 40 #define CLSIZE 2 41 #define CLSIZELOG2 1 42 43 #define SSIZE 4 /* initial stack size/NBPG */ 44 #define SINCR 4 /* increment of stack/NBPG */ 45 46 #define UPAGES 10 /* pages of u-area */ 47 48 /* 49 * Some macros for units conversion 50 */ 51 /* Core clicks (512 bytes) to segments and vice versa */ 52 #define ctos(x) (x) 53 #define stoc(x) (x) 54 55 /* Core clicks (512 bytes) to disk blocks */ 56 #define ctod(x) (x) 57 #define dtoc(x) (x) 58 #define dtob(x) ((x)<<9) 59 60 /* clicks to bytes */ 61 #define ctob(x) ((x)<<9) 62 63 /* bytes to clicks */ 64 #define btoc(x) ((((unsigned)(x)+511)>>9)) 65 66 /* 67 * Macros to decode processor status word. 68 */ 69 #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) 70 #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) 71 72 #ifdef KERNEL 73 #ifndef LOCORE 74 int cpuspeed; 75 #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } 76 #endif 77 78 #else KERNEL 79 #define DELAY(n) { register int N = (n); while (--N > 0); } 80 #endif KERNEL 81 #endif ENDIAN 82