Annotation of kernel/machdep/ppc/kern_machdep.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /*
                     26:  *     Copyright (C) 1998  Apple Computer, Inc.
                     27:  *
                     28:  *     File:   machdep/ppc/kern_machdep.c
                     29:  *
                     30:  *     Machine-specific kernel routines.
                     31:  *
                     32:  * HISTORY
                     33:  *  8-jun-1998 Umesh Vaishampayan  ([email protected])
                     34:  *             Replaced grade_cpu_subtype() and check_cpu_subtype() with
                     35:  *             the implementation by Kevin Enderby.
                     36:  *             Deleted obsolete history.
                     37:  *
                     38:  */
                     39: 
                     40: #import <cpus.h>
                     41: #import        <sys/types.h>
                     42: #import        <mach/machine.h>
                     43: #import        <machine/cpu.h>
                     44: 
                     45: /*
                     46:  * Routine: grade_cpu_subtype()
                     47:  *
                     48:  * Function:
                     49:  *     Return a relative preference for cpu_subtypes in fat executable files.
                     50:  *     The higher the grade, the higher the preference.
                     51:  *     A grade of 0 means not acceptable.
                     52:  */
                     53: 
                     54: int
                     55: grade_cpu_subtype (cpu_subtype)
                     56: cpu_subtype_t  cpu_subtype;
                     57: {
                     58:        struct machine_slot *ms = &machine_slot[cpu_number()];
                     59: 
                     60:        /*
                     61:         * This code should match cpusubtype_findbestarch() in best_arch.c in the
                     62:         * cctools project.  As of 2/16/98 this is what has been agreed upon for
                     63:         * the PowerPC subtypes.  If an exact match is not found the subtype will
                     64:         * be picked from the following order:
                     65:         *              750, 604e, 604, 603ev, 603e, 603, ALL
                     66:         * Note the 601 is NOT in the list above.  It is only picked via an exact
                     67:         * match. For details see Radar 2213821.
                     68:         *
                     69:         * To implement this function to follow what was agreed upon above, we use
                     70:         * the fact there are currently 8 different subtypes.  Exact matches return
                     71:         * the value 8, the value 0 is returned for 601 that is not an exact match,
                     72:         * and the values 7 thru 1 are returned for the subtypes listed in the order
                     73:         * above.
                     74:         */
                     75:        if (ms->cpu_subtype == cpu_subtype)
                     76:                return 8;
                     77:        if (cpu_subtype == CPU_SUBTYPE_POWERPC_601)
                     78:                return 0;
                     79:        switch (cpu_subtype) {
                     80:                case CPU_SUBTYPE_POWERPC_750:
                     81:                        return 7;
                     82:                case CPU_SUBTYPE_POWERPC_604e:
                     83:                        return 6;
                     84:                case CPU_SUBTYPE_POWERPC_604:
                     85:                        return 5;
                     86:                case CPU_SUBTYPE_POWERPC_603ev:
                     87:                        return 4;
                     88:                case CPU_SUBTYPE_POWERPC_603e:
                     89:                        return 3;
                     90:                case CPU_SUBTYPE_POWERPC_603:
                     91:                        return 2;
                     92:                case CPU_SUBTYPE_POWERPC_ALL:
                     93:                        return 1;
                     94:        }
                     95:        /*
                     96:         * If we get here it is because it is a cpusubtype we don't support (602 and
                     97:         * 620) or new cpusubtype that was added since this code was written.  Both
                     98:         * will be considered unacceptable.
                     99:         */
                    100:        return 0;
                    101: }
                    102: 
                    103: int
                    104: check_cpu_subtype (cpu_subtype)
                    105: cpu_subtype_t  cpu_subtype;
                    106: {
                    107:        struct machine_slot *ms = &machine_slot[cpu_number()];
                    108: 
                    109:        if (cpu_subtype == ms->cpu_subtype)
                    110:                return (TRUE);
                    111: 
                    112:        if (cpu_subtype == CPU_SUBTYPE_POWERPC_601)
                    113:                return (FALSE);
                    114: 
                    115:        switch (cpu_subtype) {
                    116:                case CPU_SUBTYPE_POWERPC_750:
                    117:                case CPU_SUBTYPE_POWERPC_604e:
                    118:                case CPU_SUBTYPE_POWERPC_604:
                    119:                case CPU_SUBTYPE_POWERPC_603ev:
                    120:                case CPU_SUBTYPE_POWERPC_603e:
                    121:                case CPU_SUBTYPE_POWERPC_603:
                    122:                case CPU_SUBTYPE_POWERPC_ALL:
                    123:                        return (TRUE);
                    124:        }
                    125: 
                    126:        return (FALSE);
                    127: }
                    128: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.