machine.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007-2016 Apple, Inc. All rights reserved.
3  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4  *
5  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6  *
7  * This file contains Original Code and/or Modifications of Original Code
8  * as defined in and that are subject to the Apple Public Source License
9  * Version 2.0 (the 'License'). You may not use this file except in
10  * compliance with the License. The rights granted to you under the License
11  * may not be used to create, or enable the creation or redistribution of,
12  * unlawful or unlicensed copies of an Apple operating system, or to
13  * circumvent, violate, or enable the circumvention or violation of, any
14  * terms of an Apple operating system software license agreement.
15  *
16  * Please obtain a copy of the License at
17  * http://www.opensource.apple.com/apsl/ and read it before using this file.
18  *
19  * The Original Code and all software distributed under the License are
20  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
21  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
22  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
24  * Please see the License for the specific language governing rights and
25  * limitations under the License.
26  *
27  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28  */
29 /*
30  * Mach Operating System
31  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
32  * All Rights Reserved.
33  *
34  * Permission to use, copy, modify and distribute this software and its
35  * documentation is hereby granted, provided that both the copyright
36  * notice and this permission notice appear in all copies of the
37  * software, derivative works or modified versions, and any portions
38  * thereof, and that both notices appear in supporting documentation.
39  *
40  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
41  * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
42  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
43  *
44  * Carnegie Mellon requests users of this software to return to
45  *
46  * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
47  * School of Computer Science
48  * Carnegie Mellon University
49  * Pittsburgh PA 15213-3890
50  *
51  * any improvements or extensions that they make and grant Carnegie Mellon
52  * the rights to redistribute these changes.
53  */
54 /* File: machine.h
55  * Author: Avadis Tevanian, Jr.
56  * Date: 1986
57  *
58  * Machine independent machine abstraction.
59  */
60 
61 #ifndef _MACH_MACHINE_H_
62 #define _MACH_MACHINE_H_
63 
64 #ifndef __ASSEMBLER__
65 
66 #include <stdint.h>
67 
69 
73 
74 #define CPU_STATE_MAX 4
75 
76 #define CPU_STATE_USER 0
77 #define CPU_STATE_SYSTEM 1
78 #define CPU_STATE_IDLE 2
79 #define CPU_STATE_NICE 3
80 
81 
82 /*
83  * Capability bits used in the definition of cpu_type.
84  */
85 #define CPU_ARCH_MASK 0xff000000 /* mask for architecture bits */
86 #define CPU_ARCH_ABI64 0x01000000 /* 64 bit ABI */
87 
88 /*
89  * Machine types known by all.
90  */
91 
92 #define CPU_TYPE_ANY ((cpu_type_t) -1)
93 
94 #define CPU_TYPE_VAX ((cpu_type_t) 1)
95 /* skip ((cpu_type_t) 2) */
96 /* skip ((cpu_type_t) 3) */
97 /* skip ((cpu_type_t) 4) */
98 /* skip ((cpu_type_t) 5) */
99 #define CPU_TYPE_MC680x0 ((cpu_type_t) 6)
100 #define CPU_TYPE_X86 ((cpu_type_t) 7)
101 #define CPU_TYPE_I386 CPU_TYPE_X86 /* compatibility */
102 #define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64)
103 
104 /* skip CPU_TYPE_MIPS ((cpu_type_t) 8) */
105 /* skip ((cpu_type_t) 9) */
106 #define CPU_TYPE_MC98000 ((cpu_type_t) 10)
107 #define CPU_TYPE_HPPA ((cpu_type_t) 11)
108 #define CPU_TYPE_ARM ((cpu_type_t) 12)
109 #define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
110 #define CPU_TYPE_MC88000 ((cpu_type_t) 13)
111 #define CPU_TYPE_SPARC ((cpu_type_t) 14)
112 #define CPU_TYPE_I860 ((cpu_type_t) 15)
113 /* skip CPU_TYPE_ALPHA ((cpu_type_t) 16) */
114 /* skip ((cpu_type_t) 17) */
115 #define CPU_TYPE_POWERPC ((cpu_type_t) 18)
116 #define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
117 
118 /*
119  * Machine subtypes (these are defined here, instead of in a machine
120  * dependent directory, so that any program can get all definitions
121  * regardless of where is it compiled).
122  */
123 
124 /*
125  * Capability bits used in the definition of cpu_subtype.
126  */
127 #define CPU_SUBTYPE_MASK 0xff000000 /* mask for feature flags */
128 #define CPU_SUBTYPE_LIB64 0x80000000 /* 64 bit libraries */
129 
130 
131 /*
132  * Object files that are hand-crafted to run on any
133  * implementation of an architecture are tagged with
134  * CPU_SUBTYPE_MULTIPLE. This functions essentially the same as
135  * the "ALL" subtype of an architecture except that it allows us
136  * to easily find object files that may need to be modified
137  * whenever a new implementation of an architecture comes out.
138  *
139  * It is the responsibility of the implementor to make sure the
140  * software handles unsupported implementations elegantly.
141  */
142 #define CPU_SUBTYPE_MULTIPLE ((cpu_subtype_t) -1)
143 #define CPU_SUBTYPE_LITTLE_ENDIAN ((cpu_subtype_t) 0)
144 #define CPU_SUBTYPE_BIG_ENDIAN ((cpu_subtype_t) 1)
145 
146 /*
147  * Machine threadtypes.
148  * This is none - not defined - for most machine types/subtypes.
149  */
150 #define CPU_THREADTYPE_NONE ((cpu_threadtype_t) 0)
151 
152 /*
153  * VAX subtypes (these do *not* necessary conform to the actual cpu
154  * ID assigned by DEC available via the SID register).
155  */
156 
157 #define CPU_SUBTYPE_VAX_ALL ((cpu_subtype_t) 0)
158 #define CPU_SUBTYPE_VAX780 ((cpu_subtype_t) 1)
159 #define CPU_SUBTYPE_VAX785 ((cpu_subtype_t) 2)
160 #define CPU_SUBTYPE_VAX750 ((cpu_subtype_t) 3)
161 #define CPU_SUBTYPE_VAX730 ((cpu_subtype_t) 4)
162 #define CPU_SUBTYPE_UVAXI ((cpu_subtype_t) 5)
163 #define CPU_SUBTYPE_UVAXII ((cpu_subtype_t) 6)
164 #define CPU_SUBTYPE_VAX8200 ((cpu_subtype_t) 7)
165 #define CPU_SUBTYPE_VAX8500 ((cpu_subtype_t) 8)
166 #define CPU_SUBTYPE_VAX8600 ((cpu_subtype_t) 9)
167 #define CPU_SUBTYPE_VAX8650 ((cpu_subtype_t) 10)
168 #define CPU_SUBTYPE_VAX8800 ((cpu_subtype_t) 11)
169 #define CPU_SUBTYPE_UVAXIII ((cpu_subtype_t) 12)
170 
171 /*
172  * 680x0 subtypes
173  *
174  * The subtype definitions here are unusual for historical reasons.
175  * NeXT used to consider 68030 code as generic 68000 code. For
176  * backwards compatability:
177  *
178  * CPU_SUBTYPE_MC68030 symbol has been preserved for source code
179  * compatability.
180  *
181  * CPU_SUBTYPE_MC680x0_ALL has been defined to be the same
182  * subtype as CPU_SUBTYPE_MC68030 for binary comatability.
183  *
184  * CPU_SUBTYPE_MC68030_ONLY has been added to allow new object
185  * files to be tagged as containing 68030-specific instructions.
186  */
187 
188 #define CPU_SUBTYPE_MC680x0_ALL ((cpu_subtype_t) 1)
189 #define CPU_SUBTYPE_MC68030 ((cpu_subtype_t) 1) /* compat */
190 #define CPU_SUBTYPE_MC68040 ((cpu_subtype_t) 2)
191 #define CPU_SUBTYPE_MC68030_ONLY ((cpu_subtype_t) 3)
192 
193 /*
194  * I386 subtypes
195  */
196 
197 #define CPU_SUBTYPE_INTEL(f, m) ((cpu_subtype_t) (f) + ((m) << 4))
198 
199 #define CPU_SUBTYPE_I386_ALL CPU_SUBTYPE_INTEL(3, 0)
200 #define CPU_SUBTYPE_386 CPU_SUBTYPE_INTEL(3, 0)
201 #define CPU_SUBTYPE_486 CPU_SUBTYPE_INTEL(4, 0)
202 #define CPU_SUBTYPE_486SX CPU_SUBTYPE_INTEL(4, 8) // 8 << 4 = 128
203 #define CPU_SUBTYPE_586 CPU_SUBTYPE_INTEL(5, 0)
204 #define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0)
205 #define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1)
206 #define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3)
207 #define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5)
208 #define CPU_SUBTYPE_CELERON CPU_SUBTYPE_INTEL(7, 6)
209 #define CPU_SUBTYPE_CELERON_MOBILE CPU_SUBTYPE_INTEL(7, 7)
210 #define CPU_SUBTYPE_PENTIUM_3 CPU_SUBTYPE_INTEL(8, 0)
211 #define CPU_SUBTYPE_PENTIUM_3_M CPU_SUBTYPE_INTEL(8, 1)
212 #define CPU_SUBTYPE_PENTIUM_3_XEON CPU_SUBTYPE_INTEL(8, 2)
213 #define CPU_SUBTYPE_PENTIUM_M CPU_SUBTYPE_INTEL(9, 0)
214 #define CPU_SUBTYPE_PENTIUM_4 CPU_SUBTYPE_INTEL(10, 0)
215 #define CPU_SUBTYPE_PENTIUM_4_M CPU_SUBTYPE_INTEL(10, 1)
216 #define CPU_SUBTYPE_ITANIUM CPU_SUBTYPE_INTEL(11, 0)
217 #define CPU_SUBTYPE_ITANIUM_2 CPU_SUBTYPE_INTEL(11, 1)
218 #define CPU_SUBTYPE_XEON CPU_SUBTYPE_INTEL(12, 0)
219 #define CPU_SUBTYPE_XEON_MP CPU_SUBTYPE_INTEL(12, 1)
220 
221 #define CPU_SUBTYPE_INTEL_FAMILY(x) ((x) & 15)
222 #define CPU_SUBTYPE_INTEL_FAMILY_MAX 15
223 
224 #define CPU_SUBTYPE_INTEL_MODEL(x) ((x) >> 4)
225 #define CPU_SUBTYPE_INTEL_MODEL_ALL 0
226 
227 /*
228  * X86 subtypes.
229  */
230 
231 #define CPU_SUBTYPE_X86_ALL ((cpu_subtype_t)3)
232 #define CPU_SUBTYPE_X86_64_ALL ((cpu_subtype_t)3)
233 #define CPU_SUBTYPE_X86_ARCH1 ((cpu_subtype_t)4)
234 #define CPU_SUBTYPE_X86_64_H ((cpu_subtype_t)8) /* Haswell feature subset */
235 
236 
237 #define CPU_THREADTYPE_INTEL_HTT ((cpu_threadtype_t) 1)
238 
239 /*
240  * Mips subtypes.
241  */
242 
243 #define CPU_SUBTYPE_MIPS_ALL ((cpu_subtype_t) 0)
244 #define CPU_SUBTYPE_MIPS_R2300 ((cpu_subtype_t) 1)
245 #define CPU_SUBTYPE_MIPS_R2600 ((cpu_subtype_t) 2)
246 #define CPU_SUBTYPE_MIPS_R2800 ((cpu_subtype_t) 3)
247 #define CPU_SUBTYPE_MIPS_R2000a ((cpu_subtype_t) 4) /* pmax */
248 #define CPU_SUBTYPE_MIPS_R2000 ((cpu_subtype_t) 5)
249 #define CPU_SUBTYPE_MIPS_R3000a ((cpu_subtype_t) 6) /* 3max */
250 #define CPU_SUBTYPE_MIPS_R3000 ((cpu_subtype_t) 7)
251 
252 /*
253  * MC98000 (PowerPC) subtypes
254  */
255 #define CPU_SUBTYPE_MC98000_ALL ((cpu_subtype_t) 0)
256 #define CPU_SUBTYPE_MC98601 ((cpu_subtype_t) 1)
257 
258 /*
259  * HPPA subtypes for Hewlett-Packard HP-PA family of
260  * risc processors. Port by NeXT to 700 series.
261  */
262 
263 #define CPU_SUBTYPE_HPPA_ALL ((cpu_subtype_t) 0)
264 #define CPU_SUBTYPE_HPPA_7100 ((cpu_subtype_t) 0) /* compat */
265 #define CPU_SUBTYPE_HPPA_7100LC ((cpu_subtype_t) 1)
266 
267 /*
268  * MC88000 subtypes.
269  */
270 #define CPU_SUBTYPE_MC88000_ALL ((cpu_subtype_t) 0)
271 #define CPU_SUBTYPE_MC88100 ((cpu_subtype_t) 1)
272 #define CPU_SUBTYPE_MC88110 ((cpu_subtype_t) 2)
273 
274 /*
275  * SPARC subtypes
276  */
277 #define CPU_SUBTYPE_SPARC_ALL ((cpu_subtype_t) 0)
278 
279 /*
280  * I860 subtypes
281  */
282 #define CPU_SUBTYPE_I860_ALL ((cpu_subtype_t) 0)
283 #define CPU_SUBTYPE_I860_860 ((cpu_subtype_t) 1)
284 
285 /*
286  * PowerPC subtypes
287  */
288 #define CPU_SUBTYPE_POWERPC_ALL ((cpu_subtype_t) 0)
289 #define CPU_SUBTYPE_POWERPC_601 ((cpu_subtype_t) 1)
290 #define CPU_SUBTYPE_POWERPC_602 ((cpu_subtype_t) 2)
291 #define CPU_SUBTYPE_POWERPC_603 ((cpu_subtype_t) 3)
292 #define CPU_SUBTYPE_POWERPC_603e ((cpu_subtype_t) 4)
293 #define CPU_SUBTYPE_POWERPC_603ev ((cpu_subtype_t) 5)
294 #define CPU_SUBTYPE_POWERPC_604 ((cpu_subtype_t) 6)
295 #define CPU_SUBTYPE_POWERPC_604e ((cpu_subtype_t) 7)
296 #define CPU_SUBTYPE_POWERPC_620 ((cpu_subtype_t) 8)
297 #define CPU_SUBTYPE_POWERPC_750 ((cpu_subtype_t) 9)
298 #define CPU_SUBTYPE_POWERPC_7400 ((cpu_subtype_t) 10)
299 #define CPU_SUBTYPE_POWERPC_7450 ((cpu_subtype_t) 11)
300 #define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100)
301 
302 /*
303  * ARM subtypes
304  */
305 #define CPU_SUBTYPE_ARM_ALL ((cpu_subtype_t) 0)
306 #define CPU_SUBTYPE_ARM_V4T ((cpu_subtype_t) 5)
307 #define CPU_SUBTYPE_ARM_V6 ((cpu_subtype_t) 6)
308 #define CPU_SUBTYPE_ARM_V5TEJ ((cpu_subtype_t) 7)
309 #define CPU_SUBTYPE_ARM_XSCALE ((cpu_subtype_t) 8)
310 #define CPU_SUBTYPE_ARM_V7 ((cpu_subtype_t) 9)
311 #define CPU_SUBTYPE_ARM_V7F ((cpu_subtype_t) 10) /* Cortex A9 */
312 #define CPU_SUBTYPE_ARM_V7S ((cpu_subtype_t) 11) /* Swift */
313 #define CPU_SUBTYPE_ARM_V7K ((cpu_subtype_t) 12)
314 #define CPU_SUBTYPE_ARM_V6M ((cpu_subtype_t) 14) /* Not meant to be run under xnu */
315 #define CPU_SUBTYPE_ARM_V7M ((cpu_subtype_t) 15) /* Not meant to be run under xnu */
316 #define CPU_SUBTYPE_ARM_V7EM ((cpu_subtype_t) 16) /* Not meant to be run under xnu */
317 
318 #define CPU_SUBTYPE_ARM_V8 ((cpu_subtype_t) 13)
319 
320 /*
321  * ARM64 subtypes
322  */
323 #define CPU_SUBTYPE_ARM64_ALL ((cpu_subtype_t) 0)
324 #define CPU_SUBTYPE_ARM64_V8 ((cpu_subtype_t) 1)
325 
326 #endif /* !__ASSEMBLER__ */
327 
328 /*
329  * CPU families (sysctl hw.cpufamily)
330  *
331  * These are meant to identify the CPU's marketing name - an
332  * application can map these to (possibly) localized strings.
333  * NB: the encodings of the CPU families are intentionally arbitrary.
334  * There is no ordering, and you should never try to deduce whether
335  * or not some feature is available based on the family.
336  * Use feature flags (eg, hw.optional.altivec) to test for optional
337  * functionality.
338  */
339 #define CPUFAMILY_UNKNOWN 0
340 #define CPUFAMILY_POWERPC_G3 0xcee41549
341 #define CPUFAMILY_POWERPC_G4 0x77c184ae
342 #define CPUFAMILY_POWERPC_G5 0xed76d8aa
343 #define CPUFAMILY_INTEL_6_13 0xaa33392b
344 #define CPUFAMILY_INTEL_PENRYN 0x78ea4fbc
345 #define CPUFAMILY_INTEL_NEHALEM 0x6b5a4cd2
346 #define CPUFAMILY_INTEL_WESTMERE 0x573b5eec
347 #define CPUFAMILY_INTEL_SANDYBRIDGE 0x5490b78c
348 #define CPUFAMILY_INTEL_IVYBRIDGE 0x1f65e835
349 #define CPUFAMILY_INTEL_HASWELL 0x10b282dc
350 #define CPUFAMILY_INTEL_BROADWELL 0x582ed09c
351 #define CPUFAMILY_INTEL_SKYLAKE 0x37fc219f
352 #define CPUFAMILY_INTEL_KABYLAKE 0x0f817246
353 #define CPUFAMILY_ARM_9 0xe73283ae
354 #define CPUFAMILY_ARM_11 0x8ff620d8
355 #define CPUFAMILY_ARM_XSCALE 0x53b005f5
356 #define CPUFAMILY_ARM_12 0xbd1b0ae9
357 #define CPUFAMILY_ARM_13 0x0cc90e64
358 #define CPUFAMILY_ARM_14 0x96077ef1
359 #define CPUFAMILY_ARM_15 0xa8511bca
360 #define CPUFAMILY_ARM_SWIFT 0x1e2d6381
361 #define CPUFAMILY_ARM_CYCLONE 0x37a09642
362 #define CPUFAMILY_ARM_TYPHOON 0x2c91a47e
363 #define CPUFAMILY_ARM_TWISTER 0x92fb37c8
364 #define CPUFAMILY_ARM_HURRICANE 0x67ceee93
365 
366 /* The following synonyms are deprecated: */
367 #define CPUFAMILY_INTEL_6_23 CPUFAMILY_INTEL_PENRYN
368 #define CPUFAMILY_INTEL_6_26 CPUFAMILY_INTEL_NEHALEM
369 
370 
371 #endif /* _MACH_MACHINE_H_ */
integer_t
int32_t integer_t
Definition: machine.h:68
cpu_type_t
integer_t cpu_type_t
Definition: machine.h:70
cpu_subtype_t
integer_t cpu_subtype_t
Definition: machine.h:71
stdint.h
cpu_threadtype_t
integer_t cpu_threadtype_t
Definition: machine.h:72
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:30