2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
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. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
31 * Copyright (C) 1990, 1993 NeXT, Inc.
32 * Copyright (C) 1997 Apple Computer, Inc.
34 * File: next/kern_machdep.c
35 * Author: John Seamons
37 * Machine-specific kernel routines.
40 #include <sys/types.h>
41 #include <sys/param.h>
42 #include <mach/machine.h>
43 #include <mach/boolean.h>
44 #include <mach/vm_param.h>
45 #include <kern/cpu_number.h>
46 #include <machine/exec.h>
49 * Routine: grade_binary()
52 * Return a relative preference for exectypes and execsubtypes in fat
53 * executable files. The higher the grade, the higher the preference.
54 * A grade of 0 means not acceptable.
56 * Note: We really don't care about the real cpu_type() here,
57 * because machines can only have one type.
60 grade_binary(cpu_type_t exectype
, cpu_subtype_t execsubtype
)
62 int cpusubtype
= cpu_subtype();
65 * This code should match cpusubtype_findbestarch() in best_arch.c
66 * in the cctools project. As of 2/16/98 this is what has been
67 * agreed upon for the PowerPC subtypes. If an exact match is not
68 * found the subtype will be picked from the following order:
69 * 970(but only on 970), 7450, 7400, 750, ALL
70 * Note the 601 is NOT in the list above. It is only picked via
71 * an exact match. For details see Radar 2213821.
75 case CPU_SUBTYPE_POWERPC_970
:
77 case CPU_TYPE_POWERPC64
: /* CPU_IS64BIT | CPU_POWERPC */
80 * Prefer 64 bit architecture specific binaries; note
81 * that this value does not mean the same thing here
84 case CPU_SUBTYPE_POWERPC_970
:
86 /* Prefer generic binaries */
87 case CPU_SUBTYPE_POWERPC_ALL
:
94 case CPU_TYPE_POWERPC
:
97 * Prefer 32 bit binaries with 64 bit leaf functions;
98 * this is actually bogus use of the subtype to encode
101 case CPU_SUBTYPE_POWERPC_970
:
103 case CPU_SUBTYPE_POWERPC_7450
:
105 case CPU_SUBTYPE_POWERPC_7400
:
107 case CPU_SUBTYPE_POWERPC_750
:
109 case CPU_SUBTYPE_POWERPC_ALL
:
121 case CPU_SUBTYPE_POWERPC_7450
:
123 case CPU_TYPE_POWERPC64
: /* CPU_IS64BIT | CPU_POWERPC */
126 case CPU_TYPE_POWERPC
:
127 switch(execsubtype
) {
128 case CPU_SUBTYPE_POWERPC_7450
:
130 case CPU_SUBTYPE_POWERPC_7400
:
132 case CPU_SUBTYPE_POWERPC_750
:
134 case CPU_SUBTYPE_POWERPC_ALL
:
146 case CPU_SUBTYPE_POWERPC_7400
:
148 case CPU_TYPE_POWERPC64
: /* CPU_IS64BIT | CPU_POWERPC */
151 case CPU_TYPE_POWERPC
:
152 switch(execsubtype
) {
153 case CPU_SUBTYPE_POWERPC_7400
:
155 case CPU_SUBTYPE_POWERPC_7450
:
157 case CPU_SUBTYPE_POWERPC_750
:
159 case CPU_SUBTYPE_POWERPC_ALL
:
171 case CPU_SUBTYPE_POWERPC_750
:
173 case CPU_TYPE_POWERPC64
: /* CPU_IS64BIT | CPU_POWERPC */
176 case CPU_TYPE_POWERPC
:
177 switch(execsubtype
) {
178 case CPU_SUBTYPE_POWERPC_750
:
180 #ifndef ADDRESS_RADAR_2678019
182 * Currently implemented because dropping this would
183 * turn the executable subtype into a "has Altivec"
184 * flag, which we do not want to permit. It could
185 * also break working third party applications
186 * already in use in the field.
188 case CPU_SUBTYPE_POWERPC_7400
:
190 case CPU_SUBTYPE_POWERPC_7450
:
192 #endif /* ADDRESS_RADAR_2678019 */
193 case CPU_SUBTYPE_POWERPC_ALL
:
207 case CPU_TYPE_POWERPC64
: /* CPU_IS64BIT | CPU_POWERPC */
210 case CPU_TYPE_POWERPC
:
211 /* Special case for PPC601 */
212 if (cpusubtype
== execsubtype
)
215 * If we get here it is because it is a cpusubtype we
216 * don't support or a new cpusubtype that was added
217 * since this code was written. Both will be
218 * considered unacceptable.
240 base
= trunc_page_64(start
);
244 if(kvtophys((vm_offset_t
)base
) == NULL
)
253 md_prepare_for_shutdown(int paniced
, int howto
, char * command
);
255 extern void IOSystemShutdownNotification(void);
258 md_prepare_for_shutdown(__unused
int paniced
, __unused
int howto
,
259 __unused
char * command
)
263 * Temporary hack to notify the power management root domain
264 * that the system will shut down.
266 IOSystemShutdownNotification();