1*41058Swilliam /*- 2*41058Swilliam * Copyright (c) 1990 The Regents of the University of California. 3*41058Swilliam * All rights reserved. 4*41058Swilliam * 5*41058Swilliam * This code is derived from software contributed to Berkeley by 6*41058Swilliam * William Jolitz. 7*41058Swilliam * 8*41058Swilliam * %sccs.include.noredist.c% 9*41058Swilliam * 10*41058Swilliam * @(#)param.h 5.1 (Berkeley) 04/24/90 11*41058Swilliam */ 12*41058Swilliam 1340461Sbill /* 1440461Sbill * Machine dependent constants for Intel 386. 1540461Sbill */ 1640461Sbill 1740461Sbill #define MACHINE "i386" 1840461Sbill 1940461Sbill #ifndef BYTE_ORDER 2040461Sbill #include <machine/endian.h> 2140461Sbill #endif 2240461Sbill 2340461Sbill #define NBPG 4096 /* bytes/page */ 2440461Sbill #define PGOFSET (NBPG-1) /* byte offset into page */ 2540461Sbill #define PGSHIFT 12 /* LOG2(NBPG) */ 2640461Sbill #define NPTEPG (NBPG/(sizeof (struct pte))) 2740461Sbill 2840461Sbill #define NBPDR (1024*NBPG) /* bytes/page dir */ 2940461Sbill #define PDROFSET (NBPDR-1) /* byte offset into page dir */ 3040461Sbill #define PDRSHIFT 22 /* LOG2(NBPDR) */ 3140461Sbill 3240461Sbill #define KERNBASE 0xFE000000 /* start of kernel virtual */ 3340461Sbill #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 3440461Sbill 3540461Sbill #define DEV_BSIZE 512 3640461Sbill #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 3740461Sbill #define BLKDEV_IOSIZE 2048 3840461Sbill #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 3940461Sbill 4040461Sbill #define CLSIZE 1 4140461Sbill #define CLSIZELOG2 0 4240461Sbill 4340461Sbill #define SSIZE 1 /* initial stack size/NBPG */ 4440461Sbill #define SINCR 1 /* increment of stack/NBPG */ 4540461Sbill 46*41058Swilliam #define UPAGES 2 /* pages of u-area */ 4740461Sbill 4840461Sbill /* 4940461Sbill * Some macros for units conversion 5040461Sbill */ 5140461Sbill /* Core clicks (4096 bytes) to segments and vice versa */ 5240461Sbill #define ctos(x) (x) 5340461Sbill #define stoc(x) (x) 5440461Sbill 5540461Sbill /* Core clicks (4096 bytes) to disk blocks */ 5640461Sbill #define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT)) 5740461Sbill #define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT)) 5840461Sbill #define dtob(x) ((x)<<DEV_BSHIFT) 5940461Sbill 6040461Sbill /* clicks to bytes */ 6140461Sbill #define ctob(x) ((x)<<PGSHIFT) 6240461Sbill 6340461Sbill /* bytes to clicks */ 6440461Sbill #define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT) 6540461Sbill 6640461Sbill #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 6740461Sbill ((unsigned)(bytes) >> DEV_BSHIFT) 6840461Sbill #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 6940461Sbill ((unsigned)(db) << DEV_BSHIFT) 7040461Sbill 7140461Sbill /* 7240461Sbill * Map a ``block device block'' to a file system block. 7340461Sbill * This should be device dependent, and will be if we 7440461Sbill * add an entry to cdevsw/bdevsw for that purpose. 7540461Sbill * For now though just use DEV_BSIZE. 7640461Sbill */ 7740461Sbill #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 7840461Sbill 7940461Sbill #ifdef KERNEL 8040461Sbill #ifndef LOCORE 8140461Sbill int cpuspeed; 8240461Sbill #endif 8340461Sbill #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } 8440461Sbill 8540461Sbill #else KERNEL 8640461Sbill #define DELAY(n) { register int N = (n); while (--N > 0); } 8740461Sbill #endif KERNEL 88