Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/include/ppc/param.h

Source at commit 1271 created 12 years 8 months ago.
By meklort, Add missing ppc headers
1/*
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1993,1995 NeXT Computer, Inc. All Rights Reserved */
29
30#ifndef_PPC_PARAM_H_
31#define_PPC_PARAM_H_
32
33#include <ppc/_param.h>
34
35/*
36 * Round p (pointer or byte index) up to a correctly-aligned value for all
37 * data types (int, long, ...). The result is unsigned int and must be
38 * cast to any desired pointer type.
39 */
40#defineALIGNBYTES__DARWIN_ALIGNBYTES
41#defineALIGN(p)__DARWIN_ALIGN(p)
42
43#defineNBPG4096/* bytes/page */
44#definePGOFSET(NBPG-1)/* byte offset into page */
45#definePGSHIFT12/* LOG2(NBPG) */
46
47#define NBSEG0x40000000/* bytes/segment (quadrant) */
48#defineSEGOFSET(NBSEG-1)/* byte offset into segment */
49#defineSEGSHIFT30/* LOG2(NBSEG) */
50
51#defineDEV_BSIZE512
52#defineDEV_BSHIFT9/* log2(DEV_BSIZE) */
53#define BLKDEV_IOSIZE2048
54#defineMAXPHYS(128 * 1024)/* max raw I/O transfer size */
55
56#defineSTACK_GROWTH_UP0/* stack grows to lower addresses */
57
58#defineCLSIZE1
59#defineCLSIZELOG20
60
61#define STACKSIZE 4/* pages in kernel stack */
62#defineUPAGES0/* total pages in u-area */
63/* red zone is beyond this */
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#defineMSIZE256/* size of an mbuf */
73#defineMCLBYTES2048/* large enough for ether MTU */
74#defineMCLSHIFT11
75#defineMCLOFSET(MCLBYTES - 1)
76#ifndef NMBCLUSTERS
77#if GATEWAY
78#defineNMBCLUSTERS((1024 * 1024) / MCLBYTES)/* cl map size: 1MB */
79#else
80#defineNMBCLUSTERS((1024 * 1024) / MCLBYTES)
81/* cl map size was 0.5MB when MSIZE was 128, now it's 1MB*/
82#endif
83#endif
84
85/* pages ("clicks") (NBPG bytes) to disk blocks */
86#definectod(x)((x)<<(PGSHIFT-DEV_BSHIFT))
87#definedtoc(x)((x)>>(PGSHIFT-DEV_BSHIFT))
88#definedtob(x)((x)<<DEV_BSHIFT)
89
90/* pages to bytes */
91#definectob(x)((x)<<PGSHIFT)
92
93/* bytes to pages */
94#definebtoc(x)(((unsigned)(x)+(PGOFSET))>>PGSHIFT)
95#ifdef __APPLE__
96#define btodb(bytes, devBlockSize) \
97 ((unsigned)(bytes) / devBlockSize)
98#define dbtob(db, devBlockSize) \
99 ((unsigned)(db) * devBlockSize)
100#else
101#definebtodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
102((unsigned)(bytes) >> DEV_BSHIFT)
103#definedbtob(db)/* calculates (db * DEV_BSIZE) */ \
104((unsigned)(db) << DEV_BSHIFT)
105#endif
106
107/*
108 * Map a ``block device block'' to a file system block.
109 * This should be device dependent, and should use the bsize
110 * field from the disk label.
111 * For now though just use DEV_BSIZE.
112 */
113#definebdbtofsb(bn)((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
114
115/* from machdep/ppc/proc_reg.h */
116#ifdef __BIG_ENDIAN__
117#define ENDIAN_MASK(val,size) (1 << (size-1 - val))
118#else
119#error code not ported to little endian targets yet
120#endif /* __BIG_ENDIAN__ */
121
122#ifndef MASK
123#define MASK(PART)ENDIAN_MASK(PART ## _BIT, 32)
124#endif
125
126#defineMSR_EE_BIT16
127#defineMSR_PR_BIT17
128#define USERMODE(msr) (msr & MASK(MSR_PR) ? TRUE : FALSE)
129#define BASEPRI(msr) (msr & MASK(MSR_EE) ? TRUE : FALSE)
130/* end of from proc_reg.h */
131
132#ifdefined(KERNEL) || defined(STANDALONE)
133#defineDELAY(n) delay(n)
134#else
135#defineDELAY(n){ register int N = (n); while (--N > 0); }
136#endif/* defined(KERNEL) || defined(STANDALONE) */
137
138#defineNPIDS16/* maximum number of PIDs per process */
139#defineNIOPIDS8/* maximum number of IO space PIDs */
140
141#endif/* _PPC_PARAM_H_ */
142

Archive Download this file

Revision: 1271