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