aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxen/include/xen_cpu_feature.h
blob: 57a34d27733c5b8b2aac099ba936a4f54afb1e9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
/*
 * Copyright (c) 2006, XenSource Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 */

#ifndef XEN_CPU_FEATURE_H
#define XEN_CPU_FEATURE_H


#include "xen_common.h"


enum xen_cpu_feature
{
    /**
     *  Onboard FPU
     */
    XEN_CPU_FEATURE_FPU,

    /**
     *  Virtual Mode Extensions
     */
    XEN_CPU_FEATURE_VME,

    /**
     *  Debugging Extensions
     */
    XEN_CPU_FEATURE_DE,

    /**
     *  Page Size Extensions
     */
    XEN_CPU_FEATURE_PSE,

    /**
     *  Time Stamp Counter
     */
    XEN_CPU_FEATURE_TSC,

    /**
     *  Model-Specific Registers, RDMSR, WRMSR
     */
    XEN_CPU_FEATURE_MSR,

    /**
     *  Physical Address Extensions
     */
    XEN_CPU_FEATURE_PAE,

    /**
     *  Machine Check Architecture
     */
    XEN_CPU_FEATURE_MCE,

    /**
     *  CMPXCHG8 instruction
     */
    XEN_CPU_FEATURE_CX8,

    /**
     *  Onboard APIC
     */
    XEN_CPU_FEATURE_APIC,

    /**
     *  SYSENTER/SYSEXIT
     */
    XEN_CPU_FEATURE_SEP,

    /**
     *  Memory Type Range Registers
     */
    XEN_CPU_FEATURE_MTRR,

    /**
     *  Page Global Enable
     */
    XEN_CPU_FEATURE_PGE,

    /**
     *  Machine Check Architecture
     */
    XEN_CPU_FEATURE_MCA,

    /**
     *  CMOV instruction (FCMOVCC and FCOMI too if FPU present)
     */
    XEN_CPU_FEATURE_CMOV,

    /**
     *  Page Attribute Table
     */
    XEN_CPU_FEATURE_PAT,

    /**
     *  36-bit PSEs
     */
    XEN_CPU_FEATURE_PSE36,

    /**
     *  Processor serial number
     */
    XEN_CPU_FEATURE_PN,

    /**
     *  Supports the CLFLUSH instruction
     */
    XEN_CPU_FEATURE_CLFLSH,

    /**
     *  Debug Trace Store
     */
    XEN_CPU_FEATURE_DTES,

    /**
     *  ACPI via MSR
     */
    XEN_CPU_FEATURE_ACPI,

    /**
     *  Multimedia Extensions
     */
    XEN_CPU_FEATURE_MMX,

    /**
     *  FXSAVE and FXRSTOR instructions (fast save and restore
     */
    XEN_CPU_FEATURE_FXSR,

    /**
     *  Streaming SIMD Extensions
     */
    XEN_CPU_FEATURE_XMM,

    /**
     *  Streaming SIMD Extensions-2
     */
    XEN_CPU_FEATURE_XMM2,

    /**
     *  CPU self snoop
     */
    XEN_CPU_FEATURE_SELFSNOOP,

    /**
     *  Hyper-Threading
     */
    XEN_CPU_FEATURE_HT,

    /**
     *  Automatic clock control
     */
    XEN_CPU_FEATURE_ACC,

    /**
     *  IA-64 processor
     */
    XEN_CPU_FEATURE_IA64,

    /**
     *  SYSCALL/SYSRET
     */
    XEN_CPU_FEATURE_SYSCALL,

    /**
     *  MP Capable.
     */
    XEN_CPU_FEATURE_MP,

    /**
     *  Execute Disable
     */
    XEN_CPU_FEATURE_NX,

    /**
     *  AMD MMX extensions
     */
    XEN_CPU_FEATURE_MMXEXT,

    /**
     *  Long Mode (x86-64)
     */
    XEN_CPU_FEATURE_LM,

    /**
     *  AMD 3DNow! extensions
     */
    XEN_CPU_FEATURE_THREEDNOWEXT,

    /**
     *  3DNow!
     */
    XEN_CPU_FEATURE_THREEDNOW,

    /**
     *  CPU in recovery mode
     */
    XEN_CPU_FEATURE_RECOVERY,

    /**
     *  Longrun power control
     */
    XEN_CPU_FEATURE_LONGRUN,

    /**
     *  LongRun table interface
     */
    XEN_CPU_FEATURE_LRTI,

    /**
     *  Cyrix MMX extensions
     */
    XEN_CPU_FEATURE_CXMMX,

    /**
     *  AMD K6 nonstandard MTRRs
     */
    XEN_CPU_FEATURE_K6_MTRR,

    /**
     *  Cyrix ARRs (= MTRRs)
     */
    XEN_CPU_FEATURE_CYRIX_ARR,

    /**
     *  Centaur MCRs (= MTRRs)
     */
    XEN_CPU_FEATURE_CENTAUR_MCR,

    /**
     *  Opteron, Athlon64
     */
    XEN_CPU_FEATURE_K8,

    /**
     *  Athlon
     */
    XEN_CPU_FEATURE_K7,

    /**
     *  P3
     */
    XEN_CPU_FEATURE_P3,

    /**
     *  P4
     */
    XEN_CPU_FEATURE_P4,

    /**
     *  TSC ticks at a constant rate
     */
    XEN_CPU_FEATURE_CONSTANT_TSC,

    /**
     *  FXSAVE leaks FOP/FIP/FOP
     */
    XEN_CPU_FEATURE_FXSAVE_LEAK,

    /**
     *  Streaming SIMD Extensions-3
     */
    XEN_CPU_FEATURE_XMM3,

    /**
     *  Monitor/Mwait support
     */
    XEN_CPU_FEATURE_MWAIT,

    /**
     *  CPL Qualified Debug Store
     */
    XEN_CPU_FEATURE_DSCPL,

    /**
     *  Enhanced SpeedStep
     */
    XEN_CPU_FEATURE_EST,

    /**
     *  Thermal Monitor 2
     */
    XEN_CPU_FEATURE_TM2,

    /**
     *  Context ID
     */
    XEN_CPU_FEATURE_CID,

    /**
     *  CMPXCHG16B
     */
    XEN_CPU_FEATURE_CX16,

    /**
     *  Send Task Priority Messages
     */
    XEN_CPU_FEATURE_XTPR,

    /**
     *  on-CPU RNG present (xstore insn)
     */
    XEN_CPU_FEATURE_XSTORE,

    /**
     *  on-CPU RNG enabled
     */
    XEN_CPU_FEATURE_XSTORE_EN,

    /**
     *  on-CPU crypto (xcrypt insn)
     */
    XEN_CPU_FEATURE_XCRYPT,

    /**
     *  on-CPU crypto enabled
     */
    XEN_CPU_FEATURE_XCRYPT_EN,

    /**
     *  LAHF/SAHF in long mode
     */
    XEN_CPU_FEATURE_LAHF_LM,

    /**
     *  If yes HyperThreading not valid
     */
    XEN_CPU_FEATURE_CMP_LEGACY,

    /**
     *  VMX instruction set
     */
    XEN_CPU_FEATURE_VMX
};


typedef struct xen_cpu_feature_set
{
    size_t size;
    enum xen_cpu_feature contents[];
} xen_cpu_feature_set;

/**
 * Allocate a xen_cpu_feature_set of the given size.
 */
extern xen_cpu_feature_set *
xen_cpu_feature_set_alloc(size_t size);

/**
 * Free the given xen_cpu_feature_set.  The given set must have been
 * allocated by this library.
 */
extern void
xen_cpu_feature_set_free(xen_cpu_feature_set *set);


/**
 * Return the name corresponding to the given code.  This string must
 * not be modified or freed.
 */
extern const char *
xen_cpu_feature_to_string(enum xen_cpu_feature val);


/**
 * Return the correct code for the given string, or set the session
 * object to failure and return an undefined value if the given string does
 * not match a known code.
 */
extern enum xen_cpu_feature
xen_cpu_feature_from_string(xen_session *session, const char *str);


#endif