DebugServer2
Loading...
Searching...
No Matches
CPUTypes.h
1//
2// Copyright (c) 2014-present, Facebook, Inc.
3// All rights reserved.
4//
5// This source code is licensed under the University of Illinois/NCSA Open
6// Source License found in the LICENSE file in the root directory of this
7// source tree. An additional grant of patent rights can be found in the
8// PATENTS file in the same directory.
9//
10
11#pragma once
12
13#include "DebugServer2/Base.h"
14#include "DebugServer2/Constants.h"
15
16namespace ds2 {
17
18//
19// CPU Type Flags
20//
21
22enum { kCPUArchABI64 = 0x01000000U };
23
24//
25// CPU Types
26//
27
28enum CPUType {
29 kCPUTypeAny = (-1),
30 kCPUTypeAll = 0,
31 kCPUTypeAll64 = (kCPUTypeAll | kCPUArchABI64),
32
33 kCPUTypeVAX = 1,
34 kCPUTypeROMP = 2,
35 // skip 3
36 // skip 4
37 // skip 5
38 kCPUTypeMC680x0 = 6,
39 kCPUTypeX86 = 7,
40 kCPUTypeI386 = kCPUTypeX86,
41 kCPUTypeX86_64 = (kCPUTypeX86 | kCPUArchABI64),
42 kCPUTypeMIPS = 8,
43 kCPUTypeMIPS64 = (kCPUTypeMIPS | kCPUArchABI64),
44 // skip 9
45 kCPUTypeMC98000 = 10,
46 kCPUTypeHPPA = 11,
47 kCPUTypeHPPA64 = (kCPUTypeHPPA | kCPUArchABI64),
48 kCPUTypeARM = 12,
49 kCPUTypeARM64 = (kCPUTypeARM | kCPUArchABI64),
50 kCPUTypeMC88000 = 13,
51 kCPUTypeSPARC = 14,
52 kCPUTypeSPARC64 = (kCPUTypeSPARC | kCPUArchABI64),
53 kCPUTypeI860 = 15,
54 kCPUTypeALPHA = 16,
55 // skip 17
56 kCPUTypePOWERPC = 18,
57 kCPUTypePOWERPC64 = (kCPUTypePOWERPC | kCPUArchABI64),
58 // skip 19
59 // TODO(compnerd) these do not map consistently with the remainder of the CPU
60 // codes which mirror the Darwin constants. These values here correspond to
61 // the PE/COFF specification.
62 kCPUTypeRISCV32 = 0x5032,
63 kCPUTypeRISCV64 = 0x5064,
64 kCPUTypeRISCV128 = 0x5128,
65};
66
67//
68// CPU Sub Types.
69//
70
71enum CPUSubType {
72 kCPUSubTypeInvalid = (-2),
73 kCPUSubTypeMultiple = (-1),
74
75 //
76 // kCPUTypeVAX
77 //
78
79 kCPUSubTypeVAX_ALL = 0,
80 kCPUSubTypeVAX780 = 1,
81 kCPUSubTypeVAX785 = 2,
82 kCPUSubTypeVAX750 = 3,
83 kCPUSubTypeVAX730 = 4,
84 kCPUSubTypeUVAXI = 5,
85 kCPUSubTypeUVAXII = 6,
86 kCPUSubTypeVAX8200 = 7,
87 kCPUSubTypeVAX8500 = 8,
88 kCPUSubTypeVAX8600 = 9,
89 kCPUSubTypeVAX8650 = 10,
90 kCPUSubTypeVAX8800 = 11,
91 kCPUSubTypeUVAXIII = 12,
92
93 //
94 // kCPUTypeROMP
95 //
96
97 kCPUSubTypeROMP_ALL = 0,
98 kCPUSubTypeRT_PC = 1,
99 kCPUSubTypeRT_APC = 2,
100 kCPUSubTypeRT_135 = 3,
101
102 //
103 // kCPUTypeMC680x0
104 //
105
106 kCPUSubTypeMC680x0_ALL = 1,
107 kCPUSubTypeMC68030 = 1,
108 kCPUSubTypeMC68040 = 2,
109 kCPUSubTypeMC68030_ONLY = 3,
110
111//
112// kCPUTypeI386 (Legacy)
113//
114
115#define __CPUSubTypeINTEL(f, m) ((f) + ((m) << 4))
116
117 kCPUSubTypeI386_ALL = __CPUSubTypeINTEL(3, 0),
118 kCPUSubType386 = __CPUSubTypeINTEL(3, 0),
119 kCPUSubType486 = __CPUSubTypeINTEL(4, 0),
120 kCPUSubType486SX = __CPUSubTypeINTEL(4, 8),
121 kCPUSubType586 = __CPUSubTypeINTEL(5, 0),
122 kCPUSubTypePENT = __CPUSubTypeINTEL(5, 0),
123 kCPUSubTypePENTPRO = __CPUSubTypeINTEL(6, 1),
124 kCPUSubTypePENTII_M3 = __CPUSubTypeINTEL(6, 3),
125 kCPUSubTypePENTII_M5 = __CPUSubTypeINTEL(6, 5),
126 kCPUSubTypeCELERON = __CPUSubTypeINTEL(7, 6),
127 kCPUSubTypeCELERON_MOBILE = __CPUSubTypeINTEL(7, 7),
128 kCPUSubTypePENTIUM_3 = __CPUSubTypeINTEL(8, 0),
129 kCPUSubTypePENTIUM_3_M = __CPUSubTypeINTEL(8, 1),
130 kCPUSubTypePENTIUM_3_XEON = __CPUSubTypeINTEL(8, 2),
131 kCPUSubTypePENTIUM_M = __CPUSubTypeINTEL(9, 0),
132 kCPUSubTypePENTIUM_4 = __CPUSubTypeINTEL(10, 0),
133 kCPUSubTypePENTIUM_4_M = __CPUSubTypeINTEL(10, 1),
134 kCPUSubTypeITANIUM = __CPUSubTypeINTEL(11, 0),
135 kCPUSubTypeITANIUM_2 = __CPUSubTypeINTEL(11, 1),
136 kCPUSubTypeXEON = __CPUSubTypeINTEL(12, 0),
137 kCPUSubTypeXEON_MP = __CPUSubTypeINTEL(12, 1),
138
139#undef __CPUSubTypeINTEL
140
141 //
142 // kCPUTypeX86, kCPUTypeX86_64
143 //
144
145 kCPUSubTypeX86_ALL = 3,
146 kCPUSubTypeX86_64_ALL = 3,
147 kCPUSubTypeX86_ARCH1 = 4,
148
149 //
150 // kCPUTypeMIPS, kCPUTypeMIPS64
151 //
152
153 kCPUSubTypeMIPS_ALL = 0,
154 kCPUSubTypeMIPS_R2300 = 1,
155 kCPUSubTypeMIPS_R2600 = 2,
156 kCPUSubTypeMIPS_R2800 = 3,
157 kCPUSubTypeMIPS_R2000 = 4,
158 kCPUSubTypeMIPS_R2000a = 5,
159 kCPUSubTypeMIPS_R3000 = 6,
160 kCPUSubTypeMIPS_R3000a = 7,
161
162 //
163 // kCPUTypeMC98000 (PowerPC)
164 //
165
166 kCPUSubTypeMC98000_ALL = 0,
167 kCPUSubTypeMC98601 = 1,
168
169 //
170 // kCPUTypeHPPA, kCPUTypeHPPA64
171 //
172
173 kCPUSubTypeHPPA_ALL = 0,
174 kCPUSubTypeHPPA_7100 = 0,
175 kCPUSubTypeHPPA_7100LC = 1,
176
177 //
178 // kCPUTypeMC88000
179 //
180
181 kCPUSubTypeMC88000_ALL = 0,
182 kCPUSubTypeMC88100 = 1,
183 kCPUSubTypeMC88110 = 2,
184
185 //
186 // kCPUTypeSPARC, kCPUTypeSPARC64
187 //
188
189 kCPUSubTypeSPARC_ALL = 0,
190
191 //
192 // kCPUTypeI860
193 //
194
195 kCPUSubTypeI860_ALL = 0,
196 kCPUSubTypeI860_860 = 1,
197
198 //
199 // kCPUTypePOWERPC, kCPUTypePOWERPC64
200 //
201
202 kCPUSubTypePOWERPC_ALL = 0,
203 kCPUSubTypePOWERPC_601 = 1,
204 kCPUSubTypePOWERPC_602 = 2,
205 kCPUSubTypePOWERPC_603 = 3,
206 kCPUSubTypePOWERPC_603e = 4,
207 kCPUSubTypePOWERPC_603ev = 5,
208 kCPUSubTypePOWERPC_604 = 6,
209 kCPUSubTypePOWERPC_604e = 7,
210 kCPUSubTypePOWERPC_620 = 8,
211 kCPUSubTypePOWERPC_750 = 9,
212 kCPUSubTypePOWERPC_7400 = 10,
213 kCPUSubTypePOWERPC_7450 = 11,
214 kCPUSubTypePOWERPC_970 = 100,
215
216 //
217 // kCPUTypeARM
218 //
219
220 kCPUSubTypeARM_ALL = 0,
221 kCPUSubTypeARM_V4T = 5,
222 kCPUSubTypeARM_V6 = 6,
223 kCPUSubTypeARM_V5TEJ = 7,
224 kCPUSubTypeARM_XSCALE = 8,
225 kCPUSubTypeARM_V7 = 9, // Cortex-A8 or successive
226 kCPUSubTypeARM_V7F = 10, // Cortex-A9
227 kCPUSubTypeARM_V7S = 11, // Apple A6
228 kCPUSubTypeARM_V7K = 12,
229 kCPUSubTypeARM_V8 = 13, // Cortex-A53, Cortex-A57
230 kCPUSubTypeARM_V6M = 14, // Cortex-M0, Cortex-M0+, Cortex-M1
231 kCPUSubTypeARM_V7M = 15, // Cortex-M3
232 kCPUSubTypeARM_V7EM = 16, // Cortex-M4
233
234 //
235 // kCPUTypeARM64
236 //
237
238 kCPUSubTypeARM64_ALL = 0,
239 kCPUSubTypeARM64_V8 = 1,
240
241 //
242 // kCPUTypeRISCV32
243 //
244
245 kCPUSubTypeRISCV32_ALL = 0,
246
247 //
248 // kCPUTypeRISCV64
249 //
250
251 kCPUSubTypeRISCV64_ALL = 0,
252
253 //
254 // kCPUTypeRISCV128
255 //
256
257 kCPSubTypeRISCV128_ALL = 0,
258};
259
260static inline bool CPUTypeIs64Bit(CPUType type) {
261 return type & kCPUArchABI64 || type == kCPUTypeALPHA ||
262 type == kCPUTypeRISCV64;
263}
264
265char const *GetCPUTypeName(CPUType type);
266char const *GetArchName(CPUType type, CPUSubType subtype);
267char const *GetArchName(CPUType type, CPUSubType subtype, Endian endian);
268} // namespace ds2