]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
ff6e181a A |
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. | |
1c79356b | 12 | * |
ff6e181a A |
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 | |
1c79356b A |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
ff6e181a A |
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. | |
1c79356b A |
20 | * |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | /* | |
24 | * Copyright (C) 1990, NeXT, Inc. | |
25 | * | |
26 | * File: next/kern_machdep.c | |
27 | * Author: John Seamons | |
28 | * | |
29 | * Machine-specific kernel routines. | |
1c79356b A |
30 | */ |
31 | ||
32 | #include <sys/types.h> | |
33 | #include <mach/machine.h> | |
34 | #include <kern/cpu_number.h> | |
35 | ||
91447636 | 36 | extern int grade_binary(cpu_type_t exectype, cpu_subtype_t execsubtype); |
1c79356b A |
37 | |
38 | /********************************************************************** | |
91447636 | 39 | * Routine: grade_binary() |
1c79356b | 40 | * |
91447636 A |
41 | * Function: Return a relative preference for exectypes and |
42 | * execsubtypes in fat executable files. The higher the | |
43 | * grade, the higher the preference. A grade of 0 means | |
44 | * not acceptable. | |
1c79356b | 45 | **********************************************************************/ |
91447636 A |
46 | int |
47 | grade_binary(__unused cpu_type_t exectype, cpu_subtype_t execsubtype) | |
1c79356b | 48 | { |
91447636 | 49 | int cpusubtype = cpu_subtype(); |
1c79356b | 50 | |
91447636 | 51 | switch (cpusubtype) { |
1c79356b | 52 | case CPU_SUBTYPE_386: |
91447636 | 53 | switch (execsubtype) { |
1c79356b A |
54 | case CPU_SUBTYPE_386: |
55 | return 1; | |
56 | default: | |
57 | return 0; | |
58 | } | |
59 | ||
60 | case CPU_SUBTYPE_486: | |
91447636 | 61 | switch (execsubtype) { |
1c79356b A |
62 | case CPU_SUBTYPE_386: |
63 | return 1; | |
64 | ||
65 | case CPU_SUBTYPE_486SX: | |
66 | return 2; | |
67 | ||
68 | case CPU_SUBTYPE_486: | |
69 | return 3; | |
70 | ||
71 | default: | |
72 | return 0; | |
73 | } | |
74 | ||
75 | case CPU_SUBTYPE_486SX: | |
91447636 | 76 | switch (execsubtype) { |
1c79356b A |
77 | case CPU_SUBTYPE_386: |
78 | return 1; | |
79 | ||
80 | case CPU_SUBTYPE_486: | |
81 | return 2; | |
82 | ||
83 | case CPU_SUBTYPE_486SX: | |
84 | return 3; | |
85 | ||
86 | default: | |
87 | return 0; | |
88 | } | |
89 | ||
90 | case CPU_SUBTYPE_586: | |
91447636 | 91 | switch (execsubtype) { |
1c79356b A |
92 | case CPU_SUBTYPE_386: |
93 | return 1; | |
94 | ||
95 | case CPU_SUBTYPE_486SX: | |
96 | return 2; | |
97 | ||
98 | case CPU_SUBTYPE_486: | |
99 | return 3; | |
100 | ||
101 | case CPU_SUBTYPE_586: | |
102 | return 4; | |
103 | ||
104 | default: | |
105 | return 0; | |
106 | } | |
107 | ||
108 | default: | |
91447636 | 109 | if ( CPU_SUBTYPE_INTEL_MODEL(execsubtype) == |
1c79356b | 110 | CPU_SUBTYPE_INTEL_MODEL_ALL) { |
91447636 A |
111 | if ( CPU_SUBTYPE_INTEL_FAMILY(cpusubtype) >= |
112 | CPU_SUBTYPE_INTEL_FAMILY(execsubtype)) | |
1c79356b | 113 | return CPU_SUBTYPE_INTEL_FAMILY_MAX - |
91447636 A |
114 | CPU_SUBTYPE_INTEL_FAMILY(cpusubtype) - |
115 | CPU_SUBTYPE_INTEL_FAMILY(execsubtype); | |
1c79356b A |
116 | } |
117 | else { | |
91447636 | 118 | if ( cpusubtype == execsubtype) |
1c79356b A |
119 | return CPU_SUBTYPE_INTEL_FAMILY_MAX + 1; |
120 | } | |
121 | return 0; | |
122 | } | |
123 | } | |
91447636 A |
124 | |
125 | extern void md_prepare_for_shutdown(int, int, char *); | |
126 | ||
127 | void | |
128 | md_prepare_for_shutdown( | |
129 | __unused int paniced, | |
130 | __unused int howto, | |
131 | __unused char * command) | |
132 | { | |
133 | } |