Debian Codegraph @

src/bin/dwarfdump/dd_mac_cputype.h

raw
1 /* available from https://opensource.apple.com/
2 see Developer Tools version 8.2.1. cctools-895/include/loader.h */
3 /*
4 * Copyright (c) 1999-2010 Apple Inc. All Rights Reserved.
5 *
6 * @APPLE_LICENSE_HEADER_START@
7 *
8 * This file contains Original Code and/or
9 * Modifications of Original Code
10 * as defined in and that are subject to the
11 * Apple Public Source License
12 * Version 2.0 (the 'License'). You may not use this file except in
13 * compliance with the License. Please obtain a copy of the License at
14 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * file.
16 *
17 * The Original Code and all software distributed under
18 * the License are
19 * distributed on an 'AS IS' basis, WITHOUT
20 * WARRANTY OF ANY KIND, EITHER
21 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
22 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE,
24 * QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the
26 * specific language governing rights and
27 * limitations under the License.
28 *
29 * @APPLE_LICENSE_HEADER_END@
30 */
31 #ifndef DD_MAC_CPUTYPE_H
32 #define DD_MAC_CPUTYPE_H
33
34 #define CPU_ARCH_MASK 0xff000000 /* mask for architecture bits */
35 #define CPU_ARCH_ABI64 0x01000000 /* 64 bit ABI */
36 #define CPU_ARCH_ABI64_32 0x02000000 /* ABI for 64-bit hardware with 32-bit types; LP32 */
37
38 #define CPU_TYPE_VAX ( 1)
39 #define CPU_TYPE_MC680x0 ( 6)
40 #define CPU_TYPE_X86 ( 7)
41 #define CPU_TYPE_I386 CPU_TYPE_X86 /* compatibility */
42 #define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64)
43
44 /* skip CPU_TYPE_MIPS ( 8) */
45 #define CPU_TYPE_MC98000 ( 10)
46 #define CPU_TYPE_HPPA ( 11)
47 #define CPU_TYPE_ARM ( 12)
48 #define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
49 #define CPU_TYPE_ARM64_32 (CPU_TYPE_ARM | CPU_ARCH_ABI64_32)
50 #define CPU_TYPE_MC88000 ( 13)
51 #define CPU_TYPE_SPARC ( 14)
52 #define CPU_TYPE_I860 ( 15)
53 /* skip CPU_TYPE_ALPHA ( 16) */
54 #define CPU_TYPE_POWERPC ( 18)
55 #define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
56
57 static const struct base_mac_cpu_s {
58 Dwarf_Unsigned value;
59 const char *name;
60 } mac_cpubase [] = {
61 {0,"Unknown cpu type"},
62 {1,"CPU_TYPE_VAX"},
63 {6,"CPU_TYPE_MC680x0"},
64 {7,"CPU_TYPE_X86"},
65 {CPU_TYPE_X86,"CPU_TYPE_I386"}, /* CPU_TYPE_X86 compatibility */
66 {(CPU_TYPE_X86 | CPU_ARCH_ABI64), "CPU_TYPE_X86_64"},
67 {10,"CPU_TYPE_MC98000",},
68 {11,"CPU_TYPE_HPPA"},
69 {12,"CPU_TYPE_ARM"},
70 {(CPU_TYPE_ARM | CPU_ARCH_ABI64),"CPU_TYPE_ARM64"},
71 {(CPU_TYPE_ARM | CPU_ARCH_ABI64_32),"CPU_TYPE_ARM64_32"},
72 {13, "CPU_TYPE_MC88000"},
73 {14,"CPU_TYPE_SPARC"},
74 {15, "CPU_TYPE_I860"},
75 /*{"", skip CPU_TYPE_ALPHA (16) */
76 /*{"", skip (17) */
77 {18,"CPU_TYPE_POWERPC"},
78 {(CPU_TYPE_POWERPC | CPU_ARCH_ABI64),"CPU_TYPE_POWERPC64"},
79 {0,0}
80 };
81
82 static const char *
83 dd_mach_arch_name(Dwarf_Unsigned val)
84 {
85 const struct base_mac_cpu_s *v = mac_cpubase;
86
87 for ( ; v->name; ++v) {
88 if (v->value == val) {
89 return v->name;
90 }
91 }
92 return "Unlisted MacOS cpu architecture";
93 }
94 #endif /* DD_MAC_CPUTYPE_H */