Integrate cctools-809 changes
[striptease.git] / include / mach / machine.h
blob0bca89b33b8c7621781eb7fda23fd74be9040635
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
23 /*
24 * Mach Operating System
25 * Copyright (c) 1989 Carnegie-Mellon University
26 * Copyright (c) 1988 Carnegie-Mellon University
27 * Copyright (c) 1987 Carnegie-Mellon University
28 * All rights reserved. The CMU software License Agreement specifies
29 * the terms and conditions for use and redistribution.
32 * HISTORY
33 * Revision 1.1.1.1 1997/09/03 20:53:37 roland
34 * Initial checkin of SGS release 244
36 * 2 July 1992 Mac Gillon at NeXT
37 * Changed HPPA subtypes to follow our practice.
39 * 11 September 1992 David E. Bohman at NeXT
40 * Added CPU_SUBTYPE_486SX to the i386 family.
42 * 16 July 1992 David E. Bohman at NeXT
43 * Added CPU_SUBTYPE_586 to the i386 family.
45 * 17-Dec-91 Peter King (king) at NeXT
46 * Added support for the XXX_ALL subtypes. These are used to
47 * tag object files that can run on any implementation of a
48 * particular family.
50 * 1-Mar-90 John Seamons (jks) at NeXT
51 * Redefined cpu_type and cpu_subtype definitions to indicate processor
52 * architecture instead of product types for the MC680x0.
54 * Revision 2.15 89/10/11 14:39:56 dlb
55 * Removed should_exit - replaced by action thread.
56 * [89/01/25 dlb]
58 * Revision 2.14 89/07/14 17:21:39 rvb
59 * Added CPU types and subtypes for MC68030, MC68040, MC88000,
60 * HPPA, ARM and Sun4-SPARC.
61 * [89/07/13 mrt]
63 * Revision 2.12 89/05/30 10:38:58 rvb
64 * Add R2000 machine types.
65 * [89/05/30 08:28:53 rvb]
67 * Revision 2.11 89/04/18 16:43:32 mwyoung
68 * Use <machine/vm_types.h> rather than <vm/vm_param.h> to get
69 * VM types. Remove old history... none of it was insightful.
71 * The variable declarations should be moved elsewhere.
72 * [89/01/24 mwyoung]
76 * Machine independent machine abstraction.
77 * Copyright (C) 1986, Avadis Tevanian, Jr.
80 #ifndef _MACH_MACHINE_H_
81 #define _MACH_MACHINE_H_
83 #import <mach/machine/vm_types.h>
84 #import <mach/boolean.h>
87 * For each host, there is a maximum possible number of
88 * cpus that may be available in the system. This is the
89 * compile-time constant NCPUS, which is defined in cpus.h.
91 * In addition, there is a machine_slot specifier for each
92 * possible cpu in the system.
95 struct machine_info {
96 int major_version; /* kernel major version id */
97 int minor_version; /* kernel minor version id */
98 int max_cpus; /* max number of cpus compiled */
99 int avail_cpus; /* number actually available */
100 vm_size_t memory_size; /* size of memory in bytes */
103 typedef struct machine_info *machine_info_t;
104 typedef struct machine_info machine_info_data_t; /* bogus */
106 typedef int cpu_type_t;
107 typedef int cpu_subtype_t;
108 typedef integer_t cpu_threadtype_t;
110 #define CPU_STATE_MAX 3
112 #define CPU_STATE_USER 0
113 #define CPU_STATE_SYSTEM 1
114 #define CPU_STATE_IDLE 2
116 struct machine_slot {
117 boolean_t is_cpu; /* is there a cpu in this slot? */
118 cpu_type_t cpu_type; /* type of cpu */
119 cpu_subtype_t cpu_subtype; /* subtype of cpu */
120 volatile boolean_t running; /* is cpu running */
121 long cpu_ticks[CPU_STATE_MAX];
122 int clock_freq; /* clock interrupt frequency */
125 typedef struct machine_slot *machine_slot_t;
126 typedef struct machine_slot machine_slot_data_t; /* bogus */
128 #ifdef KERNEL
129 extern struct machine_info machine_info;
130 extern struct machine_slot machine_slot[];
132 extern vm_offset_t interrupt_stack[];
133 #endif /* KERNEL */
136 * Machine types known by all.
139 #define CPU_TYPE_ANY ((cpu_type_t) -1)
141 #define CPU_TYPE_VAX ((cpu_type_t) 1)
142 #define CPU_TYPE_ROMP ((cpu_type_t) 2)
143 #define CPU_TYPE_NS32032 ((cpu_type_t) 4)
144 #define CPU_TYPE_NS32332 ((cpu_type_t) 5)
145 #define CPU_TYPE_MC680x0 ((cpu_type_t) 6)
146 #define CPU_TYPE_I386 ((cpu_type_t) 7)
147 #define CPU_TYPE_X86_64 ((cpu_type_t) (CPU_TYPE_I386 | CPU_ARCH_ABI64))
148 #define CPU_TYPE_MIPS ((cpu_type_t) 8)
149 #define CPU_TYPE_NS32532 ((cpu_type_t) 9)
150 #define CPU_TYPE_HPPA ((cpu_type_t) 11)
151 #define CPU_TYPE_ARM ((cpu_type_t) 12)
152 #define CPU_TYPE_MC88000 ((cpu_type_t) 13)
153 #define CPU_TYPE_SPARC ((cpu_type_t) 14)
154 #define CPU_TYPE_I860 ((cpu_type_t) 15) // big-endian
155 #define CPU_TYPE_I860_LITTLE ((cpu_type_t) 16) // little-endian
156 #define CPU_TYPE_RS6000 ((cpu_type_t) 17)
157 #define CPU_TYPE_MC98000 ((cpu_type_t) 18)
158 #define CPU_TYPE_POWERPC ((cpu_type_t) 18)
159 #define CPU_ARCH_ABI64 0x1000000
160 #define CPU_TYPE_POWERPC64 ((cpu_type_t)(CPU_TYPE_POWERPC | CPU_ARCH_ABI64))
161 #define CPU_TYPE_VEO ((cpu_type_t) 255)
164 * Machine subtypes (these are defined here, instead of in a machine
165 * dependent directory, so that any program can get all definitions
166 * regardless of where is it compiled).
170 * Capability bits used in the definition of cpu_subtype.
172 #define CPU_SUBTYPE_MASK 0xff000000 /* mask for feature flags */
173 #define CPU_SUBTYPE_LIB64 0x80000000 /* 64 bit libraries */
177 * Object files that are hand-crafted to run on any
178 * implementation of an architecture are tagged with
179 * CPU_SUBTYPE_MULTIPLE. This functions essentially the same as
180 * the "ALL" subtype of an architecture except that it allows us
181 * to easily find object files that may need to be modified
182 * whenever a new implementation of an architecture comes out.
184 * It is the responsibility of the implementor to make sure the
185 * software handles unsupported implementations elegantly.
187 #define CPU_SUBTYPE_MULTIPLE ((cpu_subtype_t) -1)
191 * VAX subtypes (these do *not* necessary conform to the actual cpu
192 * ID assigned by DEC available via the SID register).
195 #define CPU_SUBTYPE_VAX_ALL ((cpu_subtype_t) 0)
196 #define CPU_SUBTYPE_VAX780 ((cpu_subtype_t) 1)
197 #define CPU_SUBTYPE_VAX785 ((cpu_subtype_t) 2)
198 #define CPU_SUBTYPE_VAX750 ((cpu_subtype_t) 3)
199 #define CPU_SUBTYPE_VAX730 ((cpu_subtype_t) 4)
200 #define CPU_SUBTYPE_UVAXI ((cpu_subtype_t) 5)
201 #define CPU_SUBTYPE_UVAXII ((cpu_subtype_t) 6)
202 #define CPU_SUBTYPE_VAX8200 ((cpu_subtype_t) 7)
203 #define CPU_SUBTYPE_VAX8500 ((cpu_subtype_t) 8)
204 #define CPU_SUBTYPE_VAX8600 ((cpu_subtype_t) 9)
205 #define CPU_SUBTYPE_VAX8650 ((cpu_subtype_t) 10)
206 #define CPU_SUBTYPE_VAX8800 ((cpu_subtype_t) 11)
207 #define CPU_SUBTYPE_UVAXIII ((cpu_subtype_t) 12)
210 * ROMP subtypes.
213 #define CPU_SUBTYPE_RT_ALL ((cpu_subtype_t) 0)
214 #define CPU_SUBTYPE_RT_PC ((cpu_subtype_t) 1)
215 #define CPU_SUBTYPE_RT_APC ((cpu_subtype_t) 2)
216 #define CPU_SUBTYPE_RT_135 ((cpu_subtype_t) 3)
219 * 32032/32332/32532 subtypes.
222 #define CPU_SUBTYPE_MMAX_ALL ((cpu_subtype_t) 0)
223 #define CPU_SUBTYPE_MMAX_DPC ((cpu_subtype_t) 1) /* 032 CPU */
224 #define CPU_SUBTYPE_SQT ((cpu_subtype_t) 2)
225 #define CPU_SUBTYPE_MMAX_APC_FPU ((cpu_subtype_t) 3) /* 32081 FPU */
226 #define CPU_SUBTYPE_MMAX_APC_FPA ((cpu_subtype_t) 4) /* Weitek FPA */
227 #define CPU_SUBTYPE_MMAX_XPC ((cpu_subtype_t) 5) /* 532 CPU */
230 * I386 subtypes.
233 #define CPU_SUBTYPE_I386_ALL ((cpu_subtype_t) 3)
234 #define CPU_SUBTYPE_X86_64_ALL CPU_SUBTYPE_I386_ALL
235 #define CPU_SUBTYPE_386 ((cpu_subtype_t) 3)
236 #define CPU_SUBTYPE_486 ((cpu_subtype_t) 4)
237 #define CPU_SUBTYPE_486SX ((cpu_subtype_t) 4 + 128)
238 #define CPU_SUBTYPE_586 ((cpu_subtype_t) 5)
239 #define CPU_SUBTYPE_INTEL(f, m) ((cpu_subtype_t) (f) + ((m) << 4))
240 #define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0)
241 #define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1)
242 #define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3)
243 #define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5)
244 #define CPU_SUBTYPE_PENTIUM_4 CPU_SUBTYPE_INTEL(10, 0)
246 #define CPU_SUBTYPE_INTEL_FAMILY(x) ((x) & 15)
247 #define CPU_SUBTYPE_INTEL_FAMILY_MAX 15
249 #define CPU_SUBTYPE_INTEL_MODEL(x) ((x) >> 4)
250 #define CPU_SUBTYPE_INTEL_MODEL_ALL 0
254 * Mips subtypes.
257 #define CPU_SUBTYPE_MIPS_ALL ((cpu_subtype_t) 0)
258 #define CPU_SUBTYPE_MIPS_R2300 ((cpu_subtype_t) 1)
259 #define CPU_SUBTYPE_MIPS_R2600 ((cpu_subtype_t) 2)
260 #define CPU_SUBTYPE_MIPS_R2800 ((cpu_subtype_t) 3)
261 #define CPU_SUBTYPE_MIPS_R2000a ((cpu_subtype_t) 4)
264 * 680x0 subtypes
266 * The subtype definitions here are unusual for historical reasons.
267 * NeXT used to consider 68030 code as generic 68000 code. For
268 * backwards compatability:
270 * CPU_SUBTYPE_MC68030 symbol has been preserved for source code
271 * compatability.
273 * CPU_SUBTYPE_MC680x0_ALL has been defined to be the same
274 * subtype as CPU_SUBTYPE_MC68030 for binary comatability.
276 * CPU_SUBTYPE_MC68030_ONLY has been added to allow new object
277 * files to be tagged as containing 68030-specific instructions.
280 #define CPU_SUBTYPE_MC680x0_ALL ((cpu_subtype_t) 1)
281 #define CPU_SUBTYPE_MC68030 ((cpu_subtype_t) 1) /* compat */
282 #define CPU_SUBTYPE_MC68040 ((cpu_subtype_t) 2)
283 #define CPU_SUBTYPE_MC68030_ONLY ((cpu_subtype_t) 3)
286 * HPPA subtypes for Hewlett-Packard HP-PA family of
287 * risc processors. Port by NeXT to 700 series.
290 #define CPU_SUBTYPE_HPPA_ALL ((cpu_subtype_t) 0)
291 #define CPU_SUBTYPE_HPPA_7100 ((cpu_subtype_t) 0) /* compat */
292 #define CPU_SUBTYPE_HPPA_7100LC ((cpu_subtype_t) 1)
295 * Acorn subtypes - Acorn Risc Machine port done by
296 * Olivetti System Software Laboratory
299 #define CPU_SUBTYPE_ARM_ALL ((cpu_subtype_t) 0)
300 #define CPU_SUBTYPE_ARM_A500_ARCH ((cpu_subtype_t) 1)
301 #define CPU_SUBTYPE_ARM_A500 ((cpu_subtype_t) 2)
302 #define CPU_SUBTYPE_ARM_A440 ((cpu_subtype_t) 3)
303 #define CPU_SUBTYPE_ARM_M4 ((cpu_subtype_t) 4)
304 #define CPU_SUBTYPE_ARM_V4T ((cpu_subtype_t) 5)
305 #define CPU_SUBTYPE_ARM_V6 ((cpu_subtype_t) 6)
306 #define CPU_SUBTYPE_ARM_V5TEJ ((cpu_subtype_t) 7)
307 #define CPU_SUBTYPE_ARM_XSCALE ((cpu_subtype_t) 8)
308 #define CPU_SUBTYPE_ARM_V7 ((cpu_subtype_t) 9)
309 #define CPU_SUBTYPE_ARM_V7F ((cpu_subtype_t) 10) /* Cortex A9 */
310 #define CPU_SUBTYPE_ARM_V7K ((cpu_subtype_t) 12)
313 * MC88000 subtypes
315 #define CPU_SUBTYPE_MC88000_ALL ((cpu_subtype_t) 0)
316 #define CPU_SUBTYPE_MMAX_JPC ((cpu_subtype_t) 1)
317 #define CPU_SUBTYPE_MC88100 ((cpu_subtype_t) 1)
318 #define CPU_SUBTYPE_MC88110 ((cpu_subtype_t) 2)
321 * MC98000 (PowerPC) subtypes
323 #define CPU_SUBTYPE_MC98000_ALL ((cpu_subtype_t) 0)
324 #define CPU_SUBTYPE_MC98601 ((cpu_subtype_t) 1)
327 * I860 subtypes
329 #define CPU_SUBTYPE_I860_ALL ((cpu_subtype_t) 0)
330 #define CPU_SUBTYPE_I860_860 ((cpu_subtype_t) 1)
333 * I860 subtypes for NeXT-internal backwards compatability.
334 * These constants will be going away. DO NOT USE THEM!!!
336 #define CPU_SUBTYPE_LITTLE_ENDIAN ((cpu_subtype_t) 0)
337 #define CPU_SUBTYPE_BIG_ENDIAN ((cpu_subtype_t) 1)
340 * I860_LITTLE subtypes
342 #define CPU_SUBTYPE_I860_LITTLE_ALL ((cpu_subtype_t) 0)
343 #define CPU_SUBTYPE_I860_LITTLE ((cpu_subtype_t) 1)
346 * RS6000 subtypes
348 #define CPU_SUBTYPE_RS6000_ALL ((cpu_subtype_t) 0)
349 #define CPU_SUBTYPE_RS6000 ((cpu_subtype_t) 1)
352 * Sun4 subtypes - port done at CMU
354 #define CPU_SUBTYPE_SUN4_ALL ((cpu_subtype_t) 0)
355 #define CPU_SUBTYPE_SUN4_260 ((cpu_subtype_t) 1)
356 #define CPU_SUBTYPE_SUN4_110 ((cpu_subtype_t) 2)
358 #define CPU_SUBTYPE_SPARC_ALL ((cpu_subtype_t) 0)
361 * PowerPC subtypes
363 #define CPU_SUBTYPE_POWERPC_ALL ((cpu_subtype_t) 0)
364 #define CPU_SUBTYPE_POWERPC_601 ((cpu_subtype_t) 1)
365 #define CPU_SUBTYPE_POWERPC_602 ((cpu_subtype_t) 2)
366 #define CPU_SUBTYPE_POWERPC_603 ((cpu_subtype_t) 3)
367 #define CPU_SUBTYPE_POWERPC_603e ((cpu_subtype_t) 4)
368 #define CPU_SUBTYPE_POWERPC_603ev ((cpu_subtype_t) 5)
369 #define CPU_SUBTYPE_POWERPC_604 ((cpu_subtype_t) 6)
370 #define CPU_SUBTYPE_POWERPC_604e ((cpu_subtype_t) 7)
371 #define CPU_SUBTYPE_POWERPC_620 ((cpu_subtype_t) 8)
372 #define CPU_SUBTYPE_POWERPC_750 ((cpu_subtype_t) 9)
373 #define CPU_SUBTYPE_POWERPC_7400 ((cpu_subtype_t) 10)
374 #define CPU_SUBTYPE_POWERPC_7450 ((cpu_subtype_t) 11)
375 #define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100)
378 * VEO subtypes
379 * Note: the CPU_SUBTYPE_VEO_ALL will likely change over time to be defined as
380 * one of the specific subtypes.
382 #define CPU_SUBTYPE_VEO_1 ((cpu_subtype_t) 1)
383 #define CPU_SUBTYPE_VEO_2 ((cpu_subtype_t) 2)
384 #define CPU_SUBTYPE_VEO_3 ((cpu_subtype_t) 3)
385 #define CPU_SUBTYPE_VEO_4 ((cpu_subtype_t) 4)
386 #define CPU_SUBTYPE_VEO_ALL CPU_SUBTYPE_VEO_2
388 #endif /* _MACH_MACHINE_H_ */