|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: ! 25: /* Copyright (c) 1993,1995 NeXT Computer, Inc. All Rights Reserved */ ! 26: /*- ! 27: * Copyright (c) 1990, 1993 ! 28: * The Regents of the University of California. All rights reserved. ! 29: * ! 30: * The NEXTSTEP Software License Agreement specifies the terms ! 31: * and conditions for redistribution. ! 32: * ! 33: * @(#)param.h 8.1 (Berkeley) 6/11/93 ! 34: */ ! 35: ! 36: /* ! 37: * Machine dependent constants for Intel 386. ! 38: */ ! 39: ! 40: #ifndef _I386_PARAM_H_ ! 41: #define _I386_PARAM_H_ ! 42: ! 43: /* ! 44: * Round p (pointer or byte index) up to a correctly-aligned value for all ! 45: * data types (int, long, ...). The result is u_int and must be cast to ! 46: * any desired pointer type. ! 47: */ ! 48: #define ALIGNBYTES 3 ! 49: #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES) ! 50: ! 51: #define NBPG 8192 /* bytes/page */ ! 52: #define PGOFSET (NBPG-1) /* byte offset into page */ ! 53: #define PGSHIFT 13 /* LOG2(NBPG) */ ! 54: ! 55: #define DEV_BSIZE 512 ! 56: #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ ! 57: #define BLKDEV_IOSIZE 2048 ! 58: #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ ! 59: ! 60: #define STACK_GROWS_UP 0 /* stack grows to lower addresses */ ! 61: ! 62: #define CLSIZE 1 ! 63: #define CLSIZELOG2 0 ! 64: ! 65: /* ! 66: * Constants related to network buffer management. ! 67: * MCLBYTES must be no larger than CLBYTES (the software page size), and, ! 68: * on machines that exchange pages of input or output buffers with mbuf ! 69: * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple ! 70: * of the hardware page size. ! 71: */ ! 72: #define MSIZE 128 /* size of an mbuf */ ! 73: #define MCLBYTES 2048 /* large enough for ether MTU */ ! 74: #define MCLSHIFT 11 ! 75: #define MCLOFSET (MCLBYTES - 1) ! 76: #ifndef NMBCLUSTERS ! 77: #ifdef GATEWAY ! 78: #define NMBCLUSTERS ((1024 * 1024) / MCLBYTES) /* cl map size: 1MB */ ! 79: #else ! 80: #define NMBCLUSTERS ((1024 * 512) / MCLBYTES) /* cl map size: 0.5MB */ ! 81: #endif ! 82: #endif ! 83: ! 84: /* ! 85: * Some macros for units conversion ! 86: */ ! 87: /* Core clicks (NeXT_page_size bytes) to segments and vice versa */ ! 88: #define ctos(x) (x) ! 89: #define stoc(x) (x) ! 90: ! 91: /* Core clicks (4096 bytes) to disk blocks */ ! 92: #define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT)) ! 93: #define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT)) ! 94: #define dtob(x) ((x)<<DEV_BSHIFT) ! 95: ! 96: /* clicks to bytes */ ! 97: #define ctob(x) ((x)<<PGSHIFT) ! 98: ! 99: /* bytes to clicks */ ! 100: #define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT) ! 101: ! 102: #ifdef __APPLE__ ! 103: #define btodb(bytes, devBlockSize) \ ! 104: ((unsigned)(bytes) / devBlockSize) ! 105: #define dbtob(db, devBlockSize) \ ! 106: ((unsigned)(db) * devBlockSize) ! 107: #else ! 108: #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ ! 109: ((unsigned)(bytes) >> DEV_BSHIFT) ! 110: #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ ! 111: ((unsigned)(db) << DEV_BSHIFT) ! 112: #endif ! 113: ! 114: /* ! 115: * Map a ``block device block'' to a file system block. ! 116: * This should be device dependent, and will be if we ! 117: * add an entry to cdevsw/bdevsw for that purpose. ! 118: * For now though just use DEV_BSIZE. ! 119: */ ! 120: #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) ! 121: ! 122: /* ! 123: * Macros to decode (and encode) processor status word. ! 124: */ ! 125: #define STATUS_WORD(rpl, ipl) (((ipl) << 8) | (rpl)) ! 126: #define USERMODE(x) (((x) & 3) == 3) ! 127: #define BASEPRI(x) (((x) & (255 << 8)) == 0) ! 128: ! 129: #ifndef __ASSEMBLER__ ! 130: /* ! 131: * Pull in our definition of simple_lock_data_t. ! 132: */ ! 133: #import <mach/machine/simple_lock.h> ! 134: ! 135: #endif /* __ASSEMBLER__ */ ! 136: ! 137: #if defined(KERNEL) || defined(STANDALONE) ! 138: #define DELAY(n) us_spin(n) ! 139: ! 140: #else /* defined(KERNEL) || defined(STANDALONE) */ ! 141: #define DELAY(n) { register int N = (n); while (--N > 0); } ! 142: #endif /* defined(KERNEL) || defined(STANDALONE) */ ! 143: ! 144: #endif /* _I386_PARAM_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.