2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (C) 1990, NeXT, Inc.
25 * File: next/kern_machdep.c
26 * Author: John Seamons
28 * Machine-specific kernel routines.
30 * 8-Dec-91 Peter King (king) at NeXT
31 * Added grade_cpu_subtype().
32 * FIXME: Do we want to merge this with check_cpu_subtype()?
34 * 5-Mar-90 John Seamons (jks) at NeXT
38 #include <sys/types.h>
39 #include <mach/machine.h>
40 #include <kern/cpu_number.h>
42 check_cpu_subtype (cpu_subtype
)
43 cpu_subtype_t cpu_subtype
;
45 struct machine_slot
*ms
= &machine_slot
[cpu_number()];
47 switch (ms
->cpu_subtype
) {
49 if (cpu_subtype
== CPU_SUBTYPE_386
)
54 case CPU_SUBTYPE_486SX
:
55 if ( cpu_subtype
== CPU_SUBTYPE_486
||
56 cpu_subtype
== CPU_SUBTYPE_486SX
||
57 cpu_subtype
== CPU_SUBTYPE_386
)
62 if ( cpu_subtype
== CPU_SUBTYPE_586
||
63 cpu_subtype
== CPU_SUBTYPE_486
||
64 cpu_subtype
== CPU_SUBTYPE_486SX
||
65 cpu_subtype
== CPU_SUBTYPE_386
)
70 if ( CPU_SUBTYPE_INTEL_MODEL(cpu_subtype
) ==
71 CPU_SUBTYPE_INTEL_MODEL_ALL
) {
72 if ( CPU_SUBTYPE_INTEL_FAMILY(ms
->cpu_subtype
) >=
73 CPU_SUBTYPE_INTEL_FAMILY(cpu_subtype
))
77 if ( ms
->cpu_subtype
== cpu_subtype
)
86 /**********************************************************************
87 * Routine: grade_cpu_subtype()
89 * Function: Return a relative preference for cpu_subtypes in fat
90 * executable files. The higher the grade, the higher the
91 * preference. A grade of 0 means not acceptable.
92 **********************************************************************/
93 grade_cpu_subtype (cpu_subtype
)
94 cpu_subtype_t cpu_subtype
;
96 struct machine_slot
*ms
= &machine_slot
[cpu_number()];
98 switch (ms
->cpu_subtype
) {
100 switch (cpu_subtype
) {
101 case CPU_SUBTYPE_386
:
107 case CPU_SUBTYPE_486
:
108 switch (cpu_subtype
) {
109 case CPU_SUBTYPE_386
:
112 case CPU_SUBTYPE_486SX
:
115 case CPU_SUBTYPE_486
:
122 case CPU_SUBTYPE_486SX
:
123 switch (cpu_subtype
) {
124 case CPU_SUBTYPE_386
:
127 case CPU_SUBTYPE_486
:
130 case CPU_SUBTYPE_486SX
:
137 case CPU_SUBTYPE_586
:
138 switch (cpu_subtype
) {
139 case CPU_SUBTYPE_386
:
142 case CPU_SUBTYPE_486SX
:
145 case CPU_SUBTYPE_486
:
148 case CPU_SUBTYPE_586
:
156 if ( CPU_SUBTYPE_INTEL_MODEL(cpu_subtype
) ==
157 CPU_SUBTYPE_INTEL_MODEL_ALL
) {
158 if ( CPU_SUBTYPE_INTEL_FAMILY(ms
->cpu_subtype
) >=
159 CPU_SUBTYPE_INTEL_FAMILY(cpu_subtype
))
160 return CPU_SUBTYPE_INTEL_FAMILY_MAX
-
161 CPU_SUBTYPE_INTEL_FAMILY(ms
->cpu_subtype
) -
162 CPU_SUBTYPE_INTEL_FAMILY(cpu_subtype
);
165 if ( ms
->cpu_subtype
== cpu_subtype
)
166 return CPU_SUBTYPE_INTEL_FAMILY_MAX
+ 1;