]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/60010_xen3-auto-include-xen-interface.patch1
Corrected links and text on ids.cgi
[people/teissler/ipfire-2.x.git] / src / patches / 60010_xen3-auto-include-xen-interface.patch1
1 Subject: xen3 include-xen-interface
2 From: http://xenbits.xensource.com/linux-2.6.18-xen.hg (tip 728:832aac894efd)
3 Patch-mainline: obsolete
4 Acked-by: jbeulich@novell.com
5
6 Index: head-2008-11-25/include/xen/interface/COPYING
7 ===================================================================
8 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
9 +++ head-2008-11-25/include/xen/interface/COPYING 2007-06-12 13:14:19.000000000 +0200
10 @@ -0,0 +1,38 @@
11 +XEN NOTICE
12 +==========
13 +
14 +This copyright applies to all files within this subdirectory and its
15 +subdirectories:
16 + include/public/*.h
17 + include/public/hvm/*.h
18 + include/public/io/*.h
19 +
20 +The intention is that these files can be freely copied into the source
21 +tree of an operating system when porting that OS to run on Xen. Doing
22 +so does *not* cause the OS to become subject to the terms of the GPL.
23 +
24 +All other files in the Xen source distribution are covered by version
25 +2 of the GNU General Public License except where explicitly stated
26 +otherwise within individual source files.
27 +
28 + -- Keir Fraser (on behalf of the Xen team)
29 +
30 +=====================================================================
31 +
32 +Permission is hereby granted, free of charge, to any person obtaining a copy
33 +of this software and associated documentation files (the "Software"), to
34 +deal in the Software without restriction, including without limitation the
35 +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
36 +sell copies of the Software, and to permit persons to whom the Software is
37 +furnished to do so, subject to the following conditions:
38 +
39 +The above copyright notice and this permission notice shall be included in
40 +all copies or substantial portions of the Software.
41 +
42 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
45 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
47 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
48 +DEALINGS IN THE SOFTWARE.
49 Index: head-2008-11-25/include/xen/interface/acm.h
50 ===================================================================
51 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
52 +++ head-2008-11-25/include/xen/interface/acm.h 2007-06-12 13:14:19.000000000 +0200
53 @@ -0,0 +1,228 @@
54 +/*
55 + * acm.h: Xen access control module interface defintions
56 + *
57 + * Permission is hereby granted, free of charge, to any person obtaining a copy
58 + * of this software and associated documentation files (the "Software"), to
59 + * deal in the Software without restriction, including without limitation the
60 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
61 + * sell copies of the Software, and to permit persons to whom the Software is
62 + * furnished to do so, subject to the following conditions:
63 + *
64 + * The above copyright notice and this permission notice shall be included in
65 + * all copies or substantial portions of the Software.
66 + *
67 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
68 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
69 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
70 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
71 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
72 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
73 + * DEALINGS IN THE SOFTWARE.
74 + *
75 + * Reiner Sailer <sailer@watson.ibm.com>
76 + * Copyright (c) 2005, International Business Machines Corporation.
77 + */
78 +
79 +#ifndef _XEN_PUBLIC_ACM_H
80 +#define _XEN_PUBLIC_ACM_H
81 +
82 +#include "xen.h"
83 +
84 +/* if ACM_DEBUG defined, all hooks should
85 + * print a short trace message (comment it out
86 + * when not in testing mode )
87 + */
88 +/* #define ACM_DEBUG */
89 +
90 +#ifdef ACM_DEBUG
91 +# define printkd(fmt, args...) printk(fmt,## args)
92 +#else
93 +# define printkd(fmt, args...)
94 +#endif
95 +
96 +/* default ssid reference value if not supplied */
97 +#define ACM_DEFAULT_SSID 0x0
98 +#define ACM_DEFAULT_LOCAL_SSID 0x0
99 +
100 +/* Internal ACM ERROR types */
101 +#define ACM_OK 0
102 +#define ACM_UNDEF -1
103 +#define ACM_INIT_SSID_ERROR -2
104 +#define ACM_INIT_SOID_ERROR -3
105 +#define ACM_ERROR -4
106 +
107 +/* External ACCESS DECISIONS */
108 +#define ACM_ACCESS_PERMITTED 0
109 +#define ACM_ACCESS_DENIED -111
110 +#define ACM_NULL_POINTER_ERROR -200
111 +
112 +/*
113 + Error codes reported in when trying to test for a new policy
114 + These error codes are reported in an array of tuples where
115 + each error code is followed by a parameter describing the error
116 + more closely, such as a domain id.
117 +*/
118 +#define ACM_EVTCHN_SHARING_VIOLATION 0x100
119 +#define ACM_GNTTAB_SHARING_VIOLATION 0x101
120 +#define ACM_DOMAIN_LOOKUP 0x102
121 +#define ACM_CHWALL_CONFLICT 0x103
122 +#define ACM_SSIDREF_IN_USE 0x104
123 +
124 +
125 +/* primary policy in lower 4 bits */
126 +#define ACM_NULL_POLICY 0
127 +#define ACM_CHINESE_WALL_POLICY 1
128 +#define ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY 2
129 +#define ACM_POLICY_UNDEFINED 15
130 +
131 +/* combinations have secondary policy component in higher 4bit */
132 +#define ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY \
133 + ((ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY << 4) | ACM_CHINESE_WALL_POLICY)
134 +
135 +/* policy: */
136 +#define ACM_POLICY_NAME(X) \
137 + ((X) == (ACM_NULL_POLICY)) ? "NULL" : \
138 + ((X) == (ACM_CHINESE_WALL_POLICY)) ? "CHINESE WALL" : \
139 + ((X) == (ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY)) ? "SIMPLE TYPE ENFORCEMENT" : \
140 + ((X) == (ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY)) ? "CHINESE WALL AND SIMPLE TYPE ENFORCEMENT" : \
141 + "UNDEFINED"
142 +
143 +/* the following policy versions must be increased
144 + * whenever the interpretation of the related
145 + * policy's data structure changes
146 + */
147 +#define ACM_POLICY_VERSION 3
148 +#define ACM_CHWALL_VERSION 1
149 +#define ACM_STE_VERSION 1
150 +
151 +/* defines a ssid reference used by xen */
152 +typedef uint32_t ssidref_t;
153 +
154 +/* hooks that are known to domains */
155 +#define ACMHOOK_none 0
156 +#define ACMHOOK_sharing 1
157 +
158 +/* -------security policy relevant type definitions-------- */
159 +
160 +/* type identifier; compares to "equal" or "not equal" */
161 +typedef uint16_t domaintype_t;
162 +
163 +/* CHINESE WALL POLICY DATA STRUCTURES
164 + *
165 + * current accumulated conflict type set:
166 + * When a domain is started and has a type that is in
167 + * a conflict set, the conflicting types are incremented in
168 + * the aggregate set. When a domain is destroyed, the
169 + * conflicting types to its type are decremented.
170 + * If a domain has multiple types, this procedure works over
171 + * all those types.
172 + *
173 + * conflict_aggregate_set[i] holds the number of
174 + * running domains that have a conflict with type i.
175 + *
176 + * running_types[i] holds the number of running domains
177 + * that include type i in their ssidref-referenced type set
178 + *
179 + * conflict_sets[i][j] is "0" if type j has no conflict
180 + * with type i and is "1" otherwise.
181 + */
182 +/* high-16 = version, low-16 = check magic */
183 +#define ACM_MAGIC 0x0001debc
184 +
185 +/* each offset in bytes from start of the struct they
186 + * are part of */
187 +
188 +/* V3 of the policy buffer aded a version structure */
189 +struct acm_policy_version
190 +{
191 + uint32_t major;
192 + uint32_t minor;
193 +};
194 +
195 +
196 +/* each buffer consists of all policy information for
197 + * the respective policy given in the policy code
198 + *
199 + * acm_policy_buffer, acm_chwall_policy_buffer,
200 + * and acm_ste_policy_buffer need to stay 32-bit aligned
201 + * because we create binary policies also with external
202 + * tools that assume packed representations (e.g. the java tool)
203 + */
204 +struct acm_policy_buffer {
205 + uint32_t policy_version; /* ACM_POLICY_VERSION */
206 + uint32_t magic;
207 + uint32_t len;
208 + uint32_t policy_reference_offset;
209 + uint32_t primary_policy_code;
210 + uint32_t primary_buffer_offset;
211 + uint32_t secondary_policy_code;
212 + uint32_t secondary_buffer_offset;
213 + struct acm_policy_version xml_pol_version; /* add in V3 */
214 +};
215 +
216 +
217 +struct acm_policy_reference_buffer {
218 + uint32_t len;
219 +};
220 +
221 +struct acm_chwall_policy_buffer {
222 + uint32_t policy_version; /* ACM_CHWALL_VERSION */
223 + uint32_t policy_code;
224 + uint32_t chwall_max_types;
225 + uint32_t chwall_max_ssidrefs;
226 + uint32_t chwall_max_conflictsets;
227 + uint32_t chwall_ssid_offset;
228 + uint32_t chwall_conflict_sets_offset;
229 + uint32_t chwall_running_types_offset;
230 + uint32_t chwall_conflict_aggregate_offset;
231 +};
232 +
233 +struct acm_ste_policy_buffer {
234 + uint32_t policy_version; /* ACM_STE_VERSION */
235 + uint32_t policy_code;
236 + uint32_t ste_max_types;
237 + uint32_t ste_max_ssidrefs;
238 + uint32_t ste_ssid_offset;
239 +};
240 +
241 +struct acm_stats_buffer {
242 + uint32_t magic;
243 + uint32_t len;
244 + uint32_t primary_policy_code;
245 + uint32_t primary_stats_offset;
246 + uint32_t secondary_policy_code;
247 + uint32_t secondary_stats_offset;
248 +};
249 +
250 +struct acm_ste_stats_buffer {
251 + uint32_t ec_eval_count;
252 + uint32_t gt_eval_count;
253 + uint32_t ec_denied_count;
254 + uint32_t gt_denied_count;
255 + uint32_t ec_cachehit_count;
256 + uint32_t gt_cachehit_count;
257 +};
258 +
259 +struct acm_ssid_buffer {
260 + uint32_t len;
261 + ssidref_t ssidref;
262 + uint32_t policy_reference_offset;
263 + uint32_t primary_policy_code;
264 + uint32_t primary_max_types;
265 + uint32_t primary_types_offset;
266 + uint32_t secondary_policy_code;
267 + uint32_t secondary_max_types;
268 + uint32_t secondary_types_offset;
269 +};
270 +
271 +#endif
272 +
273 +/*
274 + * Local variables:
275 + * mode: C
276 + * c-set-style: "BSD"
277 + * c-basic-offset: 4
278 + * tab-width: 4
279 + * indent-tabs-mode: nil
280 + * End:
281 + */
282 Index: head-2008-11-25/include/xen/interface/acm_ops.h
283 ===================================================================
284 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
285 +++ head-2008-11-25/include/xen/interface/acm_ops.h 2007-06-12 13:14:19.000000000 +0200
286 @@ -0,0 +1,159 @@
287 +/*
288 + * acm_ops.h: Xen access control module hypervisor commands
289 + *
290 + * Permission is hereby granted, free of charge, to any person obtaining a copy
291 + * of this software and associated documentation files (the "Software"), to
292 + * deal in the Software without restriction, including without limitation the
293 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
294 + * sell copies of the Software, and to permit persons to whom the Software is
295 + * furnished to do so, subject to the following conditions:
296 + *
297 + * The above copyright notice and this permission notice shall be included in
298 + * all copies or substantial portions of the Software.
299 + *
300 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
301 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
302 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
303 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
304 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
305 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
306 + * DEALINGS IN THE SOFTWARE.
307 + *
308 + * Reiner Sailer <sailer@watson.ibm.com>
309 + * Copyright (c) 2005,2006 International Business Machines Corporation.
310 + */
311 +
312 +#ifndef __XEN_PUBLIC_ACM_OPS_H__
313 +#define __XEN_PUBLIC_ACM_OPS_H__
314 +
315 +#include "xen.h"
316 +#include "acm.h"
317 +
318 +/*
319 + * Make sure you increment the interface version whenever you modify this file!
320 + * This makes sure that old versions of acm tools will stop working in a
321 + * well-defined way (rather than crashing the machine, for instance).
322 + */
323 +#define ACM_INTERFACE_VERSION 0xAAAA000A
324 +
325 +/************************************************************************/
326 +
327 +/*
328 + * Prototype for this hypercall is:
329 + * int acm_op(int cmd, void *args)
330 + * @cmd == ACMOP_??? (access control module operation).
331 + * @args == Operation-specific extra arguments (NULL if none).
332 + */
333 +
334 +
335 +#define ACMOP_setpolicy 1
336 +struct acm_setpolicy {
337 + /* IN */
338 + XEN_GUEST_HANDLE_64(void) pushcache;
339 + uint32_t pushcache_size;
340 +};
341 +
342 +
343 +#define ACMOP_getpolicy 2
344 +struct acm_getpolicy {
345 + /* IN */
346 + XEN_GUEST_HANDLE_64(void) pullcache;
347 + uint32_t pullcache_size;
348 +};
349 +
350 +
351 +#define ACMOP_dumpstats 3
352 +struct acm_dumpstats {
353 + /* IN */
354 + XEN_GUEST_HANDLE_64(void) pullcache;
355 + uint32_t pullcache_size;
356 +};
357 +
358 +
359 +#define ACMOP_getssid 4
360 +#define ACM_GETBY_ssidref 1
361 +#define ACM_GETBY_domainid 2
362 +struct acm_getssid {
363 + /* IN */
364 + uint32_t get_ssid_by; /* ACM_GETBY_* */
365 + union {
366 + domaintype_t domainid;
367 + ssidref_t ssidref;
368 + } id;
369 + XEN_GUEST_HANDLE_64(void) ssidbuf;
370 + uint32_t ssidbuf_size;
371 +};
372 +
373 +#define ACMOP_getdecision 5
374 +struct acm_getdecision {
375 + /* IN */
376 + uint32_t get_decision_by1; /* ACM_GETBY_* */
377 + uint32_t get_decision_by2; /* ACM_GETBY_* */
378 + union {
379 + domaintype_t domainid;
380 + ssidref_t ssidref;
381 + } id1;
382 + union {
383 + domaintype_t domainid;
384 + ssidref_t ssidref;
385 + } id2;
386 + uint32_t hook;
387 + /* OUT */
388 + uint32_t acm_decision;
389 +};
390 +
391 +
392 +#define ACMOP_chgpolicy 6
393 +struct acm_change_policy {
394 + /* IN */
395 + XEN_GUEST_HANDLE_64(void) policy_pushcache;
396 + uint32_t policy_pushcache_size;
397 + XEN_GUEST_HANDLE_64(void) del_array;
398 + uint32_t delarray_size;
399 + XEN_GUEST_HANDLE_64(void) chg_array;
400 + uint32_t chgarray_size;
401 + /* OUT */
402 + /* array with error code */
403 + XEN_GUEST_HANDLE_64(void) err_array;
404 + uint32_t errarray_size;
405 +};
406 +
407 +#define ACMOP_relabeldoms 7
408 +struct acm_relabel_doms {
409 + /* IN */
410 + XEN_GUEST_HANDLE_64(void) relabel_map;
411 + uint32_t relabel_map_size;
412 + /* OUT */
413 + XEN_GUEST_HANDLE_64(void) err_array;
414 + uint32_t errarray_size;
415 +};
416 +
417 +/* future interface to Xen */
418 +struct xen_acmctl {
419 + uint32_t cmd;
420 + uint32_t interface_version;
421 + union {
422 + struct acm_setpolicy setpolicy;
423 + struct acm_getpolicy getpolicy;
424 + struct acm_dumpstats dumpstats;
425 + struct acm_getssid getssid;
426 + struct acm_getdecision getdecision;
427 + struct acm_change_policy change_policy;
428 + struct acm_relabel_doms relabel_doms;
429 + } u;
430 +};
431 +
432 +typedef struct xen_acmctl xen_acmctl_t;
433 +DEFINE_XEN_GUEST_HANDLE(xen_acmctl_t);
434 +
435 +#endif /* __XEN_PUBLIC_ACM_OPS_H__ */
436 +
437 +/*
438 + * Local variables:
439 + * mode: C
440 + * c-set-style: "BSD"
441 + * c-basic-offset: 4
442 + * tab-width: 4
443 + * indent-tabs-mode: nil
444 + * End:
445 + */
446 Index: head-2008-11-25/include/xen/interface/arch-x86/cpuid.h
447 ===================================================================
448 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
449 +++ head-2008-11-25/include/xen/interface/arch-x86/cpuid.h 2008-01-21 11:15:27.000000000 +0100
450 @@ -0,0 +1,68 @@
451 +/******************************************************************************
452 + * arch-x86/cpuid.h
453 + *
454 + * CPUID interface to Xen.
455 + *
456 + * Permission is hereby granted, free of charge, to any person obtaining a copy
457 + * of this software and associated documentation files (the "Software"), to
458 + * deal in the Software without restriction, including without limitation the
459 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
460 + * sell copies of the Software, and to permit persons to whom the Software is
461 + * furnished to do so, subject to the following conditions:
462 + *
463 + * The above copyright notice and this permission notice shall be included in
464 + * all copies or substantial portions of the Software.
465 + *
466 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
467 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
468 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
469 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
470 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
471 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
472 + * DEALINGS IN THE SOFTWARE.
473 + *
474 + * Copyright (c) 2007 Citrix Systems, Inc.
475 + *
476 + * Authors:
477 + * Keir Fraser <keir.fraser@citrix.com>
478 + */
479 +
480 +#ifndef __XEN_PUBLIC_ARCH_X86_CPUID_H__
481 +#define __XEN_PUBLIC_ARCH_X86_CPUID_H__
482 +
483 +/* Xen identification leaves start at 0x40000000. */
484 +#define XEN_CPUID_FIRST_LEAF 0x40000000
485 +#define XEN_CPUID_LEAF(i) (XEN_CPUID_FIRST_LEAF + (i))
486 +
487 +/*
488 + * Leaf 1 (0x40000000)
489 + * EAX: Largest Xen-information leaf. All leaves up to an including @EAX
490 + * are supported by the Xen host.
491 + * EBX-EDX: "XenVMMXenVMM" signature, allowing positive identification
492 + * of a Xen host.
493 + */
494 +#define XEN_CPUID_SIGNATURE_EBX 0x566e6558 /* "XenV" */
495 +#define XEN_CPUID_SIGNATURE_ECX 0x65584d4d /* "MMXe" */
496 +#define XEN_CPUID_SIGNATURE_EDX 0x4d4d566e /* "nVMM" */
497 +
498 +/*
499 + * Leaf 2 (0x40000001)
500 + * EAX[31:16]: Xen major version.
501 + * EAX[15: 0]: Xen minor version.
502 + * EBX-EDX: Reserved (currently all zeroes).
503 + */
504 +
505 +/*
506 + * Leaf 3 (0x40000002)
507 + * EAX: Number of hypercall transfer pages. This register is always guaranteed
508 + * to specify one hypercall page.
509 + * EBX: Base address of Xen-specific MSRs.
510 + * ECX: Features 1. Unused bits are set to zero.
511 + * EDX: Features 2. Unused bits are set to zero.
512 + */
513 +
514 +/* Does the host support MMU_PT_UPDATE_PRESERVE_AD for this guest? */
515 +#define _XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD 0
516 +#define XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD (1u<<0)
517 +
518 +#endif /* __XEN_PUBLIC_ARCH_X86_CPUID_H__ */
519 Index: head-2008-11-25/include/xen/interface/arch-x86/hvm/save.h
520 ===================================================================
521 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
522 +++ head-2008-11-25/include/xen/interface/arch-x86/hvm/save.h 2008-10-29 09:55:56.000000000 +0100
523 @@ -0,0 +1,440 @@
524 +/*
525 + * Structure definitions for HVM state that is held by Xen and must
526 + * be saved along with the domain's memory and device-model state.
527 + *
528 + * Copyright (c) 2007 XenSource Ltd.
529 + *
530 + * Permission is hereby granted, free of charge, to any person obtaining a copy
531 + * of this software and associated documentation files (the "Software"), to
532 + * deal in the Software without restriction, including without limitation the
533 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
534 + * sell copies of the Software, and to permit persons to whom the Software is
535 + * furnished to do so, subject to the following conditions:
536 + *
537 + * The above copyright notice and this permission notice shall be included in
538 + * all copies or substantial portions of the Software.
539 + *
540 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
541 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
542 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
543 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
544 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
545 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
546 + * DEALINGS IN THE SOFTWARE.
547 + */
548 +
549 +#ifndef __XEN_PUBLIC_HVM_SAVE_X86_H__
550 +#define __XEN_PUBLIC_HVM_SAVE_X86_H__
551 +
552 +/*
553 + * Save/restore header: general info about the save file.
554 + */
555 +
556 +#define HVM_FILE_MAGIC 0x54381286
557 +#define HVM_FILE_VERSION 0x00000001
558 +
559 +struct hvm_save_header {
560 + uint32_t magic; /* Must be HVM_FILE_MAGIC */
561 + uint32_t version; /* File format version */
562 + uint64_t changeset; /* Version of Xen that saved this file */
563 + uint32_t cpuid; /* CPUID[0x01][%eax] on the saving machine */
564 + uint32_t pad0;
565 +};
566 +
567 +DECLARE_HVM_SAVE_TYPE(HEADER, 1, struct hvm_save_header);
568 +
569 +
570 +/*
571 + * Processor
572 + */
573 +
574 +struct hvm_hw_cpu {
575 + uint8_t fpu_regs[512];
576 +
577 + uint64_t rax;
578 + uint64_t rbx;
579 + uint64_t rcx;
580 + uint64_t rdx;
581 + uint64_t rbp;
582 + uint64_t rsi;
583 + uint64_t rdi;
584 + uint64_t rsp;
585 + uint64_t r8;
586 + uint64_t r9;
587 + uint64_t r10;
588 + uint64_t r11;
589 + uint64_t r12;
590 + uint64_t r13;
591 + uint64_t r14;
592 + uint64_t r15;
593 +
594 + uint64_t rip;
595 + uint64_t rflags;
596 +
597 + uint64_t cr0;
598 + uint64_t cr2;
599 + uint64_t cr3;
600 + uint64_t cr4;
601 +
602 + uint64_t dr0;
603 + uint64_t dr1;
604 + uint64_t dr2;
605 + uint64_t dr3;
606 + uint64_t dr6;
607 + uint64_t dr7;
608 +
609 + uint32_t cs_sel;
610 + uint32_t ds_sel;
611 + uint32_t es_sel;
612 + uint32_t fs_sel;
613 + uint32_t gs_sel;
614 + uint32_t ss_sel;
615 + uint32_t tr_sel;
616 + uint32_t ldtr_sel;
617 +
618 + uint32_t cs_limit;
619 + uint32_t ds_limit;
620 + uint32_t es_limit;
621 + uint32_t fs_limit;
622 + uint32_t gs_limit;
623 + uint32_t ss_limit;
624 + uint32_t tr_limit;
625 + uint32_t ldtr_limit;
626 + uint32_t idtr_limit;
627 + uint32_t gdtr_limit;
628 +
629 + uint64_t cs_base;
630 + uint64_t ds_base;
631 + uint64_t es_base;
632 + uint64_t fs_base;
633 + uint64_t gs_base;
634 + uint64_t ss_base;
635 + uint64_t tr_base;
636 + uint64_t ldtr_base;
637 + uint64_t idtr_base;
638 + uint64_t gdtr_base;
639 +
640 + uint32_t cs_arbytes;
641 + uint32_t ds_arbytes;
642 + uint32_t es_arbytes;
643 + uint32_t fs_arbytes;
644 + uint32_t gs_arbytes;
645 + uint32_t ss_arbytes;
646 + uint32_t tr_arbytes;
647 + uint32_t ldtr_arbytes;
648 +
649 + uint32_t sysenter_cs;
650 + uint32_t padding0;
651 +
652 + uint64_t sysenter_esp;
653 + uint64_t sysenter_eip;
654 +
655 + /* msr for em64t */
656 + uint64_t shadow_gs;
657 +
658 + /* msr content saved/restored. */
659 + uint64_t msr_flags;
660 + uint64_t msr_lstar;
661 + uint64_t msr_star;
662 + uint64_t msr_cstar;
663 + uint64_t msr_syscall_mask;
664 + uint64_t msr_efer;
665 +
666 + /* guest's idea of what rdtsc() would return */
667 + uint64_t tsc;
668 +
669 + /* pending event, if any */
670 + union {
671 + uint32_t pending_event;
672 + struct {
673 + uint8_t pending_vector:8;
674 + uint8_t pending_type:3;
675 + uint8_t pending_error_valid:1;
676 + uint32_t pending_reserved:19;
677 + uint8_t pending_valid:1;
678 + };
679 + };
680 + /* error code for pending event */
681 + uint32_t error_code;
682 +};
683 +
684 +DECLARE_HVM_SAVE_TYPE(CPU, 2, struct hvm_hw_cpu);
685 +
686 +
687 +/*
688 + * PIC
689 + */
690 +
691 +struct hvm_hw_vpic {
692 + /* IR line bitmasks. */
693 + uint8_t irr;
694 + uint8_t imr;
695 + uint8_t isr;
696 +
697 + /* Line IRx maps to IRQ irq_base+x */
698 + uint8_t irq_base;
699 +
700 + /*
701 + * Where are we in ICW2-4 initialisation (0 means no init in progress)?
702 + * Bits 0-1 (=x): Next write at A=1 sets ICW(x+1).
703 + * Bit 2: ICW1.IC4 (1 == ICW4 included in init sequence)
704 + * Bit 3: ICW1.SNGL (0 == ICW3 included in init sequence)
705 + */
706 + uint8_t init_state:4;
707 +
708 + /* IR line with highest priority. */
709 + uint8_t priority_add:4;
710 +
711 + /* Reads from A=0 obtain ISR or IRR? */
712 + uint8_t readsel_isr:1;
713 +
714 + /* Reads perform a polling read? */
715 + uint8_t poll:1;
716 +
717 + /* Automatically clear IRQs from the ISR during INTA? */
718 + uint8_t auto_eoi:1;
719 +
720 + /* Automatically rotate IRQ priorities during AEOI? */
721 + uint8_t rotate_on_auto_eoi:1;
722 +
723 + /* Exclude slave inputs when considering in-service IRQs? */
724 + uint8_t special_fully_nested_mode:1;
725 +
726 + /* Special mask mode excludes masked IRs from AEOI and priority checks. */
727 + uint8_t special_mask_mode:1;
728 +
729 + /* Is this a master PIC or slave PIC? (NB. This is not programmable.) */
730 + uint8_t is_master:1;
731 +
732 + /* Edge/trigger selection. */
733 + uint8_t elcr;
734 +
735 + /* Virtual INT output. */
736 + uint8_t int_output;
737 +};
738 +
739 +DECLARE_HVM_SAVE_TYPE(PIC, 3, struct hvm_hw_vpic);
740 +
741 +
742 +/*
743 + * IO-APIC
744 + */
745 +
746 +#ifdef __ia64__
747 +#define VIOAPIC_IS_IOSAPIC 1
748 +#define VIOAPIC_NUM_PINS 24
749 +#else
750 +#define VIOAPIC_NUM_PINS 48 /* 16 ISA IRQs, 32 non-legacy PCI IRQS. */
751 +#endif
752 +
753 +struct hvm_hw_vioapic {
754 + uint64_t base_address;
755 + uint32_t ioregsel;
756 + uint32_t id;
757 + union vioapic_redir_entry
758 + {
759 + uint64_t bits;
760 + struct {
761 + uint8_t vector;
762 + uint8_t delivery_mode:3;
763 + uint8_t dest_mode:1;
764 + uint8_t delivery_status:1;
765 + uint8_t polarity:1;
766 + uint8_t remote_irr:1;
767 + uint8_t trig_mode:1;
768 + uint8_t mask:1;
769 + uint8_t reserve:7;
770 +#if !VIOAPIC_IS_IOSAPIC
771 + uint8_t reserved[4];
772 + uint8_t dest_id;
773 +#else
774 + uint8_t reserved[3];
775 + uint16_t dest_id;
776 +#endif
777 + } fields;
778 + } redirtbl[VIOAPIC_NUM_PINS];
779 +};
780 +
781 +DECLARE_HVM_SAVE_TYPE(IOAPIC, 4, struct hvm_hw_vioapic);
782 +
783 +
784 +/*
785 + * LAPIC
786 + */
787 +
788 +struct hvm_hw_lapic {
789 + uint64_t apic_base_msr;
790 + uint32_t disabled; /* VLAPIC_xx_DISABLED */
791 + uint32_t timer_divisor;
792 +};
793 +
794 +DECLARE_HVM_SAVE_TYPE(LAPIC, 5, struct hvm_hw_lapic);
795 +
796 +struct hvm_hw_lapic_regs {
797 + uint8_t data[1024];
798 +};
799 +
800 +DECLARE_HVM_SAVE_TYPE(LAPIC_REGS, 6, struct hvm_hw_lapic_regs);
801 +
802 +
803 +/*
804 + * IRQs
805 + */
806 +
807 +struct hvm_hw_pci_irqs {
808 + /*
809 + * Virtual interrupt wires for a single PCI bus.
810 + * Indexed by: device*4 + INTx#.
811 + */
812 + union {
813 + DECLARE_BITMAP(i, 32*4);
814 + uint64_t pad[2];
815 + };
816 +};
817 +
818 +DECLARE_HVM_SAVE_TYPE(PCI_IRQ, 7, struct hvm_hw_pci_irqs);
819 +
820 +struct hvm_hw_isa_irqs {
821 + /*
822 + * Virtual interrupt wires for ISA devices.
823 + * Indexed by ISA IRQ (assumes no ISA-device IRQ sharing).
824 + */
825 + union {
826 + DECLARE_BITMAP(i, 16);
827 + uint64_t pad[1];
828 + };
829 +};
830 +
831 +DECLARE_HVM_SAVE_TYPE(ISA_IRQ, 8, struct hvm_hw_isa_irqs);
832 +
833 +struct hvm_hw_pci_link {
834 + /*
835 + * PCI-ISA interrupt router.
836 + * Each PCI <device:INTx#> is 'wire-ORed' into one of four links using
837 + * the traditional 'barber's pole' mapping ((device + INTx#) & 3).
838 + * The router provides a programmable mapping from each link to a GSI.
839 + */
840 + uint8_t route[4];
841 + uint8_t pad0[4];
842 +};
843 +
844 +DECLARE_HVM_SAVE_TYPE(PCI_LINK, 9, struct hvm_hw_pci_link);
845 +
846 +/*
847 + * PIT
848 + */
849 +
850 +struct hvm_hw_pit {
851 + struct hvm_hw_pit_channel {
852 + uint32_t count; /* can be 65536 */
853 + uint16_t latched_count;
854 + uint8_t count_latched;
855 + uint8_t status_latched;
856 + uint8_t status;
857 + uint8_t read_state;
858 + uint8_t write_state;
859 + uint8_t write_latch;
860 + uint8_t rw_mode;
861 + uint8_t mode;
862 + uint8_t bcd; /* not supported */
863 + uint8_t gate; /* timer start */
864 + } channels[3]; /* 3 x 16 bytes */
865 + uint32_t speaker_data_on;
866 + uint32_t pad0;
867 +};
868 +
869 +DECLARE_HVM_SAVE_TYPE(PIT, 10, struct hvm_hw_pit);
870 +
871 +
872 +/*
873 + * RTC
874 + */
875 +
876 +#define RTC_CMOS_SIZE 14
877 +struct hvm_hw_rtc {
878 + /* CMOS bytes */
879 + uint8_t cmos_data[RTC_CMOS_SIZE];
880 + /* Index register for 2-part operations */
881 + uint8_t cmos_index;
882 + uint8_t pad0;
883 +};
884 +
885 +DECLARE_HVM_SAVE_TYPE(RTC, 11, struct hvm_hw_rtc);
886 +
887 +
888 +/*
889 + * HPET
890 + */
891 +
892 +#define HPET_TIMER_NUM 3 /* 3 timers supported now */
893 +struct hvm_hw_hpet {
894 + /* Memory-mapped, software visible registers */
895 + uint64_t capability; /* capabilities */
896 + uint64_t res0; /* reserved */
897 + uint64_t config; /* configuration */
898 + uint64_t res1; /* reserved */
899 + uint64_t isr; /* interrupt status reg */
900 + uint64_t res2[25]; /* reserved */
901 + uint64_t mc64; /* main counter */
902 + uint64_t res3; /* reserved */
903 + struct { /* timers */
904 + uint64_t config; /* configuration/cap */
905 + uint64_t cmp; /* comparator */
906 + uint64_t fsb; /* FSB route, not supported now */
907 + uint64_t res4; /* reserved */
908 + } timers[HPET_TIMER_NUM];
909 + uint64_t res5[4*(24-HPET_TIMER_NUM)]; /* reserved, up to 0x3ff */
910 +
911 + /* Hidden register state */
912 + uint64_t period[HPET_TIMER_NUM]; /* Last value written to comparator */
913 +};
914 +
915 +DECLARE_HVM_SAVE_TYPE(HPET, 12, struct hvm_hw_hpet);
916 +
917 +
918 +/*
919 + * PM timer
920 + */
921 +
922 +struct hvm_hw_pmtimer {
923 + uint32_t tmr_val; /* PM_TMR_BLK.TMR_VAL: 32bit free-running counter */
924 + uint16_t pm1a_sts; /* PM1a_EVT_BLK.PM1a_STS: status register */
925 + uint16_t pm1a_en; /* PM1a_EVT_BLK.PM1a_EN: enable register */
926 +};
927 +
928 +DECLARE_HVM_SAVE_TYPE(PMTIMER, 13, struct hvm_hw_pmtimer);
929 +
930 +/*
931 + * MTRR MSRs
932 + */
933 +
934 +struct hvm_hw_mtrr {
935 +#define MTRR_VCNT 8
936 +#define NUM_FIXED_MSR 11
937 + uint64_t msr_pat_cr;
938 + /* mtrr physbase & physmask msr pair*/
939 + uint64_t msr_mtrr_var[MTRR_VCNT*2];
940 + uint64_t msr_mtrr_fixed[NUM_FIXED_MSR];
941 + uint64_t msr_mtrr_cap;
942 + uint64_t msr_mtrr_def_type;
943 +};
944 +
945 +DECLARE_HVM_SAVE_TYPE(MTRR, 14, struct hvm_hw_mtrr);
946 +
947 +/*
948 + * Viridian hypervisor context.
949 + */
950 +
951 +struct hvm_viridian_context {
952 + uint64_t hypercall_gpa;
953 + uint64_t guest_os_id;
954 +};
955 +
956 +DECLARE_HVM_SAVE_TYPE(VIRIDIAN, 15, struct hvm_viridian_context);
957 +
958 +/*
959 + * Largest type-code in use
960 + */
961 +#define HVM_SAVE_CODE_MAX 15
962 +
963 +#endif /* __XEN_PUBLIC_HVM_SAVE_X86_H__ */
964 Index: head-2008-11-25/include/xen/interface/arch-x86/xen-mca.h
965 ===================================================================
966 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
967 +++ head-2008-11-25/include/xen/interface/arch-x86/xen-mca.h 2008-09-01 12:07:31.000000000 +0200
968 @@ -0,0 +1,279 @@
969 +/******************************************************************************
970 + * arch-x86/mca.h
971 + *
972 + * Contributed by Advanced Micro Devices, Inc.
973 + * Author: Christoph Egger <Christoph.Egger@amd.com>
974 + *
975 + * Guest OS machine check interface to x86 Xen.
976 + *
977 + * Permission is hereby granted, free of charge, to any person obtaining a copy
978 + * of this software and associated documentation files (the "Software"), to
979 + * deal in the Software without restriction, including without limitation the
980 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
981 + * sell copies of the Software, and to permit persons to whom the Software is
982 + * furnished to do so, subject to the following conditions:
983 + *
984 + * The above copyright notice and this permission notice shall be included in
985 + * all copies or substantial portions of the Software.
986 + *
987 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
988 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
989 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
990 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
991 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
992 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
993 + * DEALINGS IN THE SOFTWARE.
994 + */
995 +
996 +/* Full MCA functionality has the following Usecases from the guest side:
997 + *
998 + * Must have's:
999 + * 1. Dom0 and DomU register machine check trap callback handlers
1000 + * (already done via "set_trap_table" hypercall)
1001 + * 2. Dom0 registers machine check event callback handler
1002 + * (doable via EVTCHNOP_bind_virq)
1003 + * 3. Dom0 and DomU fetches machine check data
1004 + * 4. Dom0 wants Xen to notify a DomU
1005 + * 5. Dom0 gets DomU ID from physical address
1006 + * 6. Dom0 wants Xen to kill DomU (already done for "xm destroy")
1007 + *
1008 + * Nice to have's:
1009 + * 7. Dom0 wants Xen to deactivate a physical CPU
1010 + * This is better done as separate task, physical CPU hotplugging,
1011 + * and hypercall(s) should be sysctl's
1012 + * 8. Page migration proposed from Xen NUMA work, where Dom0 can tell Xen to
1013 + * move a DomU (or Dom0 itself) away from a malicious page
1014 + * producing correctable errors.
1015 + * 9. offlining physical page:
1016 + * Xen free's and never re-uses a certain physical page.
1017 + * 10. Testfacility: Allow Dom0 to write values into machine check MSR's
1018 + * and tell Xen to trigger a machine check
1019 + */
1020 +
1021 +#ifndef __XEN_PUBLIC_ARCH_X86_MCA_H__
1022 +#define __XEN_PUBLIC_ARCH_X86_MCA_H__
1023 +
1024 +/* Hypercall */
1025 +#define __HYPERVISOR_mca __HYPERVISOR_arch_0
1026 +
1027 +#define XEN_MCA_INTERFACE_VERSION 0x03000001
1028 +
1029 +/* IN: Dom0 calls hypercall from MC event handler. */
1030 +#define XEN_MC_CORRECTABLE 0x0
1031 +/* IN: Dom0/DomU calls hypercall from MC trap handler. */
1032 +#define XEN_MC_TRAP 0x1
1033 +/* XEN_MC_CORRECTABLE and XEN_MC_TRAP are mutually exclusive. */
1034 +
1035 +/* OUT: All is ok */
1036 +#define XEN_MC_OK 0x0
1037 +/* OUT: Domain could not fetch data. */
1038 +#define XEN_MC_FETCHFAILED 0x1
1039 +/* OUT: There was no machine check data to fetch. */
1040 +#define XEN_MC_NODATA 0x2
1041 +/* OUT: Between notification time and this hypercall an other
1042 + * (most likely) correctable error happened. The fetched data,
1043 + * does not match the original machine check data. */
1044 +#define XEN_MC_NOMATCH 0x4
1045 +
1046 +/* OUT: DomU did not register MC NMI handler. Try something else. */
1047 +#define XEN_MC_CANNOTHANDLE 0x8
1048 +/* OUT: Notifying DomU failed. Retry later or try something else. */
1049 +#define XEN_MC_NOTDELIVERED 0x10
1050 +/* Note, XEN_MC_CANNOTHANDLE and XEN_MC_NOTDELIVERED are mutually exclusive. */
1051 +
1052 +
1053 +#ifndef __ASSEMBLY__
1054 +
1055 +#define VIRQ_MCA VIRQ_ARCH_0 /* G. (DOM0) Machine Check Architecture */
1056 +
1057 +/*
1058 + * Machine Check Architecure:
1059 + * structs are read-only and used to report all kinds of
1060 + * correctable and uncorrectable errors detected by the HW.
1061 + * Dom0 and DomU: register a handler to get notified.
1062 + * Dom0 only: Correctable errors are reported via VIRQ_MCA
1063 + * Dom0 and DomU: Uncorrectable errors are reported via nmi handlers
1064 + */
1065 +#define MC_TYPE_GLOBAL 0
1066 +#define MC_TYPE_BANK 1
1067 +#define MC_TYPE_EXTENDED 2
1068 +
1069 +struct mcinfo_common {
1070 + uint16_t type; /* structure type */
1071 + uint16_t size; /* size of this struct in bytes */
1072 +};
1073 +
1074 +
1075 +#define MC_FLAG_CORRECTABLE (1 << 0)
1076 +#define MC_FLAG_UNCORRECTABLE (1 << 1)
1077 +
1078 +/* contains global x86 mc information */
1079 +struct mcinfo_global {
1080 + struct mcinfo_common common;
1081 +
1082 + /* running domain at the time in error (most likely the impacted one) */
1083 + uint16_t mc_domid;
1084 + uint32_t mc_socketid; /* physical socket of the physical core */
1085 + uint16_t mc_coreid; /* physical impacted core */
1086 + uint16_t mc_core_threadid; /* core thread of physical core */
1087 + uint16_t mc_vcpuid; /* virtual cpu scheduled for mc_domid */
1088 + uint64_t mc_gstatus; /* global status */
1089 + uint32_t mc_flags;
1090 +};
1091 +
1092 +/* contains bank local x86 mc information */
1093 +struct mcinfo_bank {
1094 + struct mcinfo_common common;
1095 +
1096 + uint16_t mc_bank; /* bank nr */
1097 + uint16_t mc_domid; /* Usecase 5: domain referenced by mc_addr on dom0
1098 + * and if mc_addr is valid. Never valid on DomU. */
1099 + uint64_t mc_status; /* bank status */
1100 + uint64_t mc_addr; /* bank address, only valid
1101 + * if addr bit is set in mc_status */
1102 + uint64_t mc_misc;
1103 +};
1104 +
1105 +
1106 +struct mcinfo_msr {
1107 + uint64_t reg; /* MSR */
1108 + uint64_t value; /* MSR value */
1109 +};
1110 +
1111 +/* contains mc information from other
1112 + * or additional mc MSRs */
1113 +struct mcinfo_extended {
1114 + struct mcinfo_common common;
1115 +
1116 + /* You can fill up to five registers.
1117 + * If you need more, then use this structure
1118 + * multiple times. */
1119 +
1120 + uint32_t mc_msrs; /* Number of msr with valid values. */
1121 + struct mcinfo_msr mc_msr[5];
1122 +};
1123 +
1124 +#define MCINFO_HYPERCALLSIZE 1024
1125 +#define MCINFO_MAXSIZE 768
1126 +
1127 +struct mc_info {
1128 + /* Number of mcinfo_* entries in mi_data */
1129 + uint32_t mi_nentries;
1130 +
1131 + uint8_t mi_data[MCINFO_MAXSIZE - sizeof(uint32_t)];
1132 +};
1133 +typedef struct mc_info mc_info_t;
1134 +
1135 +
1136 +
1137 +/*
1138 + * OS's should use these instead of writing their own lookup function
1139 + * each with its own bugs and drawbacks.
1140 + * We use macros instead of static inline functions to allow guests
1141 + * to include this header in assembly files (*.S).
1142 + */
1143 +/* Prototype:
1144 + * uint32_t x86_mcinfo_nentries(struct mc_info *mi);
1145 + */
1146 +#define x86_mcinfo_nentries(_mi) \
1147 + (_mi)->mi_nentries
1148 +/* Prototype:
1149 + * struct mcinfo_common *x86_mcinfo_first(struct mc_info *mi);
1150 + */
1151 +#define x86_mcinfo_first(_mi) \
1152 + (struct mcinfo_common *)((_mi)->mi_data)
1153 +/* Prototype:
1154 + * struct mcinfo_common *x86_mcinfo_next(struct mcinfo_common *mic);
1155 + */
1156 +#define x86_mcinfo_next(_mic) \
1157 + (struct mcinfo_common *)((uint8_t *)(_mic) + (_mic)->size)
1158 +
1159 +/* Prototype:
1160 + * void x86_mcinfo_lookup(void *ret, struct mc_info *mi, uint16_t type);
1161 + */
1162 +#define x86_mcinfo_lookup(_ret, _mi, _type) \
1163 + do { \
1164 + uint32_t found, i; \
1165 + struct mcinfo_common *_mic; \
1166 + \
1167 + found = 0; \
1168 + (_ret) = NULL; \
1169 + if (_mi == NULL) break; \
1170 + _mic = x86_mcinfo_first(_mi); \
1171 + for (i = 0; i < x86_mcinfo_nentries(_mi); i++) { \
1172 + if (_mic->type == (_type)) { \
1173 + found = 1; \
1174 + break; \
1175 + } \
1176 + _mic = x86_mcinfo_next(_mic); \
1177 + } \
1178 + (_ret) = found ? _mic : NULL; \
1179 + } while (0)
1180 +
1181 +
1182 +/* Usecase 1
1183 + * Register machine check trap callback handler
1184 + * (already done via "set_trap_table" hypercall)
1185 + */
1186 +
1187 +/* Usecase 2
1188 + * Dom0 registers machine check event callback handler
1189 + * done by EVTCHNOP_bind_virq
1190 + */
1191 +
1192 +/* Usecase 3
1193 + * Fetch machine check data from hypervisor.
1194 + * Note, this hypercall is special, because both Dom0 and DomU must use this.
1195 + */
1196 +#define XEN_MC_fetch 1
1197 +struct xen_mc_fetch {
1198 + /* IN/OUT variables. */
1199 + uint32_t flags;
1200 +
1201 +/* IN: XEN_MC_CORRECTABLE, XEN_MC_TRAP */
1202 +/* OUT: XEN_MC_OK, XEN_MC_FETCHFAILED, XEN_MC_NODATA, XEN_MC_NOMATCH */
1203 +
1204 + /* OUT variables. */
1205 + uint32_t fetch_idx; /* only useful for Dom0 for the notify hypercall */
1206 + struct mc_info mc_info;
1207 +};
1208 +typedef struct xen_mc_fetch xen_mc_fetch_t;
1209 +DEFINE_XEN_GUEST_HANDLE(xen_mc_fetch_t);
1210 +
1211 +
1212 +/* Usecase 4
1213 + * This tells the hypervisor to notify a DomU about the machine check error
1214 + */
1215 +#define XEN_MC_notifydomain 2
1216 +struct xen_mc_notifydomain {
1217 + /* IN variables. */
1218 + uint16_t mc_domid; /* The unprivileged domain to notify. */
1219 + uint16_t mc_vcpuid; /* The vcpu in mc_domid to notify.
1220 + * Usually echo'd value from the fetch hypercall. */
1221 + uint32_t fetch_idx; /* echo'd value from the fetch hypercall. */
1222 +
1223 + /* IN/OUT variables. */
1224 + uint32_t flags;
1225 +
1226 +/* IN: XEN_MC_CORRECTABLE, XEN_MC_TRAP */
1227 +/* OUT: XEN_MC_OK, XEN_MC_CANNOTHANDLE, XEN_MC_NOTDELIVERED, XEN_MC_NOMATCH */
1228 +};
1229 +typedef struct xen_mc_notifydomain xen_mc_notifydomain_t;
1230 +DEFINE_XEN_GUEST_HANDLE(xen_mc_notifydomain_t);
1231 +
1232 +
1233 +struct xen_mc {
1234 + uint32_t cmd;
1235 + uint32_t interface_version; /* XEN_MCA_INTERFACE_VERSION */
1236 + union {
1237 + struct xen_mc_fetch mc_fetch;
1238 + struct xen_mc_notifydomain mc_notifydomain;
1239 + uint8_t pad[MCINFO_HYPERCALLSIZE];
1240 + } u;
1241 +};
1242 +typedef struct xen_mc xen_mc_t;
1243 +DEFINE_XEN_GUEST_HANDLE(xen_mc_t);
1244 +
1245 +#endif /* __ASSEMBLY__ */
1246 +
1247 +#endif /* __XEN_PUBLIC_ARCH_X86_MCA_H__ */
1248 Index: head-2008-11-25/include/xen/interface/arch-x86/xen-x86_32.h
1249 ===================================================================
1250 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1251 +++ head-2008-11-25/include/xen/interface/arch-x86/xen-x86_32.h 2008-07-21 11:00:33.000000000 +0200
1252 @@ -0,0 +1,180 @@
1253 +/******************************************************************************
1254 + * xen-x86_32.h
1255 + *
1256 + * Guest OS interface to x86 32-bit Xen.
1257 + *
1258 + * Permission is hereby granted, free of charge, to any person obtaining a copy
1259 + * of this software and associated documentation files (the "Software"), to
1260 + * deal in the Software without restriction, including without limitation the
1261 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
1262 + * sell copies of the Software, and to permit persons to whom the Software is
1263 + * furnished to do so, subject to the following conditions:
1264 + *
1265 + * The above copyright notice and this permission notice shall be included in
1266 + * all copies or substantial portions of the Software.
1267 + *
1268 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1269 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1270 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1271 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1272 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1273 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1274 + * DEALINGS IN THE SOFTWARE.
1275 + *
1276 + * Copyright (c) 2004-2007, K A Fraser
1277 + */
1278 +
1279 +#ifndef __XEN_PUBLIC_ARCH_X86_XEN_X86_32_H__
1280 +#define __XEN_PUBLIC_ARCH_X86_XEN_X86_32_H__
1281 +
1282 +/*
1283 + * Hypercall interface:
1284 + * Input: %ebx, %ecx, %edx, %esi, %edi (arguments 1-5)
1285 + * Output: %eax
1286 + * Access is via hypercall page (set up by guest loader or via a Xen MSR):
1287 + * call hypercall_page + hypercall-number * 32
1288 + * Clobbered: Argument registers (e.g., 2-arg hypercall clobbers %ebx,%ecx)
1289 + */
1290 +
1291 +#if __XEN_INTERFACE_VERSION__ < 0x00030203
1292 +/*
1293 + * Legacy hypercall interface:
1294 + * As above, except the entry sequence to the hypervisor is:
1295 + * mov $hypercall-number*32,%eax ; int $0x82
1296 + */
1297 +#define TRAP_INSTR "int $0x82"
1298 +#endif
1299 +
1300 +/*
1301 + * These flat segments are in the Xen-private section of every GDT. Since these
1302 + * are also present in the initial GDT, many OSes will be able to avoid
1303 + * installing their own GDT.
1304 + */
1305 +#define FLAT_RING1_CS 0xe019 /* GDT index 259 */
1306 +#define FLAT_RING1_DS 0xe021 /* GDT index 260 */
1307 +#define FLAT_RING1_SS 0xe021 /* GDT index 260 */
1308 +#define FLAT_RING3_CS 0xe02b /* GDT index 261 */
1309 +#define FLAT_RING3_DS 0xe033 /* GDT index 262 */
1310 +#define FLAT_RING3_SS 0xe033 /* GDT index 262 */
1311 +
1312 +#define FLAT_KERNEL_CS FLAT_RING1_CS
1313 +#define FLAT_KERNEL_DS FLAT_RING1_DS
1314 +#define FLAT_KERNEL_SS FLAT_RING1_SS
1315 +#define FLAT_USER_CS FLAT_RING3_CS
1316 +#define FLAT_USER_DS FLAT_RING3_DS
1317 +#define FLAT_USER_SS FLAT_RING3_SS
1318 +
1319 +#define __HYPERVISOR_VIRT_START_PAE 0xF5800000
1320 +#define __MACH2PHYS_VIRT_START_PAE 0xF5800000
1321 +#define __MACH2PHYS_VIRT_END_PAE 0xF6800000
1322 +#define HYPERVISOR_VIRT_START_PAE \
1323 + mk_unsigned_long(__HYPERVISOR_VIRT_START_PAE)
1324 +#define MACH2PHYS_VIRT_START_PAE \
1325 + mk_unsigned_long(__MACH2PHYS_VIRT_START_PAE)
1326 +#define MACH2PHYS_VIRT_END_PAE \
1327 + mk_unsigned_long(__MACH2PHYS_VIRT_END_PAE)
1328 +
1329 +/* Non-PAE bounds are obsolete. */
1330 +#define __HYPERVISOR_VIRT_START_NONPAE 0xFC000000
1331 +#define __MACH2PHYS_VIRT_START_NONPAE 0xFC000000
1332 +#define __MACH2PHYS_VIRT_END_NONPAE 0xFC400000
1333 +#define HYPERVISOR_VIRT_START_NONPAE \
1334 + mk_unsigned_long(__HYPERVISOR_VIRT_START_NONPAE)
1335 +#define MACH2PHYS_VIRT_START_NONPAE \
1336 + mk_unsigned_long(__MACH2PHYS_VIRT_START_NONPAE)
1337 +#define MACH2PHYS_VIRT_END_NONPAE \
1338 + mk_unsigned_long(__MACH2PHYS_VIRT_END_NONPAE)
1339 +
1340 +#define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_PAE
1341 +#define __MACH2PHYS_VIRT_START __MACH2PHYS_VIRT_START_PAE
1342 +#define __MACH2PHYS_VIRT_END __MACH2PHYS_VIRT_END_PAE
1343 +
1344 +#ifndef HYPERVISOR_VIRT_START
1345 +#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
1346 +#endif
1347 +
1348 +#define MACH2PHYS_VIRT_START mk_unsigned_long(__MACH2PHYS_VIRT_START)
1349 +#define MACH2PHYS_VIRT_END mk_unsigned_long(__MACH2PHYS_VIRT_END)
1350 +#define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>2)
1351 +#ifndef machine_to_phys_mapping
1352 +#define machine_to_phys_mapping ((unsigned long *)MACH2PHYS_VIRT_START)
1353 +#endif
1354 +
1355 +/* 32-/64-bit invariability for control interfaces (domctl/sysctl). */
1356 +#if defined(__XEN__) || defined(__XEN_TOOLS__)
1357 +#undef ___DEFINE_XEN_GUEST_HANDLE
1358 +#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
1359 + typedef struct { type *p; } \
1360 + __guest_handle_ ## name; \
1361 + typedef struct { union { type *p; uint64_aligned_t q; }; } \
1362 + __guest_handle_64_ ## name
1363 +#undef set_xen_guest_handle
1364 +#define set_xen_guest_handle(hnd, val) \
1365 + do { if ( sizeof(hnd) == 8 ) *(uint64_t *)&(hnd) = 0; \
1366 + (hnd).p = val; \
1367 + } while ( 0 )
1368 +#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
1369 +#define __XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name
1370 +#define XEN_GUEST_HANDLE_64(name) __XEN_GUEST_HANDLE_64(name)
1371 +#endif
1372 +
1373 +#ifndef __ASSEMBLY__
1374 +
1375 +struct cpu_user_regs {
1376 + uint32_t ebx;
1377 + uint32_t ecx;
1378 + uint32_t edx;
1379 + uint32_t esi;
1380 + uint32_t edi;
1381 + uint32_t ebp;
1382 + uint32_t eax;
1383 + uint16_t error_code; /* private */
1384 + uint16_t entry_vector; /* private */
1385 + uint32_t eip;
1386 + uint16_t cs;
1387 + uint8_t saved_upcall_mask;
1388 + uint8_t _pad0;
1389 + uint32_t eflags; /* eflags.IF == !saved_upcall_mask */
1390 + uint32_t esp;
1391 + uint16_t ss, _pad1;
1392 + uint16_t es, _pad2;
1393 + uint16_t ds, _pad3;
1394 + uint16_t fs, _pad4;
1395 + uint16_t gs, _pad5;
1396 +};
1397 +typedef struct cpu_user_regs cpu_user_regs_t;
1398 +DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t);
1399 +
1400 +/*
1401 + * Page-directory addresses above 4GB do not fit into architectural %cr3.
1402 + * When accessing %cr3, or equivalent field in vcpu_guest_context, guests
1403 + * must use the following accessor macros to pack/unpack valid MFNs.
1404 + */
1405 +#define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20))
1406 +#define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20))
1407 +
1408 +struct arch_vcpu_info {
1409 + unsigned long cr2;
1410 + unsigned long pad[5]; /* sizeof(vcpu_info_t) == 64 */
1411 +};
1412 +typedef struct arch_vcpu_info arch_vcpu_info_t;
1413 +
1414 +struct xen_callback {
1415 + unsigned long cs;
1416 + unsigned long eip;
1417 +};
1418 +typedef struct xen_callback xen_callback_t;
1419 +
1420 +#endif /* !__ASSEMBLY__ */
1421 +
1422 +#endif /* __XEN_PUBLIC_ARCH_X86_XEN_X86_32_H__ */
1423 +
1424 +/*
1425 + * Local variables:
1426 + * mode: C
1427 + * c-set-style: "BSD"
1428 + * c-basic-offset: 4
1429 + * tab-width: 4
1430 + * indent-tabs-mode: nil
1431 + * End:
1432 + */
1433 Index: head-2008-11-25/include/xen/interface/arch-x86/xen-x86_64.h
1434 ===================================================================
1435 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1436 +++ head-2008-11-25/include/xen/interface/arch-x86/xen-x86_64.h 2008-04-02 12:34:02.000000000 +0200
1437 @@ -0,0 +1,212 @@
1438 +/******************************************************************************
1439 + * xen-x86_64.h
1440 + *
1441 + * Guest OS interface to x86 64-bit Xen.
1442 + *
1443 + * Permission is hereby granted, free of charge, to any person obtaining a copy
1444 + * of this software and associated documentation files (the "Software"), to
1445 + * deal in the Software without restriction, including without limitation the
1446 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
1447 + * sell copies of the Software, and to permit persons to whom the Software is
1448 + * furnished to do so, subject to the following conditions:
1449 + *
1450 + * The above copyright notice and this permission notice shall be included in
1451 + * all copies or substantial portions of the Software.
1452 + *
1453 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1454 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1455 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1456 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1457 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1458 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1459 + * DEALINGS IN THE SOFTWARE.
1460 + *
1461 + * Copyright (c) 2004-2006, K A Fraser
1462 + */
1463 +
1464 +#ifndef __XEN_PUBLIC_ARCH_X86_XEN_X86_64_H__
1465 +#define __XEN_PUBLIC_ARCH_X86_XEN_X86_64_H__
1466 +
1467 +/*
1468 + * Hypercall interface:
1469 + * Input: %rdi, %rsi, %rdx, %r10, %r8 (arguments 1-5)
1470 + * Output: %rax
1471 + * Access is via hypercall page (set up by guest loader or via a Xen MSR):
1472 + * call hypercall_page + hypercall-number * 32
1473 + * Clobbered: argument registers (e.g., 2-arg hypercall clobbers %rdi,%rsi)
1474 + */
1475 +
1476 +#if __XEN_INTERFACE_VERSION__ < 0x00030203
1477 +/*
1478 + * Legacy hypercall interface:
1479 + * As above, except the entry sequence to the hypervisor is:
1480 + * mov $hypercall-number*32,%eax ; syscall
1481 + * Clobbered: %rcx, %r11, argument registers (as above)
1482 + */
1483 +#define TRAP_INSTR "syscall"
1484 +#endif
1485 +
1486 +/*
1487 + * 64-bit segment selectors
1488 + * These flat segments are in the Xen-private section of every GDT. Since these
1489 + * are also present in the initial GDT, many OSes will be able to avoid
1490 + * installing their own GDT.
1491 + */
1492 +
1493 +#define FLAT_RING3_CS32 0xe023 /* GDT index 260 */
1494 +#define FLAT_RING3_CS64 0xe033 /* GDT index 261 */
1495 +#define FLAT_RING3_DS32 0xe02b /* GDT index 262 */
1496 +#define FLAT_RING3_DS64 0x0000 /* NULL selector */
1497 +#define FLAT_RING3_SS32 0xe02b /* GDT index 262 */
1498 +#define FLAT_RING3_SS64 0xe02b /* GDT index 262 */
1499 +
1500 +#define FLAT_KERNEL_DS64 FLAT_RING3_DS64
1501 +#define FLAT_KERNEL_DS32 FLAT_RING3_DS32
1502 +#define FLAT_KERNEL_DS FLAT_KERNEL_DS64
1503 +#define FLAT_KERNEL_CS64 FLAT_RING3_CS64
1504 +#define FLAT_KERNEL_CS32 FLAT_RING3_CS32
1505 +#define FLAT_KERNEL_CS FLAT_KERNEL_CS64
1506 +#define FLAT_KERNEL_SS64 FLAT_RING3_SS64
1507 +#define FLAT_KERNEL_SS32 FLAT_RING3_SS32
1508 +#define FLAT_KERNEL_SS FLAT_KERNEL_SS64
1509 +
1510 +#define FLAT_USER_DS64 FLAT_RING3_DS64
1511 +#define FLAT_USER_DS32 FLAT_RING3_DS32
1512 +#define FLAT_USER_DS FLAT_USER_DS64
1513 +#define FLAT_USER_CS64 FLAT_RING3_CS64
1514 +#define FLAT_USER_CS32 FLAT_RING3_CS32
1515 +#define FLAT_USER_CS FLAT_USER_CS64
1516 +#define FLAT_USER_SS64 FLAT_RING3_SS64
1517 +#define FLAT_USER_SS32 FLAT_RING3_SS32
1518 +#define FLAT_USER_SS FLAT_USER_SS64
1519 +
1520 +#define __HYPERVISOR_VIRT_START 0xFFFF800000000000
1521 +#define __HYPERVISOR_VIRT_END 0xFFFF880000000000
1522 +#define __MACH2PHYS_VIRT_START 0xFFFF800000000000
1523 +#define __MACH2PHYS_VIRT_END 0xFFFF804000000000
1524 +
1525 +#ifndef HYPERVISOR_VIRT_START
1526 +#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
1527 +#define HYPERVISOR_VIRT_END mk_unsigned_long(__HYPERVISOR_VIRT_END)
1528 +#endif
1529 +
1530 +#define MACH2PHYS_VIRT_START mk_unsigned_long(__MACH2PHYS_VIRT_START)
1531 +#define MACH2PHYS_VIRT_END mk_unsigned_long(__MACH2PHYS_VIRT_END)
1532 +#define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>3)
1533 +#ifndef machine_to_phys_mapping
1534 +#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
1535 +#endif
1536 +
1537 +/*
1538 + * int HYPERVISOR_set_segment_base(unsigned int which, unsigned long base)
1539 + * @which == SEGBASE_* ; @base == 64-bit base address
1540 + * Returns 0 on success.
1541 + */
1542 +#define SEGBASE_FS 0
1543 +#define SEGBASE_GS_USER 1
1544 +#define SEGBASE_GS_KERNEL 2
1545 +#define SEGBASE_GS_USER_SEL 3 /* Set user %gs specified in base[15:0] */
1546 +
1547 +/*
1548 + * int HYPERVISOR_iret(void)
1549 + * All arguments are on the kernel stack, in the following format.
1550 + * Never returns if successful. Current kernel context is lost.
1551 + * The saved CS is mapped as follows:
1552 + * RING0 -> RING3 kernel mode.
1553 + * RING1 -> RING3 kernel mode.
1554 + * RING2 -> RING3 kernel mode.
1555 + * RING3 -> RING3 user mode.
1556 + * However RING0 indicates that the guest kernel should return to iteself
1557 + * directly with
1558 + * orb $3,1*8(%rsp)
1559 + * iretq
1560 + * If flags contains VGCF_in_syscall:
1561 + * Restore RAX, RIP, RFLAGS, RSP.
1562 + * Discard R11, RCX, CS, SS.
1563 + * Otherwise:
1564 + * Restore RAX, R11, RCX, CS:RIP, RFLAGS, SS:RSP.
1565 + * All other registers are saved on hypercall entry and restored to user.
1566 + */
1567 +/* Guest exited in SYSCALL context? Return to guest with SYSRET? */
1568 +#define _VGCF_in_syscall 8
1569 +#define VGCF_in_syscall (1<<_VGCF_in_syscall)
1570 +#define VGCF_IN_SYSCALL VGCF_in_syscall
1571 +
1572 +#ifndef __ASSEMBLY__
1573 +
1574 +struct iret_context {
1575 + /* Top of stack (%rsp at point of hypercall). */
1576 + uint64_t rax, r11, rcx, flags, rip, cs, rflags, rsp, ss;
1577 + /* Bottom of iret stack frame. */
1578 +};
1579 +
1580 +#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
1581 +/* Anonymous union includes both 32- and 64-bit names (e.g., eax/rax). */
1582 +#define __DECL_REG(name) union { \
1583 + uint64_t r ## name, e ## name; \
1584 + uint32_t _e ## name; \
1585 +}
1586 +#else
1587 +/* Non-gcc sources must always use the proper 64-bit name (e.g., rax). */
1588 +#define __DECL_REG(name) uint64_t r ## name
1589 +#endif
1590 +
1591 +struct cpu_user_regs {
1592 + uint64_t r15;
1593 + uint64_t r14;
1594 + uint64_t r13;
1595 + uint64_t r12;
1596 + __DECL_REG(bp);
1597 + __DECL_REG(bx);
1598 + uint64_t r11;
1599 + uint64_t r10;
1600 + uint64_t r9;
1601 + uint64_t r8;
1602 + __DECL_REG(ax);
1603 + __DECL_REG(cx);
1604 + __DECL_REG(dx);
1605 + __DECL_REG(si);
1606 + __DECL_REG(di);
1607 + uint32_t error_code; /* private */
1608 + uint32_t entry_vector; /* private */
1609 + __DECL_REG(ip);
1610 + uint16_t cs, _pad0[1];
1611 + uint8_t saved_upcall_mask;
1612 + uint8_t _pad1[3];
1613 + __DECL_REG(flags); /* rflags.IF == !saved_upcall_mask */
1614 + __DECL_REG(sp);
1615 + uint16_t ss, _pad2[3];
1616 + uint16_t es, _pad3[3];
1617 + uint16_t ds, _pad4[3];
1618 + uint16_t fs, _pad5[3]; /* Non-zero => takes precedence over fs_base. */
1619 + uint16_t gs, _pad6[3]; /* Non-zero => takes precedence over gs_base_usr. */
1620 +};
1621 +typedef struct cpu_user_regs cpu_user_regs_t;
1622 +DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t);
1623 +
1624 +#undef __DECL_REG
1625 +
1626 +#define xen_pfn_to_cr3(pfn) ((unsigned long)(pfn) << 12)
1627 +#define xen_cr3_to_pfn(cr3) ((unsigned long)(cr3) >> 12)
1628 +
1629 +struct arch_vcpu_info {
1630 + unsigned long cr2;
1631 + unsigned long pad; /* sizeof(vcpu_info_t) == 64 */
1632 +};
1633 +typedef struct arch_vcpu_info arch_vcpu_info_t;
1634 +
1635 +typedef unsigned long xen_callback_t;
1636 +
1637 +#endif /* !__ASSEMBLY__ */
1638 +
1639 +#endif /* __XEN_PUBLIC_ARCH_X86_XEN_X86_64_H__ */
1640 +
1641 +/*
1642 + * Local variables:
1643 + * mode: C
1644 + * c-set-style: "BSD"
1645 + * c-basic-offset: 4
1646 + * tab-width: 4
1647 + * indent-tabs-mode: nil
1648 + * End:
1649 + */
1650 Index: head-2008-11-25/include/xen/interface/arch-x86/xen.h
1651 ===================================================================
1652 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1653 +++ head-2008-11-25/include/xen/interface/arch-x86/xen.h 2008-09-01 12:07:31.000000000 +0200
1654 @@ -0,0 +1,204 @@
1655 +/******************************************************************************
1656 + * arch-x86/xen.h
1657 + *
1658 + * Guest OS interface to x86 Xen.
1659 + *
1660 + * Permission is hereby granted, free of charge, to any person obtaining a copy
1661 + * of this software and associated documentation files (the "Software"), to
1662 + * deal in the Software without restriction, including without limitation the
1663 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
1664 + * sell copies of the Software, and to permit persons to whom the Software is
1665 + * furnished to do so, subject to the following conditions:
1666 + *
1667 + * The above copyright notice and this permission notice shall be included in
1668 + * all copies or substantial portions of the Software.
1669 + *
1670 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1671 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1672 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1673 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1674 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1675 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1676 + * DEALINGS IN THE SOFTWARE.
1677 + *
1678 + * Copyright (c) 2004-2006, K A Fraser
1679 + */
1680 +
1681 +#include "../xen.h"
1682 +
1683 +#ifndef __XEN_PUBLIC_ARCH_X86_XEN_H__
1684 +#define __XEN_PUBLIC_ARCH_X86_XEN_H__
1685 +
1686 +/* Structural guest handles introduced in 0x00030201. */
1687 +#if __XEN_INTERFACE_VERSION__ >= 0x00030201
1688 +#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
1689 + typedef struct { type *p; } __guest_handle_ ## name
1690 +#else
1691 +#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
1692 + typedef type * __guest_handle_ ## name
1693 +#endif
1694 +
1695 +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
1696 + ___DEFINE_XEN_GUEST_HANDLE(name, type); \
1697 + ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)
1698 +#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
1699 +#define __XEN_GUEST_HANDLE(name) __guest_handle_ ## name
1700 +#define XEN_GUEST_HANDLE(name) __XEN_GUEST_HANDLE(name)
1701 +#define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0)
1702 +#ifdef __XEN_TOOLS__
1703 +#define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
1704 +#endif
1705 +
1706 +#if defined(__i386__)
1707 +#include "xen-x86_32.h"
1708 +#elif defined(__x86_64__)
1709 +#include "xen-x86_64.h"
1710 +#endif
1711 +
1712 +#ifndef __ASSEMBLY__
1713 +typedef unsigned long xen_pfn_t;
1714 +#define PRI_xen_pfn "lx"
1715 +#endif
1716 +
1717 +/*
1718 + * SEGMENT DESCRIPTOR TABLES
1719 + */
1720 +/*
1721 + * A number of GDT entries are reserved by Xen. These are not situated at the
1722 + * start of the GDT because some stupid OSes export hard-coded selector values
1723 + * in their ABI. These hard-coded values are always near the start of the GDT,
1724 + * so Xen places itself out of the way, at the far end of the GDT.
1725 + */
1726 +#define FIRST_RESERVED_GDT_PAGE 14
1727 +#define FIRST_RESERVED_GDT_BYTE (FIRST_RESERVED_GDT_PAGE * 4096)
1728 +#define FIRST_RESERVED_GDT_ENTRY (FIRST_RESERVED_GDT_BYTE / 8)
1729 +
1730 +/* Maximum number of virtual CPUs in multi-processor guests. */
1731 +#define MAX_VIRT_CPUS 32
1732 +
1733 +
1734 +/* Machine check support */
1735 +#include "xen-mca.h"
1736 +
1737 +#ifndef __ASSEMBLY__
1738 +
1739 +typedef unsigned long xen_ulong_t;
1740 +
1741 +/*
1742 + * Send an array of these to HYPERVISOR_set_trap_table().
1743 + * The privilege level specifies which modes may enter a trap via a software
1744 + * interrupt. On x86/64, since rings 1 and 2 are unavailable, we allocate
1745 + * privilege levels as follows:
1746 + * Level == 0: Noone may enter
1747 + * Level == 1: Kernel may enter
1748 + * Level == 2: Kernel may enter
1749 + * Level == 3: Everyone may enter
1750 + */
1751 +#define TI_GET_DPL(_ti) ((_ti)->flags & 3)
1752 +#define TI_GET_IF(_ti) ((_ti)->flags & 4)
1753 +#define TI_SET_DPL(_ti,_dpl) ((_ti)->flags |= (_dpl))
1754 +#define TI_SET_IF(_ti,_if) ((_ti)->flags |= ((!!(_if))<<2))
1755 +struct trap_info {
1756 + uint8_t vector; /* exception vector */
1757 + uint8_t flags; /* 0-3: privilege level; 4: clear event enable? */
1758 + uint16_t cs; /* code selector */
1759 + unsigned long address; /* code offset */
1760 +};
1761 +typedef struct trap_info trap_info_t;
1762 +DEFINE_XEN_GUEST_HANDLE(trap_info_t);
1763 +
1764 +typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */
1765 +
1766 +/*
1767 + * The following is all CPU context. Note that the fpu_ctxt block is filled
1768 + * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
1769 + */
1770 +struct vcpu_guest_context {
1771 + /* FPU registers come first so they can be aligned for FXSAVE/FXRSTOR. */
1772 + struct { char x[512]; } fpu_ctxt; /* User-level FPU registers */
1773 +#define VGCF_I387_VALID (1<<0)
1774 +#define VGCF_IN_KERNEL (1<<2)
1775 +#define _VGCF_i387_valid 0
1776 +#define VGCF_i387_valid (1<<_VGCF_i387_valid)
1777 +#define _VGCF_in_kernel 2
1778 +#define VGCF_in_kernel (1<<_VGCF_in_kernel)
1779 +#define _VGCF_failsafe_disables_events 3
1780 +#define VGCF_failsafe_disables_events (1<<_VGCF_failsafe_disables_events)
1781 +#define _VGCF_syscall_disables_events 4
1782 +#define VGCF_syscall_disables_events (1<<_VGCF_syscall_disables_events)
1783 +#define _VGCF_online 5
1784 +#define VGCF_online (1<<_VGCF_online)
1785 + unsigned long flags; /* VGCF_* flags */
1786 + struct cpu_user_regs user_regs; /* User-level CPU registers */
1787 + struct trap_info trap_ctxt[256]; /* Virtual IDT */
1788 + unsigned long ldt_base, ldt_ents; /* LDT (linear address, # ents) */
1789 + unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
1790 + unsigned long kernel_ss, kernel_sp; /* Virtual TSS (only SS1/SP1) */
1791 + /* NB. User pagetable on x86/64 is placed in ctrlreg[1]. */
1792 + unsigned long ctrlreg[8]; /* CR0-CR7 (control registers) */
1793 + unsigned long debugreg[8]; /* DB0-DB7 (debug registers) */
1794 +#ifdef __i386__
1795 + unsigned long event_callback_cs; /* CS:EIP of event callback */
1796 + unsigned long event_callback_eip;
1797 + unsigned long failsafe_callback_cs; /* CS:EIP of failsafe callback */
1798 + unsigned long failsafe_callback_eip;
1799 +#else
1800 + unsigned long event_callback_eip;
1801 + unsigned long failsafe_callback_eip;
1802 +#ifdef __XEN__
1803 + union {
1804 + unsigned long syscall_callback_eip;
1805 + struct {
1806 + unsigned int event_callback_cs; /* compat CS of event cb */
1807 + unsigned int failsafe_callback_cs; /* compat CS of failsafe cb */
1808 + };
1809 + };
1810 +#else
1811 + unsigned long syscall_callback_eip;
1812 +#endif
1813 +#endif
1814 + unsigned long vm_assist; /* VMASST_TYPE_* bitmap */
1815 +#ifdef __x86_64__
1816 + /* Segment base addresses. */
1817 + uint64_t fs_base;
1818 + uint64_t gs_base_kernel;
1819 + uint64_t gs_base_user;
1820 +#endif
1821 +};
1822 +typedef struct vcpu_guest_context vcpu_guest_context_t;
1823 +DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
1824 +
1825 +struct arch_shared_info {
1826 + unsigned long max_pfn; /* max pfn that appears in table */
1827 + /* Frame containing list of mfns containing list of mfns containing p2m. */
1828 + xen_pfn_t pfn_to_mfn_frame_list_list;
1829 + unsigned long nmi_reason;
1830 + uint64_t pad[32];
1831 +};
1832 +typedef struct arch_shared_info arch_shared_info_t;
1833 +
1834 +#endif /* !__ASSEMBLY__ */
1835 +
1836 +/*
1837 + * Prefix forces emulation of some non-trapping instructions.
1838 + * Currently only CPUID.
1839 + */
1840 +#ifdef __ASSEMBLY__
1841 +#define XEN_EMULATE_PREFIX .byte 0x0f,0x0b,0x78,0x65,0x6e ;
1842 +#define XEN_CPUID XEN_EMULATE_PREFIX cpuid
1843 +#else
1844 +#define XEN_EMULATE_PREFIX ".byte 0x0f,0x0b,0x78,0x65,0x6e ; "
1845 +#define XEN_CPUID XEN_EMULATE_PREFIX "cpuid"
1846 +#endif
1847 +
1848 +#endif /* __XEN_PUBLIC_ARCH_X86_XEN_H__ */
1849 +
1850 +/*
1851 + * Local variables:
1852 + * mode: C
1853 + * c-set-style: "BSD"
1854 + * c-basic-offset: 4
1855 + * tab-width: 4
1856 + * indent-tabs-mode: nil
1857 + * End:
1858 + */
1859 Index: head-2008-11-25/include/xen/interface/arch-x86_32.h
1860 ===================================================================
1861 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1862 +++ head-2008-11-25/include/xen/interface/arch-x86_32.h 2007-06-12 13:14:19.000000000 +0200
1863 @@ -0,0 +1,27 @@
1864 +/******************************************************************************
1865 + * arch-x86_32.h
1866 + *
1867 + * Guest OS interface to x86 32-bit Xen.
1868 + *
1869 + * Permission is hereby granted, free of charge, to any person obtaining a copy
1870 + * of this software and associated documentation files (the "Software"), to
1871 + * deal in the Software without restriction, including without limitation the
1872 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
1873 + * sell copies of the Software, and to permit persons to whom the Software is
1874 + * furnished to do so, subject to the following conditions:
1875 + *
1876 + * The above copyright notice and this permission notice shall be included in
1877 + * all copies or substantial portions of the Software.
1878 + *
1879 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1880 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1881 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1882 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1883 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1884 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1885 + * DEALINGS IN THE SOFTWARE.
1886 + *
1887 + * Copyright (c) 2004-2006, K A Fraser
1888 + */
1889 +
1890 +#include "arch-x86/xen.h"
1891 Index: head-2008-11-25/include/xen/interface/arch-x86_64.h
1892 ===================================================================
1893 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1894 +++ head-2008-11-25/include/xen/interface/arch-x86_64.h 2007-06-12 13:14:19.000000000 +0200
1895 @@ -0,0 +1,27 @@
1896 +/******************************************************************************
1897 + * arch-x86_64.h
1898 + *
1899 + * Guest OS interface to x86 64-bit Xen.
1900 + *
1901 + * Permission is hereby granted, free of charge, to any person obtaining a copy
1902 + * of this software and associated documentation files (the "Software"), to
1903 + * deal in the Software without restriction, including without limitation the
1904 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
1905 + * sell copies of the Software, and to permit persons to whom the Software is
1906 + * furnished to do so, subject to the following conditions:
1907 + *
1908 + * The above copyright notice and this permission notice shall be included in
1909 + * all copies or substantial portions of the Software.
1910 + *
1911 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1912 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1913 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1914 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1915 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1916 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1917 + * DEALINGS IN THE SOFTWARE.
1918 + *
1919 + * Copyright (c) 2004-2006, K A Fraser
1920 + */
1921 +
1922 +#include "arch-x86/xen.h"
1923 Index: head-2008-11-25/include/xen/interface/dom0_ops.h
1924 ===================================================================
1925 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1926 +++ head-2008-11-25/include/xen/interface/dom0_ops.h 2007-06-12 13:14:19.000000000 +0200
1927 @@ -0,0 +1,120 @@
1928 +/******************************************************************************
1929 + * dom0_ops.h
1930 + *
1931 + * Process command requests from domain-0 guest OS.
1932 + *
1933 + * Permission is hereby granted, free of charge, to any person obtaining a copy
1934 + * of this software and associated documentation files (the "Software"), to
1935 + * deal in the Software without restriction, including without limitation the
1936 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
1937 + * sell copies of the Software, and to permit persons to whom the Software is
1938 + * furnished to do so, subject to the following conditions:
1939 + *
1940 + * The above copyright notice and this permission notice shall be included in
1941 + * all copies or substantial portions of the Software.
1942 + *
1943 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1944 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1945 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1946 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1947 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1948 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1949 + * DEALINGS IN THE SOFTWARE.
1950 + *
1951 + * Copyright (c) 2002-2003, B Dragovic
1952 + * Copyright (c) 2002-2006, K Fraser
1953 + */
1954 +
1955 +#ifndef __XEN_PUBLIC_DOM0_OPS_H__
1956 +#define __XEN_PUBLIC_DOM0_OPS_H__
1957 +
1958 +#include "xen.h"
1959 +#include "platform.h"
1960 +
1961 +#if __XEN_INTERFACE_VERSION__ >= 0x00030204
1962 +#error "dom0_ops.h is a compatibility interface only"
1963 +#endif
1964 +
1965 +#define DOM0_INTERFACE_VERSION XENPF_INTERFACE_VERSION
1966 +
1967 +#define DOM0_SETTIME XENPF_settime
1968 +#define dom0_settime xenpf_settime
1969 +#define dom0_settime_t xenpf_settime_t
1970 +
1971 +#define DOM0_ADD_MEMTYPE XENPF_add_memtype
1972 +#define dom0_add_memtype xenpf_add_memtype
1973 +#define dom0_add_memtype_t xenpf_add_memtype_t
1974 +
1975 +#define DOM0_DEL_MEMTYPE XENPF_del_memtype
1976 +#define dom0_del_memtype xenpf_del_memtype
1977 +#define dom0_del_memtype_t xenpf_del_memtype_t
1978 +
1979 +#define DOM0_READ_MEMTYPE XENPF_read_memtype
1980 +#define dom0_read_memtype xenpf_read_memtype
1981 +#define dom0_read_memtype_t xenpf_read_memtype_t
1982 +
1983 +#define DOM0_MICROCODE XENPF_microcode_update
1984 +#define dom0_microcode xenpf_microcode_update
1985 +#define dom0_microcode_t xenpf_microcode_update_t
1986 +
1987 +#define DOM0_PLATFORM_QUIRK XENPF_platform_quirk
1988 +#define dom0_platform_quirk xenpf_platform_quirk
1989 +#define dom0_platform_quirk_t xenpf_platform_quirk_t
1990 +
1991 +typedef uint64_t cpumap_t;
1992 +
1993 +/* Unsupported legacy operation -- defined for API compatibility. */
1994 +#define DOM0_MSR 15
1995 +struct dom0_msr {
1996 + /* IN variables. */
1997 + uint32_t write;
1998 + cpumap_t cpu_mask;
1999 + uint32_t msr;
2000 + uint32_t in1;
2001 + uint32_t in2;
2002 + /* OUT variables. */
2003 + uint32_t out1;
2004 + uint32_t out2;
2005 +};
2006 +typedef struct dom0_msr dom0_msr_t;
2007 +DEFINE_XEN_GUEST_HANDLE(dom0_msr_t);
2008 +
2009 +/* Unsupported legacy operation -- defined for API compatibility. */
2010 +#define DOM0_PHYSICAL_MEMORY_MAP 40
2011 +struct dom0_memory_map_entry {
2012 + uint64_t start, end;
2013 + uint32_t flags; /* reserved */
2014 + uint8_t is_ram;
2015 +};
2016 +typedef struct dom0_memory_map_entry dom0_memory_map_entry_t;
2017 +DEFINE_XEN_GUEST_HANDLE(dom0_memory_map_entry_t);
2018 +
2019 +struct dom0_op {
2020 + uint32_t cmd;
2021 + uint32_t interface_version; /* DOM0_INTERFACE_VERSION */
2022 + union {
2023 + struct dom0_msr msr;
2024 + struct dom0_settime settime;
2025 + struct dom0_add_memtype add_memtype;
2026 + struct dom0_del_memtype del_memtype;
2027 + struct dom0_read_memtype read_memtype;
2028 + struct dom0_microcode microcode;
2029 + struct dom0_platform_quirk platform_quirk;
2030 + struct dom0_memory_map_entry physical_memory_map;
2031 + uint8_t pad[128];
2032 + } u;
2033 +};
2034 +typedef struct dom0_op dom0_op_t;
2035 +DEFINE_XEN_GUEST_HANDLE(dom0_op_t);
2036 +
2037 +#endif /* __XEN_PUBLIC_DOM0_OPS_H__ */
2038 +
2039 +/*
2040 + * Local variables:
2041 + * mode: C
2042 + * c-set-style: "BSD"
2043 + * c-basic-offset: 4
2044 + * tab-width: 4
2045 + * indent-tabs-mode: nil
2046 + * End:
2047 + */
2048 Index: head-2008-11-25/include/xen/interface/domctl.h
2049 ===================================================================
2050 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2051 +++ head-2008-11-25/include/xen/interface/domctl.h 2008-10-29 09:55:56.000000000 +0100
2052 @@ -0,0 +1,680 @@
2053 +/******************************************************************************
2054 + * domctl.h
2055 + *
2056 + * Domain management operations. For use by node control stack.
2057 + *
2058 + * Permission is hereby granted, free of charge, to any person obtaining a copy
2059 + * of this software and associated documentation files (the "Software"), to
2060 + * deal in the Software without restriction, including without limitation the
2061 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
2062 + * sell copies of the Software, and to permit persons to whom the Software is
2063 + * furnished to do so, subject to the following conditions:
2064 + *
2065 + * The above copyright notice and this permission notice shall be included in
2066 + * all copies or substantial portions of the Software.
2067 + *
2068 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2069 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2070 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2071 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2072 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2073 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2074 + * DEALINGS IN THE SOFTWARE.
2075 + *
2076 + * Copyright (c) 2002-2003, B Dragovic
2077 + * Copyright (c) 2002-2006, K Fraser
2078 + */
2079 +
2080 +#ifndef __XEN_PUBLIC_DOMCTL_H__
2081 +#define __XEN_PUBLIC_DOMCTL_H__
2082 +
2083 +#if !defined(__XEN__) && !defined(__XEN_TOOLS__)
2084 +#error "domctl operations are intended for use by node control tools only"
2085 +#endif
2086 +
2087 +#include "xen.h"
2088 +
2089 +#define XEN_DOMCTL_INTERFACE_VERSION 0x00000005
2090 +
2091 +struct xenctl_cpumap {
2092 + XEN_GUEST_HANDLE_64(uint8) bitmap;
2093 + uint32_t nr_cpus;
2094 +};
2095 +
2096 +/*
2097 + * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
2098 + * If it is specified as zero, an id is auto-allocated and returned.
2099 + */
2100 +#define XEN_DOMCTL_createdomain 1
2101 +struct xen_domctl_createdomain {
2102 + /* IN parameters */
2103 + uint32_t ssidref;
2104 + xen_domain_handle_t handle;
2105 + /* Is this an HVM guest (as opposed to a PV guest)? */
2106 +#define _XEN_DOMCTL_CDF_hvm_guest 0
2107 +#define XEN_DOMCTL_CDF_hvm_guest (1U<<_XEN_DOMCTL_CDF_hvm_guest)
2108 + /* Use hardware-assisted paging if available? */
2109 +#define _XEN_DOMCTL_CDF_hap 1
2110 +#define XEN_DOMCTL_CDF_hap (1U<<_XEN_DOMCTL_CDF_hap)
2111 + uint32_t flags;
2112 +};
2113 +typedef struct xen_domctl_createdomain xen_domctl_createdomain_t;
2114 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
2115 +
2116 +#define XEN_DOMCTL_destroydomain 2
2117 +#define XEN_DOMCTL_pausedomain 3
2118 +#define XEN_DOMCTL_unpausedomain 4
2119 +#define XEN_DOMCTL_resumedomain 27
2120 +
2121 +#define XEN_DOMCTL_getdomaininfo 5
2122 +struct xen_domctl_getdomaininfo {
2123 + /* OUT variables. */
2124 + domid_t domain; /* Also echoed in domctl.domain */
2125 + /* Domain is scheduled to die. */
2126 +#define _XEN_DOMINF_dying 0
2127 +#define XEN_DOMINF_dying (1U<<_XEN_DOMINF_dying)
2128 + /* Domain is an HVM guest (as opposed to a PV guest). */
2129 +#define _XEN_DOMINF_hvm_guest 1
2130 +#define XEN_DOMINF_hvm_guest (1U<<_XEN_DOMINF_hvm_guest)
2131 + /* The guest OS has shut down. */
2132 +#define _XEN_DOMINF_shutdown 2
2133 +#define XEN_DOMINF_shutdown (1U<<_XEN_DOMINF_shutdown)
2134 + /* Currently paused by control software. */
2135 +#define _XEN_DOMINF_paused 3
2136 +#define XEN_DOMINF_paused (1U<<_XEN_DOMINF_paused)
2137 + /* Currently blocked pending an event. */
2138 +#define _XEN_DOMINF_blocked 4
2139 +#define XEN_DOMINF_blocked (1U<<_XEN_DOMINF_blocked)
2140 + /* Domain is currently running. */
2141 +#define _XEN_DOMINF_running 5
2142 +#define XEN_DOMINF_running (1U<<_XEN_DOMINF_running)
2143 + /* Being debugged. */
2144 +#define _XEN_DOMINF_debugged 6
2145 +#define XEN_DOMINF_debugged (1U<<_XEN_DOMINF_debugged)
2146 + /* CPU to which this domain is bound. */
2147 +#define XEN_DOMINF_cpumask 255
2148 +#define XEN_DOMINF_cpushift 8
2149 + /* XEN_DOMINF_shutdown guest-supplied code. */
2150 +#define XEN_DOMINF_shutdownmask 255
2151 +#define XEN_DOMINF_shutdownshift 16
2152 + uint32_t flags; /* XEN_DOMINF_* */
2153 + uint64_aligned_t tot_pages;
2154 + uint64_aligned_t max_pages;
2155 + uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */
2156 + uint64_aligned_t cpu_time;
2157 + uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */
2158 + uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */
2159 + uint32_t ssidref;
2160 + xen_domain_handle_t handle;
2161 +};
2162 +typedef struct xen_domctl_getdomaininfo xen_domctl_getdomaininfo_t;
2163 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t);
2164 +
2165 +
2166 +#define XEN_DOMCTL_getmemlist 6
2167 +struct xen_domctl_getmemlist {
2168 + /* IN variables. */
2169 + /* Max entries to write to output buffer. */
2170 + uint64_aligned_t max_pfns;
2171 + /* Start index in guest's page list. */
2172 + uint64_aligned_t start_pfn;
2173 + XEN_GUEST_HANDLE_64(uint64) buffer;
2174 + /* OUT variables. */
2175 + uint64_aligned_t num_pfns;
2176 +};
2177 +typedef struct xen_domctl_getmemlist xen_domctl_getmemlist_t;
2178 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_getmemlist_t);
2179 +
2180 +
2181 +#define XEN_DOMCTL_getpageframeinfo 7
2182 +
2183 +#define XEN_DOMCTL_PFINFO_LTAB_SHIFT 28
2184 +#define XEN_DOMCTL_PFINFO_NOTAB (0x0U<<28)
2185 +#define XEN_DOMCTL_PFINFO_L1TAB (0x1U<<28)
2186 +#define XEN_DOMCTL_PFINFO_L2TAB (0x2U<<28)
2187 +#define XEN_DOMCTL_PFINFO_L3TAB (0x3U<<28)
2188 +#define XEN_DOMCTL_PFINFO_L4TAB (0x4U<<28)
2189 +#define XEN_DOMCTL_PFINFO_LTABTYPE_MASK (0x7U<<28)
2190 +#define XEN_DOMCTL_PFINFO_LPINTAB (0x1U<<31)
2191 +#define XEN_DOMCTL_PFINFO_XTAB (0xfU<<28) /* invalid page */
2192 +#define XEN_DOMCTL_PFINFO_LTAB_MASK (0xfU<<28)
2193 +
2194 +struct xen_domctl_getpageframeinfo {
2195 + /* IN variables. */
2196 + uint64_aligned_t gmfn; /* GMFN to query */
2197 + /* OUT variables. */
2198 + /* Is the page PINNED to a type? */
2199 + uint32_t type; /* see above type defs */
2200 +};
2201 +typedef struct xen_domctl_getpageframeinfo xen_domctl_getpageframeinfo_t;
2202 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo_t);
2203 +
2204 +
2205 +#define XEN_DOMCTL_getpageframeinfo2 8
2206 +struct xen_domctl_getpageframeinfo2 {
2207 + /* IN variables. */
2208 + uint64_aligned_t num;
2209 + /* IN/OUT variables. */
2210 + XEN_GUEST_HANDLE_64(uint32) array;
2211 +};
2212 +typedef struct xen_domctl_getpageframeinfo2 xen_domctl_getpageframeinfo2_t;
2213 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo2_t);
2214 +
2215 +
2216 +/*
2217 + * Control shadow pagetables operation
2218 + */
2219 +#define XEN_DOMCTL_shadow_op 10
2220 +
2221 +/* Disable shadow mode. */
2222 +#define XEN_DOMCTL_SHADOW_OP_OFF 0
2223 +
2224 +/* Enable shadow mode (mode contains ORed XEN_DOMCTL_SHADOW_ENABLE_* flags). */
2225 +#define XEN_DOMCTL_SHADOW_OP_ENABLE 32
2226 +
2227 +/* Log-dirty bitmap operations. */
2228 + /* Return the bitmap and clean internal copy for next round. */
2229 +#define XEN_DOMCTL_SHADOW_OP_CLEAN 11
2230 + /* Return the bitmap but do not modify internal copy. */
2231 +#define XEN_DOMCTL_SHADOW_OP_PEEK 12
2232 +
2233 +/* Memory allocation accessors. */
2234 +#define XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION 30
2235 +#define XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION 31
2236 +
2237 +/* Legacy enable operations. */
2238 + /* Equiv. to ENABLE with no mode flags. */
2239 +#define XEN_DOMCTL_SHADOW_OP_ENABLE_TEST 1
2240 + /* Equiv. to ENABLE with mode flag ENABLE_LOG_DIRTY. */
2241 +#define XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY 2
2242 + /* Equiv. to ENABLE with mode flags ENABLE_REFCOUNT and ENABLE_TRANSLATE. */
2243 +#define XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE 3
2244 +
2245 +/* Mode flags for XEN_DOMCTL_SHADOW_OP_ENABLE. */
2246 + /*
2247 + * Shadow pagetables are refcounted: guest does not use explicit mmu
2248 + * operations nor write-protect its pagetables.
2249 + */
2250 +#define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT (1 << 1)
2251 + /*
2252 + * Log pages in a bitmap as they are dirtied.
2253 + * Used for live relocation to determine which pages must be re-sent.
2254 + */
2255 +#define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
2256 + /*
2257 + * Automatically translate GPFNs into MFNs.
2258 + */
2259 +#define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
2260 + /*
2261 + * Xen does not steal virtual address space from the guest.
2262 + * Requires HVM support.
2263 + */
2264 +#define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL (1 << 4)
2265 +
2266 +struct xen_domctl_shadow_op_stats {
2267 + uint32_t fault_count;
2268 + uint32_t dirty_count;
2269 +};
2270 +typedef struct xen_domctl_shadow_op_stats xen_domctl_shadow_op_stats_t;
2271 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_stats_t);
2272 +
2273 +struct xen_domctl_shadow_op {
2274 + /* IN variables. */
2275 + uint32_t op; /* XEN_DOMCTL_SHADOW_OP_* */
2276 +
2277 + /* OP_ENABLE */
2278 + uint32_t mode; /* XEN_DOMCTL_SHADOW_ENABLE_* */
2279 +
2280 + /* OP_GET_ALLOCATION / OP_SET_ALLOCATION */
2281 + uint32_t mb; /* Shadow memory allocation in MB */
2282 +
2283 + /* OP_PEEK / OP_CLEAN */
2284 + XEN_GUEST_HANDLE_64(uint8) dirty_bitmap;
2285 + uint64_aligned_t pages; /* Size of buffer. Updated with actual size. */
2286 + struct xen_domctl_shadow_op_stats stats;
2287 +};
2288 +typedef struct xen_domctl_shadow_op xen_domctl_shadow_op_t;
2289 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_t);
2290 +
2291 +
2292 +#define XEN_DOMCTL_max_mem 11
2293 +struct xen_domctl_max_mem {
2294 + /* IN variables. */
2295 + uint64_aligned_t max_memkb;
2296 +};
2297 +typedef struct xen_domctl_max_mem xen_domctl_max_mem_t;
2298 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_mem_t);
2299 +
2300 +
2301 +#define XEN_DOMCTL_setvcpucontext 12
2302 +#define XEN_DOMCTL_getvcpucontext 13
2303 +struct xen_domctl_vcpucontext {
2304 + uint32_t vcpu; /* IN */
2305 + XEN_GUEST_HANDLE_64(vcpu_guest_context_t) ctxt; /* IN/OUT */
2306 +};
2307 +typedef struct xen_domctl_vcpucontext xen_domctl_vcpucontext_t;
2308 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpucontext_t);
2309 +
2310 +
2311 +#define XEN_DOMCTL_getvcpuinfo 14
2312 +struct xen_domctl_getvcpuinfo {
2313 + /* IN variables. */
2314 + uint32_t vcpu;
2315 + /* OUT variables. */
2316 + uint8_t online; /* currently online (not hotplugged)? */
2317 + uint8_t blocked; /* blocked waiting for an event? */
2318 + uint8_t running; /* currently scheduled on its CPU? */
2319 + uint64_aligned_t cpu_time; /* total cpu time consumed (ns) */
2320 + uint32_t cpu; /* current mapping */
2321 +};
2322 +typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t;
2323 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_getvcpuinfo_t);
2324 +
2325 +
2326 +/* Get/set which physical cpus a vcpu can execute on. */
2327 +#define XEN_DOMCTL_setvcpuaffinity 9
2328 +#define XEN_DOMCTL_getvcpuaffinity 25
2329 +struct xen_domctl_vcpuaffinity {
2330 + uint32_t vcpu; /* IN */
2331 + struct xenctl_cpumap cpumap; /* IN/OUT */
2332 +};
2333 +typedef struct xen_domctl_vcpuaffinity xen_domctl_vcpuaffinity_t;
2334 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpuaffinity_t);
2335 +
2336 +
2337 +#define XEN_DOMCTL_max_vcpus 15
2338 +struct xen_domctl_max_vcpus {
2339 + uint32_t max; /* maximum number of vcpus */
2340 +};
2341 +typedef struct xen_domctl_max_vcpus xen_domctl_max_vcpus_t;
2342 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t);
2343 +
2344 +
2345 +#define XEN_DOMCTL_scheduler_op 16
2346 +/* Scheduler types. */
2347 +#define XEN_SCHEDULER_SEDF 4
2348 +#define XEN_SCHEDULER_CREDIT 5
2349 +/* Set or get info? */
2350 +#define XEN_DOMCTL_SCHEDOP_putinfo 0
2351 +#define XEN_DOMCTL_SCHEDOP_getinfo 1
2352 +struct xen_domctl_scheduler_op {
2353 + uint32_t sched_id; /* XEN_SCHEDULER_* */
2354 + uint32_t cmd; /* XEN_DOMCTL_SCHEDOP_* */
2355 + union {
2356 + struct xen_domctl_sched_sedf {
2357 + uint64_aligned_t period;
2358 + uint64_aligned_t slice;
2359 + uint64_aligned_t latency;
2360 + uint32_t extratime;
2361 + uint32_t weight;
2362 + } sedf;
2363 + struct xen_domctl_sched_credit {
2364 + uint16_t weight;
2365 + uint16_t cap;
2366 + } credit;
2367 + } u;
2368 +};
2369 +typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t;
2370 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_scheduler_op_t);
2371 +
2372 +
2373 +#define XEN_DOMCTL_setdomainhandle 17
2374 +struct xen_domctl_setdomainhandle {
2375 + xen_domain_handle_t handle;
2376 +};
2377 +typedef struct xen_domctl_setdomainhandle xen_domctl_setdomainhandle_t;
2378 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdomainhandle_t);
2379 +
2380 +
2381 +#define XEN_DOMCTL_setdebugging 18
2382 +struct xen_domctl_setdebugging {
2383 + uint8_t enable;
2384 +};
2385 +typedef struct xen_domctl_setdebugging xen_domctl_setdebugging_t;
2386 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdebugging_t);
2387 +
2388 +
2389 +#define XEN_DOMCTL_irq_permission 19
2390 +struct xen_domctl_irq_permission {
2391 + uint8_t pirq;
2392 + uint8_t allow_access; /* flag to specify enable/disable of IRQ access */
2393 +};
2394 +typedef struct xen_domctl_irq_permission xen_domctl_irq_permission_t;
2395 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_irq_permission_t);
2396 +
2397 +
2398 +#define XEN_DOMCTL_iomem_permission 20
2399 +struct xen_domctl_iomem_permission {
2400 + uint64_aligned_t first_mfn;/* first page (physical page number) in range */
2401 + uint64_aligned_t nr_mfns; /* number of pages in range (>0) */
2402 + uint8_t allow_access; /* allow (!0) or deny (0) access to range? */
2403 +};
2404 +typedef struct xen_domctl_iomem_permission xen_domctl_iomem_permission_t;
2405 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_iomem_permission_t);
2406 +
2407 +
2408 +#define XEN_DOMCTL_ioport_permission 21
2409 +struct xen_domctl_ioport_permission {
2410 + uint32_t first_port; /* first port int range */
2411 + uint32_t nr_ports; /* size of port range */
2412 + uint8_t allow_access; /* allow or deny access to range? */
2413 +};
2414 +typedef struct xen_domctl_ioport_permission xen_domctl_ioport_permission_t;
2415 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_ioport_permission_t);
2416 +
2417 +
2418 +#define XEN_DOMCTL_hypercall_init 22
2419 +struct xen_domctl_hypercall_init {
2420 + uint64_aligned_t gmfn; /* GMFN to be initialised */
2421 +};
2422 +typedef struct xen_domctl_hypercall_init xen_domctl_hypercall_init_t;
2423 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_hypercall_init_t);
2424 +
2425 +
2426 +#define XEN_DOMCTL_arch_setup 23
2427 +#define _XEN_DOMAINSETUP_hvm_guest 0
2428 +#define XEN_DOMAINSETUP_hvm_guest (1UL<<_XEN_DOMAINSETUP_hvm_guest)
2429 +#define _XEN_DOMAINSETUP_query 1 /* Get parameters (for save) */
2430 +#define XEN_DOMAINSETUP_query (1UL<<_XEN_DOMAINSETUP_query)
2431 +#define _XEN_DOMAINSETUP_sioemu_guest 2
2432 +#define XEN_DOMAINSETUP_sioemu_guest (1UL<<_XEN_DOMAINSETUP_sioemu_guest)
2433 +typedef struct xen_domctl_arch_setup {
2434 + uint64_aligned_t flags; /* XEN_DOMAINSETUP_* */
2435 +#ifdef __ia64__
2436 + uint64_aligned_t bp; /* mpaddr of boot param area */
2437 + uint64_aligned_t maxmem; /* Highest memory address for MDT. */
2438 + uint64_aligned_t xsi_va; /* Xen shared_info area virtual address. */
2439 + uint32_t hypercall_imm; /* Break imm for Xen hypercalls. */
2440 + int8_t vhpt_size_log2; /* Log2 of VHPT size. */
2441 +#endif
2442 +} xen_domctl_arch_setup_t;
2443 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_arch_setup_t);
2444 +
2445 +
2446 +#define XEN_DOMCTL_settimeoffset 24
2447 +struct xen_domctl_settimeoffset {
2448 + int32_t time_offset_seconds; /* applied to domain wallclock time */
2449 +};
2450 +typedef struct xen_domctl_settimeoffset xen_domctl_settimeoffset_t;
2451 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_settimeoffset_t);
2452 +
2453 +
2454 +#define XEN_DOMCTL_gethvmcontext 33
2455 +#define XEN_DOMCTL_sethvmcontext 34
2456 +typedef struct xen_domctl_hvmcontext {
2457 + uint32_t size; /* IN/OUT: size of buffer / bytes filled */
2458 + XEN_GUEST_HANDLE_64(uint8) buffer; /* IN/OUT: data, or call
2459 + * gethvmcontext with NULL
2460 + * buffer to get size req'd */
2461 +} xen_domctl_hvmcontext_t;
2462 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_hvmcontext_t);
2463 +
2464 +
2465 +#define XEN_DOMCTL_set_address_size 35
2466 +#define XEN_DOMCTL_get_address_size 36
2467 +typedef struct xen_domctl_address_size {
2468 + uint32_t size;
2469 +} xen_domctl_address_size_t;
2470 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_address_size_t);
2471 +
2472 +
2473 +#define XEN_DOMCTL_real_mode_area 26
2474 +struct xen_domctl_real_mode_area {
2475 + uint32_t log; /* log2 of Real Mode Area size */
2476 +};
2477 +typedef struct xen_domctl_real_mode_area xen_domctl_real_mode_area_t;
2478 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_real_mode_area_t);
2479 +
2480 +
2481 +#define XEN_DOMCTL_sendtrigger 28
2482 +#define XEN_DOMCTL_SENDTRIGGER_NMI 0
2483 +#define XEN_DOMCTL_SENDTRIGGER_RESET 1
2484 +#define XEN_DOMCTL_SENDTRIGGER_INIT 2
2485 +struct xen_domctl_sendtrigger {
2486 + uint32_t trigger; /* IN */
2487 + uint32_t vcpu; /* IN */
2488 +};
2489 +typedef struct xen_domctl_sendtrigger xen_domctl_sendtrigger_t;
2490 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_sendtrigger_t);
2491 +
2492 +
2493 +/* Assign PCI device to HVM guest. Sets up IOMMU structures. */
2494 +#define XEN_DOMCTL_assign_device 37
2495 +#define XEN_DOMCTL_test_assign_device 45
2496 +#define XEN_DOMCTL_deassign_device 47
2497 +struct xen_domctl_assign_device {
2498 + uint32_t machine_bdf; /* machine PCI ID of assigned device */
2499 +};
2500 +typedef struct xen_domctl_assign_device xen_domctl_assign_device_t;
2501 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_assign_device_t);
2502 +
2503 +/* Retrieve sibling devices infomation of machine_bdf */
2504 +#define XEN_DOMCTL_get_device_group 50
2505 +struct xen_domctl_get_device_group {
2506 + uint32_t machine_bdf; /* IN */
2507 + uint32_t max_sdevs; /* IN */
2508 + uint32_t num_sdevs; /* OUT */
2509 + XEN_GUEST_HANDLE_64(uint32) sdev_array; /* OUT */
2510 +};
2511 +typedef struct xen_domctl_get_device_group xen_domctl_get_device_group_t;
2512 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_get_device_group_t);
2513 +
2514 +/* Pass-through interrupts: bind real irq -> hvm devfn. */
2515 +#define XEN_DOMCTL_bind_pt_irq 38
2516 +#define XEN_DOMCTL_unbind_pt_irq 48
2517 +typedef enum pt_irq_type_e {
2518 + PT_IRQ_TYPE_PCI,
2519 + PT_IRQ_TYPE_ISA,
2520 + PT_IRQ_TYPE_MSI,
2521 +} pt_irq_type_t;
2522 +struct xen_domctl_bind_pt_irq {
2523 + uint32_t machine_irq;
2524 + pt_irq_type_t irq_type;
2525 + uint32_t hvm_domid;
2526 +
2527 + union {
2528 + struct {
2529 + uint8_t isa_irq;
2530 + } isa;
2531 + struct {
2532 + uint8_t bus;
2533 + uint8_t device;
2534 + uint8_t intx;
2535 + } pci;
2536 + struct {
2537 + uint8_t gvec;
2538 + uint32_t gflags;
2539 + } msi;
2540 + } u;
2541 +};
2542 +typedef struct xen_domctl_bind_pt_irq xen_domctl_bind_pt_irq_t;
2543 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_bind_pt_irq_t);
2544 +
2545 +
2546 +/* Bind machine I/O address range -> HVM address range. */
2547 +#define XEN_DOMCTL_memory_mapping 39
2548 +#define DPCI_ADD_MAPPING 1
2549 +#define DPCI_REMOVE_MAPPING 0
2550 +struct xen_domctl_memory_mapping {
2551 + uint64_aligned_t first_gfn; /* first page (hvm guest phys page) in range */
2552 + uint64_aligned_t first_mfn; /* first page (machine page) in range */
2553 + uint64_aligned_t nr_mfns; /* number of pages in range (>0) */
2554 + uint32_t add_mapping; /* add or remove mapping */
2555 + uint32_t padding; /* padding for 64-bit aligned structure */
2556 +};
2557 +typedef struct xen_domctl_memory_mapping xen_domctl_memory_mapping_t;
2558 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_memory_mapping_t);
2559 +
2560 +
2561 +/* Bind machine I/O port range -> HVM I/O port range. */
2562 +#define XEN_DOMCTL_ioport_mapping 40
2563 +struct xen_domctl_ioport_mapping {
2564 + uint32_t first_gport; /* first guest IO port*/
2565 + uint32_t first_mport; /* first machine IO port */
2566 + uint32_t nr_ports; /* size of port range */
2567 + uint32_t add_mapping; /* add or remove mapping */
2568 +};
2569 +typedef struct xen_domctl_ioport_mapping xen_domctl_ioport_mapping_t;
2570 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_ioport_mapping_t);
2571 +
2572 +
2573 +/*
2574 + * Pin caching type of RAM space for x86 HVM domU.
2575 + */
2576 +#define XEN_DOMCTL_pin_mem_cacheattr 41
2577 +/* Caching types: these happen to be the same as x86 MTRR/PAT type codes. */
2578 +#define XEN_DOMCTL_MEM_CACHEATTR_UC 0
2579 +#define XEN_DOMCTL_MEM_CACHEATTR_WC 1
2580 +#define XEN_DOMCTL_MEM_CACHEATTR_WT 4
2581 +#define XEN_DOMCTL_MEM_CACHEATTR_WP 5
2582 +#define XEN_DOMCTL_MEM_CACHEATTR_WB 6
2583 +#define XEN_DOMCTL_MEM_CACHEATTR_UCM 7
2584 +struct xen_domctl_pin_mem_cacheattr {
2585 + uint64_aligned_t start, end;
2586 + unsigned int type; /* XEN_DOMCTL_MEM_CACHEATTR_* */
2587 +};
2588 +typedef struct xen_domctl_pin_mem_cacheattr xen_domctl_pin_mem_cacheattr_t;
2589 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_pin_mem_cacheattr_t);
2590 +
2591 +
2592 +#define XEN_DOMCTL_set_ext_vcpucontext 42
2593 +#define XEN_DOMCTL_get_ext_vcpucontext 43
2594 +struct xen_domctl_ext_vcpucontext {
2595 + /* IN: VCPU that this call applies to. */
2596 + uint32_t vcpu;
2597 + /*
2598 + * SET: Size of struct (IN)
2599 + * GET: Size of struct (OUT)
2600 + */
2601 + uint32_t size;
2602 +#if defined(__i386__) || defined(__x86_64__)
2603 + /* SYSCALL from 32-bit mode and SYSENTER callback information. */
2604 + /* NB. SYSCALL from 64-bit mode is contained in vcpu_guest_context_t */
2605 + uint64_aligned_t syscall32_callback_eip;
2606 + uint64_aligned_t sysenter_callback_eip;
2607 + uint16_t syscall32_callback_cs;
2608 + uint16_t sysenter_callback_cs;
2609 + uint8_t syscall32_disables_events;
2610 + uint8_t sysenter_disables_events;
2611 +#endif
2612 +};
2613 +typedef struct xen_domctl_ext_vcpucontext xen_domctl_ext_vcpucontext_t;
2614 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_ext_vcpucontext_t);
2615 +
2616 +/*
2617 + * Set optimizaton features for a domain
2618 + */
2619 +#define XEN_DOMCTL_set_opt_feature 44
2620 +struct xen_domctl_set_opt_feature {
2621 +#if defined(__ia64__)
2622 + struct xen_ia64_opt_feature optf;
2623 +#else
2624 + /* Make struct non-empty: do not depend on this field name! */
2625 + uint64_t dummy;
2626 +#endif
2627 +};
2628 +typedef struct xen_domctl_set_opt_feature xen_domctl_set_opt_feature_t;
2629 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_opt_feature_t);
2630 +
2631 +/*
2632 + * Set the target domain for a domain
2633 + */
2634 +#define XEN_DOMCTL_set_target 46
2635 +struct xen_domctl_set_target {
2636 + domid_t target;
2637 +};
2638 +typedef struct xen_domctl_set_target xen_domctl_set_target_t;
2639 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_target_t);
2640 +
2641 +#if defined(__i386__) || defined(__x86_64__)
2642 +# define XEN_CPUID_INPUT_UNUSED 0xFFFFFFFF
2643 +# define XEN_DOMCTL_set_cpuid 49
2644 +struct xen_domctl_cpuid {
2645 + unsigned int input[2];
2646 + unsigned int eax;
2647 + unsigned int ebx;
2648 + unsigned int ecx;
2649 + unsigned int edx;
2650 +};
2651 +typedef struct xen_domctl_cpuid xen_domctl_cpuid_t;
2652 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_cpuid_t);
2653 +#endif
2654 +
2655 +#define XEN_DOMCTL_subscribe 29
2656 +struct xen_domctl_subscribe {
2657 + uint32_t port; /* IN */
2658 +};
2659 +typedef struct xen_domctl_subscribe xen_domctl_subscribe_t;
2660 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_subscribe_t);
2661 +
2662 +/*
2663 + * Define the maximum machine address size which should be allocated
2664 + * to a guest.
2665 + */
2666 +#define XEN_DOMCTL_set_machine_address_size 51
2667 +#define XEN_DOMCTL_get_machine_address_size 52
2668 +
2669 +/*
2670 + * Do not inject spurious page faults into this domain.
2671 + */
2672 +#define XEN_DOMCTL_suppress_spurious_page_faults 53
2673 +
2674 +struct xen_domctl {
2675 + uint32_t cmd;
2676 + uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
2677 + domid_t domain;
2678 + union {
2679 + struct xen_domctl_createdomain createdomain;
2680 + struct xen_domctl_getdomaininfo getdomaininfo;
2681 + struct xen_domctl_getmemlist getmemlist;
2682 + struct xen_domctl_getpageframeinfo getpageframeinfo;
2683 + struct xen_domctl_getpageframeinfo2 getpageframeinfo2;
2684 + struct xen_domctl_vcpuaffinity vcpuaffinity;
2685 + struct xen_domctl_shadow_op shadow_op;
2686 + struct xen_domctl_max_mem max_mem;
2687 + struct xen_domctl_vcpucontext vcpucontext;
2688 + struct xen_domctl_getvcpuinfo getvcpuinfo;
2689 + struct xen_domctl_max_vcpus max_vcpus;
2690 + struct xen_domctl_scheduler_op scheduler_op;
2691 + struct xen_domctl_setdomainhandle setdomainhandle;
2692 + struct xen_domctl_setdebugging setdebugging;
2693 + struct xen_domctl_irq_permission irq_permission;
2694 + struct xen_domctl_iomem_permission iomem_permission;
2695 + struct xen_domctl_ioport_permission ioport_permission;
2696 + struct xen_domctl_hypercall_init hypercall_init;
2697 + struct xen_domctl_arch_setup arch_setup;
2698 + struct xen_domctl_settimeoffset settimeoffset;
2699 + struct xen_domctl_real_mode_area real_mode_area;
2700 + struct xen_domctl_hvmcontext hvmcontext;
2701 + struct xen_domctl_address_size address_size;
2702 + struct xen_domctl_sendtrigger sendtrigger;
2703 + struct xen_domctl_get_device_group get_device_group;
2704 + struct xen_domctl_assign_device assign_device;
2705 + struct xen_domctl_bind_pt_irq bind_pt_irq;
2706 + struct xen_domctl_memory_mapping memory_mapping;
2707 + struct xen_domctl_ioport_mapping ioport_mapping;
2708 + struct xen_domctl_pin_mem_cacheattr pin_mem_cacheattr;
2709 + struct xen_domctl_ext_vcpucontext ext_vcpucontext;
2710 + struct xen_domctl_set_opt_feature set_opt_feature;
2711 + struct xen_domctl_set_target set_target;
2712 + struct xen_domctl_subscribe subscribe;
2713 +#if defined(__i386__) || defined(__x86_64__)
2714 + struct xen_domctl_cpuid cpuid;
2715 +#endif
2716 + uint8_t pad[128];
2717 + } u;
2718 +};
2719 +typedef struct xen_domctl xen_domctl_t;
2720 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_t);
2721 +
2722 +#endif /* __XEN_PUBLIC_DOMCTL_H__ */
2723 +
2724 +/*
2725 + * Local variables:
2726 + * mode: C
2727 + * c-set-style: "BSD"
2728 + * c-basic-offset: 4
2729 + * tab-width: 4
2730 + * indent-tabs-mode: nil
2731 + * End:
2732 + */
2733 Index: head-2008-11-25/include/xen/interface/elfstructs.h
2734 ===================================================================
2735 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2736 +++ head-2008-11-25/include/xen/interface/elfstructs.h 2007-06-12 13:14:19.000000000 +0200
2737 @@ -0,0 +1,527 @@
2738 +#ifndef __XEN_PUBLIC_ELFSTRUCTS_H__
2739 +#define __XEN_PUBLIC_ELFSTRUCTS_H__ 1
2740 +/*
2741 + * Copyright (c) 1995, 1996 Erik Theisen. All rights reserved.
2742 + *
2743 + * Redistribution and use in source and binary forms, with or without
2744 + * modification, are permitted provided that the following conditions
2745 + * are met:
2746 + * 1. Redistributions of source code must retain the above copyright
2747 + * notice, this list of conditions and the following disclaimer.
2748 + * 2. Redistributions in binary form must reproduce the above copyright
2749 + * notice, this list of conditions and the following disclaimer in the
2750 + * documentation and/or other materials provided with the distribution.
2751 + * 3. The name of the author may not be used to endorse or promote products
2752 + * derived from this software without specific prior written permission
2753 + *
2754 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2755 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2756 + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2757 + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2758 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2759 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2760 + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2761 + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2762 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2763 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2764 + */
2765 +
2766 +typedef uint8_t Elf_Byte;
2767 +
2768 +typedef uint32_t Elf32_Addr; /* Unsigned program address */
2769 +typedef uint32_t Elf32_Off; /* Unsigned file offset */
2770 +typedef int32_t Elf32_Sword; /* Signed large integer */
2771 +typedef uint32_t Elf32_Word; /* Unsigned large integer */
2772 +typedef uint16_t Elf32_Half; /* Unsigned medium integer */
2773 +
2774 +typedef uint64_t Elf64_Addr;
2775 +typedef uint64_t Elf64_Off;
2776 +typedef int32_t Elf64_Shalf;
2777 +
2778 +typedef int32_t Elf64_Sword;
2779 +typedef uint32_t Elf64_Word;
2780 +
2781 +typedef int64_t Elf64_Sxword;
2782 +typedef uint64_t Elf64_Xword;
2783 +
2784 +typedef uint32_t Elf64_Half;
2785 +typedef uint16_t Elf64_Quarter;
2786 +
2787 +/*
2788 + * e_ident[] identification indexes
2789 + * See http://www.caldera.com/developers/gabi/2000-07-17/ch4.eheader.html
2790 + */
2791 +#define EI_MAG0 0 /* file ID */
2792 +#define EI_MAG1 1 /* file ID */
2793 +#define EI_MAG2 2 /* file ID */
2794 +#define EI_MAG3 3 /* file ID */
2795 +#define EI_CLASS 4 /* file class */
2796 +#define EI_DATA 5 /* data encoding */
2797 +#define EI_VERSION 6 /* ELF header version */
2798 +#define EI_OSABI 7 /* OS/ABI ID */
2799 +#define EI_ABIVERSION 8 /* ABI version */
2800 +#define EI_PAD 9 /* start of pad bytes */
2801 +#define EI_NIDENT 16 /* Size of e_ident[] */
2802 +
2803 +/* e_ident[] magic number */
2804 +#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */
2805 +#define ELFMAG1 'E' /* e_ident[EI_MAG1] */
2806 +#define ELFMAG2 'L' /* e_ident[EI_MAG2] */
2807 +#define ELFMAG3 'F' /* e_ident[EI_MAG3] */
2808 +#define ELFMAG "\177ELF" /* magic */
2809 +#define SELFMAG 4 /* size of magic */
2810 +
2811 +/* e_ident[] file class */
2812 +#define ELFCLASSNONE 0 /* invalid */
2813 +#define ELFCLASS32 1 /* 32-bit objs */
2814 +#define ELFCLASS64 2 /* 64-bit objs */
2815 +#define ELFCLASSNUM 3 /* number of classes */
2816 +
2817 +/* e_ident[] data encoding */
2818 +#define ELFDATANONE 0 /* invalid */
2819 +#define ELFDATA2LSB 1 /* Little-Endian */
2820 +#define ELFDATA2MSB 2 /* Big-Endian */
2821 +#define ELFDATANUM 3 /* number of data encode defines */
2822 +
2823 +/* e_ident[] Operating System/ABI */
2824 +#define ELFOSABI_SYSV 0 /* UNIX System V ABI */
2825 +#define ELFOSABI_HPUX 1 /* HP-UX operating system */
2826 +#define ELFOSABI_NETBSD 2 /* NetBSD */
2827 +#define ELFOSABI_LINUX 3 /* GNU/Linux */
2828 +#define ELFOSABI_HURD 4 /* GNU/Hurd */
2829 +#define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */
2830 +#define ELFOSABI_SOLARIS 6 /* Solaris */
2831 +#define ELFOSABI_MONTEREY 7 /* Monterey */
2832 +#define ELFOSABI_IRIX 8 /* IRIX */
2833 +#define ELFOSABI_FREEBSD 9 /* FreeBSD */
2834 +#define ELFOSABI_TRU64 10 /* TRU64 UNIX */
2835 +#define ELFOSABI_MODESTO 11 /* Novell Modesto */
2836 +#define ELFOSABI_OPENBSD 12 /* OpenBSD */
2837 +#define ELFOSABI_ARM 97 /* ARM */
2838 +#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
2839 +
2840 +/* e_ident */
2841 +#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
2842 + (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
2843 + (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
2844 + (ehdr).e_ident[EI_MAG3] == ELFMAG3)
2845 +
2846 +/* ELF Header */
2847 +typedef struct elfhdr {
2848 + unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
2849 + Elf32_Half e_type; /* object file type */
2850 + Elf32_Half e_machine; /* machine */
2851 + Elf32_Word e_version; /* object file version */
2852 + Elf32_Addr e_entry; /* virtual entry point */
2853 + Elf32_Off e_phoff; /* program header table offset */
2854 + Elf32_Off e_shoff; /* section header table offset */
2855 + Elf32_Word e_flags; /* processor-specific flags */
2856 + Elf32_Half e_ehsize; /* ELF header size */
2857 + Elf32_Half e_phentsize; /* program header entry size */
2858 + Elf32_Half e_phnum; /* number of program header entries */
2859 + Elf32_Half e_shentsize; /* section header entry size */
2860 + Elf32_Half e_shnum; /* number of section header entries */
2861 + Elf32_Half e_shstrndx; /* section header table's "section
2862 + header string table" entry offset */
2863 +} Elf32_Ehdr;
2864 +
2865 +typedef struct {
2866 + unsigned char e_ident[EI_NIDENT]; /* Id bytes */
2867 + Elf64_Quarter e_type; /* file type */
2868 + Elf64_Quarter e_machine; /* machine type */
2869 + Elf64_Half e_version; /* version number */
2870 + Elf64_Addr e_entry; /* entry point */
2871 + Elf64_Off e_phoff; /* Program hdr offset */
2872 + Elf64_Off e_shoff; /* Section hdr offset */
2873 + Elf64_Half e_flags; /* Processor flags */
2874 + Elf64_Quarter e_ehsize; /* sizeof ehdr */
2875 + Elf64_Quarter e_phentsize; /* Program header entry size */
2876 + Elf64_Quarter e_phnum; /* Number of program headers */
2877 + Elf64_Quarter e_shentsize; /* Section header entry size */
2878 + Elf64_Quarter e_shnum; /* Number of section headers */
2879 + Elf64_Quarter e_shstrndx; /* String table index */
2880 +} Elf64_Ehdr;
2881 +
2882 +/* e_type */
2883 +#define ET_NONE 0 /* No file type */
2884 +#define ET_REL 1 /* relocatable file */
2885 +#define ET_EXEC 2 /* executable file */
2886 +#define ET_DYN 3 /* shared object file */
2887 +#define ET_CORE 4 /* core file */
2888 +#define ET_NUM 5 /* number of types */
2889 +#define ET_LOPROC 0xff00 /* reserved range for processor */
2890 +#define ET_HIPROC 0xffff /* specific e_type */
2891 +
2892 +/* e_machine */
2893 +#define EM_NONE 0 /* No Machine */
2894 +#define EM_M32 1 /* AT&T WE 32100 */
2895 +#define EM_SPARC 2 /* SPARC */
2896 +#define EM_386 3 /* Intel 80386 */
2897 +#define EM_68K 4 /* Motorola 68000 */
2898 +#define EM_88K 5 /* Motorola 88000 */
2899 +#define EM_486 6 /* Intel 80486 - unused? */
2900 +#define EM_860 7 /* Intel 80860 */
2901 +#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */
2902 +/*
2903 + * Don't know if EM_MIPS_RS4_BE,
2904 + * EM_SPARC64, EM_PARISC,
2905 + * or EM_PPC are ABI compliant
2906 + */
2907 +#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */
2908 +#define EM_SPARC64 11 /* SPARC v9 64-bit unoffical */
2909 +#define EM_PARISC 15 /* HPPA */
2910 +#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */
2911 +#define EM_PPC 20 /* PowerPC */
2912 +#define EM_PPC64 21 /* PowerPC 64-bit */
2913 +#define EM_ARM 40 /* Advanced RISC Machines ARM */
2914 +#define EM_ALPHA 41 /* DEC ALPHA */
2915 +#define EM_SPARCV9 43 /* SPARC version 9 */
2916 +#define EM_ALPHA_EXP 0x9026 /* DEC ALPHA */
2917 +#define EM_IA_64 50 /* Intel Merced */
2918 +#define EM_X86_64 62 /* AMD x86-64 architecture */
2919 +#define EM_VAX 75 /* DEC VAX */
2920 +
2921 +/* Version */
2922 +#define EV_NONE 0 /* Invalid */
2923 +#define EV_CURRENT 1 /* Current */
2924 +#define EV_NUM 2 /* number of versions */
2925 +
2926 +/* Section Header */
2927 +typedef struct {
2928 + Elf32_Word sh_name; /* name - index into section header
2929 + string table section */
2930 + Elf32_Word sh_type; /* type */
2931 + Elf32_Word sh_flags; /* flags */
2932 + Elf32_Addr sh_addr; /* address */
2933 + Elf32_Off sh_offset; /* file offset */
2934 + Elf32_Word sh_size; /* section size */
2935 + Elf32_Word sh_link; /* section header table index link */
2936 + Elf32_Word sh_info; /* extra information */
2937 + Elf32_Word sh_addralign; /* address alignment */
2938 + Elf32_Word sh_entsize; /* section entry size */
2939 +} Elf32_Shdr;
2940 +
2941 +typedef struct {
2942 + Elf64_Half sh_name; /* section name */
2943 + Elf64_Half sh_type; /* section type */
2944 + Elf64_Xword sh_flags; /* section flags */
2945 + Elf64_Addr sh_addr; /* virtual address */
2946 + Elf64_Off sh_offset; /* file offset */
2947 + Elf64_Xword sh_size; /* section size */
2948 + Elf64_Half sh_link; /* link to another */
2949 + Elf64_Half sh_info; /* misc info */
2950 + Elf64_Xword sh_addralign; /* memory alignment */
2951 + Elf64_Xword sh_entsize; /* table entry size */
2952 +} Elf64_Shdr;
2953 +
2954 +/* Special Section Indexes */
2955 +#define SHN_UNDEF 0 /* undefined */
2956 +#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */
2957 +#define SHN_LOPROC 0xff00 /* reserved range for processor */
2958 +#define SHN_HIPROC 0xff1f /* specific section indexes */
2959 +#define SHN_ABS 0xfff1 /* absolute value */
2960 +#define SHN_COMMON 0xfff2 /* common symbol */
2961 +#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */
2962 +
2963 +/* sh_type */
2964 +#define SHT_NULL 0 /* inactive */
2965 +#define SHT_PROGBITS 1 /* program defined information */
2966 +#define SHT_SYMTAB 2 /* symbol table section */
2967 +#define SHT_STRTAB 3 /* string table section */
2968 +#define SHT_RELA 4 /* relocation section with addends*/
2969 +#define SHT_HASH 5 /* symbol hash table section */
2970 +#define SHT_DYNAMIC 6 /* dynamic section */
2971 +#define SHT_NOTE 7 /* note section */
2972 +#define SHT_NOBITS 8 /* no space section */
2973 +#define SHT_REL 9 /* relation section without addends */
2974 +#define SHT_SHLIB 10 /* reserved - purpose unknown */
2975 +#define SHT_DYNSYM 11 /* dynamic symbol table section */
2976 +#define SHT_NUM 12 /* number of section types */
2977 +#define SHT_LOPROC 0x70000000 /* reserved range for processor */
2978 +#define SHT_HIPROC 0x7fffffff /* specific section header types */
2979 +#define SHT_LOUSER 0x80000000 /* reserved range for application */
2980 +#define SHT_HIUSER 0xffffffff /* specific indexes */
2981 +
2982 +/* Section names */
2983 +#define ELF_BSS ".bss" /* uninitialized data */
2984 +#define ELF_DATA ".data" /* initialized data */
2985 +#define ELF_DEBUG ".debug" /* debug */
2986 +#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */
2987 +#define ELF_DYNSTR ".dynstr" /* dynamic string table */
2988 +#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */
2989 +#define ELF_FINI ".fini" /* termination code */
2990 +#define ELF_GOT ".got" /* global offset table */
2991 +#define ELF_HASH ".hash" /* symbol hash table */
2992 +#define ELF_INIT ".init" /* initialization code */
2993 +#define ELF_REL_DATA ".rel.data" /* relocation data */
2994 +#define ELF_REL_FINI ".rel.fini" /* relocation termination code */
2995 +#define ELF_REL_INIT ".rel.init" /* relocation initialization code */
2996 +#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */
2997 +#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */
2998 +#define ELF_REL_TEXT ".rel.text" /* relocation code */
2999 +#define ELF_RODATA ".rodata" /* read-only data */
3000 +#define ELF_SHSTRTAB ".shstrtab" /* section header string table */
3001 +#define ELF_STRTAB ".strtab" /* string table */
3002 +#define ELF_SYMTAB ".symtab" /* symbol table */
3003 +#define ELF_TEXT ".text" /* code */
3004 +
3005 +
3006 +/* Section Attribute Flags - sh_flags */
3007 +#define SHF_WRITE 0x1 /* Writable */
3008 +#define SHF_ALLOC 0x2 /* occupies memory */
3009 +#define SHF_EXECINSTR 0x4 /* executable */
3010 +#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */
3011 + /* specific section attributes */
3012 +
3013 +/* Symbol Table Entry */
3014 +typedef struct elf32_sym {
3015 + Elf32_Word st_name; /* name - index into string table */
3016 + Elf32_Addr st_value; /* symbol value */
3017 + Elf32_Word st_size; /* symbol size */
3018 + unsigned char st_info; /* type and binding */
3019 + unsigned char st_other; /* 0 - no defined meaning */
3020 + Elf32_Half st_shndx; /* section header index */
3021 +} Elf32_Sym;
3022 +
3023 +typedef struct {
3024 + Elf64_Half st_name; /* Symbol name index in str table */
3025 + Elf_Byte st_info; /* type / binding attrs */
3026 + Elf_Byte st_other; /* unused */
3027 + Elf64_Quarter st_shndx; /* section index of symbol */
3028 + Elf64_Xword st_value; /* value of symbol */
3029 + Elf64_Xword st_size; /* size of symbol */
3030 +} Elf64_Sym;
3031 +
3032 +/* Symbol table index */
3033 +#define STN_UNDEF 0 /* undefined */
3034 +
3035 +/* Extract symbol info - st_info */
3036 +#define ELF32_ST_BIND(x) ((x) >> 4)
3037 +#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf)
3038 +#define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf))
3039 +
3040 +#define ELF64_ST_BIND(x) ((x) >> 4)
3041 +#define ELF64_ST_TYPE(x) (((unsigned int) x) & 0xf)
3042 +#define ELF64_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf))
3043 +
3044 +/* Symbol Binding - ELF32_ST_BIND - st_info */
3045 +#define STB_LOCAL 0 /* Local symbol */
3046 +#define STB_GLOBAL 1 /* Global symbol */
3047 +#define STB_WEAK 2 /* like global - lower precedence */
3048 +#define STB_NUM 3 /* number of symbol bindings */
3049 +#define STB_LOPROC 13 /* reserved range for processor */
3050 +#define STB_HIPROC 15 /* specific symbol bindings */
3051 +
3052 +/* Symbol type - ELF32_ST_TYPE - st_info */
3053 +#define STT_NOTYPE 0 /* not specified */
3054 +#define STT_OBJECT 1 /* data object */
3055 +#define STT_FUNC 2 /* function */
3056 +#define STT_SECTION 3 /* section */
3057 +#define STT_FILE 4 /* file */
3058 +#define STT_NUM 5 /* number of symbol types */
3059 +#define STT_LOPROC 13 /* reserved range for processor */
3060 +#define STT_HIPROC 15 /* specific symbol types */
3061 +
3062 +/* Relocation entry with implicit addend */
3063 +typedef struct {
3064 + Elf32_Addr r_offset; /* offset of relocation */
3065 + Elf32_Word r_info; /* symbol table index and type */
3066 +} Elf32_Rel;
3067 +
3068 +/* Relocation entry with explicit addend */
3069 +typedef struct {
3070 + Elf32_Addr r_offset; /* offset of relocation */
3071 + Elf32_Word r_info; /* symbol table index and type */
3072 + Elf32_Sword r_addend;
3073 +} Elf32_Rela;
3074 +
3075 +/* Extract relocation info - r_info */
3076 +#define ELF32_R_SYM(i) ((i) >> 8)
3077 +#define ELF32_R_TYPE(i) ((unsigned char) (i))
3078 +#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t))
3079 +
3080 +typedef struct {
3081 + Elf64_Xword r_offset; /* where to do it */
3082 + Elf64_Xword r_info; /* index & type of relocation */
3083 +} Elf64_Rel;
3084 +
3085 +typedef struct {
3086 + Elf64_Xword r_offset; /* where to do it */
3087 + Elf64_Xword r_info; /* index & type of relocation */
3088 + Elf64_Sxword r_addend; /* adjustment value */
3089 +} Elf64_Rela;
3090 +
3091 +#define ELF64_R_SYM(info) ((info) >> 32)
3092 +#define ELF64_R_TYPE(info) ((info) & 0xFFFFFFFF)
3093 +#define ELF64_R_INFO(s,t) (((s) << 32) + (u_int32_t)(t))
3094 +
3095 +/* Program Header */
3096 +typedef struct {
3097 + Elf32_Word p_type; /* segment type */
3098 + Elf32_Off p_offset; /* segment offset */
3099 + Elf32_Addr p_vaddr; /* virtual address of segment */
3100 + Elf32_Addr p_paddr; /* physical address - ignored? */
3101 + Elf32_Word p_filesz; /* number of bytes in file for seg. */
3102 + Elf32_Word p_memsz; /* number of bytes in mem. for seg. */
3103 + Elf32_Word p_flags; /* flags */
3104 + Elf32_Word p_align; /* memory alignment */
3105 +} Elf32_Phdr;
3106 +
3107 +typedef struct {
3108 + Elf64_Half p_type; /* entry type */
3109 + Elf64_Half p_flags; /* flags */
3110 + Elf64_Off p_offset; /* offset */
3111 + Elf64_Addr p_vaddr; /* virtual address */
3112 + Elf64_Addr p_paddr; /* physical address */
3113 + Elf64_Xword p_filesz; /* file size */
3114 + Elf64_Xword p_memsz; /* memory size */
3115 + Elf64_Xword p_align; /* memory & file alignment */
3116 +} Elf64_Phdr;
3117 +
3118 +/* Segment types - p_type */
3119 +#define PT_NULL 0 /* unused */
3120 +#define PT_LOAD 1 /* loadable segment */
3121 +#define PT_DYNAMIC 2 /* dynamic linking section */
3122 +#define PT_INTERP 3 /* the RTLD */
3123 +#define PT_NOTE 4 /* auxiliary information */
3124 +#define PT_SHLIB 5 /* reserved - purpose undefined */
3125 +#define PT_PHDR 6 /* program header */
3126 +#define PT_NUM 7 /* Number of segment types */
3127 +#define PT_LOPROC 0x70000000 /* reserved range for processor */
3128 +#define PT_HIPROC 0x7fffffff /* specific segment types */
3129 +
3130 +/* Segment flags - p_flags */
3131 +#define PF_X 0x1 /* Executable */
3132 +#define PF_W 0x2 /* Writable */
3133 +#define PF_R 0x4 /* Readable */
3134 +#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */
3135 + /* specific segment flags */
3136 +
3137 +/* Dynamic structure */
3138 +typedef struct {
3139 + Elf32_Sword d_tag; /* controls meaning of d_val */
3140 + union {
3141 + Elf32_Word d_val; /* Multiple meanings - see d_tag */
3142 + Elf32_Addr d_ptr; /* program virtual address */
3143 + } d_un;
3144 +} Elf32_Dyn;
3145 +
3146 +typedef struct {
3147 + Elf64_Xword d_tag; /* controls meaning of d_val */
3148 + union {
3149 + Elf64_Addr d_ptr;
3150 + Elf64_Xword d_val;
3151 + } d_un;
3152 +} Elf64_Dyn;
3153 +
3154 +/* Dynamic Array Tags - d_tag */
3155 +#define DT_NULL 0 /* marks end of _DYNAMIC array */
3156 +#define DT_NEEDED 1 /* string table offset of needed lib */
3157 +#define DT_PLTRELSZ 2 /* size of relocation entries in PLT */
3158 +#define DT_PLTGOT 3 /* address PLT/GOT */
3159 +#define DT_HASH 4 /* address of symbol hash table */
3160 +#define DT_STRTAB 5 /* address of string table */
3161 +#define DT_SYMTAB 6 /* address of symbol table */
3162 +#define DT_RELA 7 /* address of relocation table */
3163 +#define DT_RELASZ 8 /* size of relocation table */
3164 +#define DT_RELAENT 9 /* size of relocation entry */
3165 +#define DT_STRSZ 10 /* size of string table */
3166 +#define DT_SYMENT 11 /* size of symbol table entry */
3167 +#define DT_INIT 12 /* address of initialization func. */
3168 +#define DT_FINI 13 /* address of termination function */
3169 +#define DT_SONAME 14 /* string table offset of shared obj */
3170 +#define DT_RPATH 15 /* string table offset of library
3171 + search path */
3172 +#define DT_SYMBOLIC 16 /* start sym search in shared obj. */
3173 +#define DT_REL 17 /* address of rel. tbl. w addends */
3174 +#define DT_RELSZ 18 /* size of DT_REL relocation table */
3175 +#define DT_RELENT 19 /* size of DT_REL relocation entry */
3176 +#define DT_PLTREL 20 /* PLT referenced relocation entry */
3177 +#define DT_DEBUG 21 /* bugger */
3178 +#define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */
3179 +#define DT_JMPREL 23 /* add. of PLT's relocation entries */
3180 +#define DT_BIND_NOW 24 /* Bind now regardless of env setting */
3181 +#define DT_NUM 25 /* Number used. */
3182 +#define DT_LOPROC 0x70000000 /* reserved range for processor */
3183 +#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */
3184 +
3185 +/* Standard ELF hashing function */
3186 +unsigned int elf_hash(const unsigned char *name);
3187 +
3188 +/*
3189 + * Note Definitions
3190 + */
3191 +typedef struct {
3192 + Elf32_Word namesz;
3193 + Elf32_Word descsz;
3194 + Elf32_Word type;
3195 +} Elf32_Note;
3196 +
3197 +typedef struct {
3198 + Elf64_Half namesz;
3199 + Elf64_Half descsz;
3200 + Elf64_Half type;
3201 +} Elf64_Note;
3202 +
3203 +
3204 +#if defined(ELFSIZE)
3205 +#define CONCAT(x,y) __CONCAT(x,y)
3206 +#define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))
3207 +#define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y))))
3208 +#define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE))
3209 +#define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))
3210 +#endif
3211 +
3212 +#if defined(ELFSIZE) && (ELFSIZE == 32)
3213 +#define Elf_Ehdr Elf32_Ehdr
3214 +#define Elf_Phdr Elf32_Phdr
3215 +#define Elf_Shdr Elf32_Shdr
3216 +#define Elf_Sym Elf32_Sym
3217 +#define Elf_Rel Elf32_Rel
3218 +#define Elf_RelA Elf32_Rela
3219 +#define Elf_Dyn Elf32_Dyn
3220 +#define Elf_Word Elf32_Word
3221 +#define Elf_Sword Elf32_Sword
3222 +#define Elf_Addr Elf32_Addr
3223 +#define Elf_Off Elf32_Off
3224 +#define Elf_Nhdr Elf32_Nhdr
3225 +#define Elf_Note Elf32_Note
3226 +
3227 +#define ELF_R_SYM ELF32_R_SYM
3228 +#define ELF_R_TYPE ELF32_R_TYPE
3229 +#define ELF_R_INFO ELF32_R_INFO
3230 +#define ELFCLASS ELFCLASS32
3231 +
3232 +#define ELF_ST_BIND ELF32_ST_BIND
3233 +#define ELF_ST_TYPE ELF32_ST_TYPE
3234 +#define ELF_ST_INFO ELF32_ST_INFO
3235 +
3236 +#define AuxInfo Aux32Info
3237 +#elif defined(ELFSIZE) && (ELFSIZE == 64)
3238 +#define Elf_Ehdr Elf64_Ehdr
3239 +#define Elf_Phdr Elf64_Phdr
3240 +#define Elf_Shdr Elf64_Shdr
3241 +#define Elf_Sym Elf64_Sym
3242 +#define Elf_Rel Elf64_Rel
3243 +#define Elf_RelA Elf64_Rela
3244 +#define Elf_Dyn Elf64_Dyn
3245 +#define Elf_Word Elf64_Word
3246 +#define Elf_Sword Elf64_Sword
3247 +#define Elf_Addr Elf64_Addr
3248 +#define Elf_Off Elf64_Off
3249 +#define Elf_Nhdr Elf64_Nhdr
3250 +#define Elf_Note Elf64_Note
3251 +
3252 +#define ELF_R_SYM ELF64_R_SYM
3253 +#define ELF_R_TYPE ELF64_R_TYPE
3254 +#define ELF_R_INFO ELF64_R_INFO
3255 +#define ELFCLASS ELFCLASS64
3256 +
3257 +#define ELF_ST_BIND ELF64_ST_BIND
3258 +#define ELF_ST_TYPE ELF64_ST_TYPE
3259 +#define ELF_ST_INFO ELF64_ST_INFO
3260 +
3261 +#define AuxInfo Aux64Info
3262 +#endif
3263 +
3264 +#endif /* __XEN_PUBLIC_ELFSTRUCTS_H__ */
3265 Index: head-2008-11-25/include/xen/interface/hvm/e820.h
3266 ===================================================================
3267 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
3268 +++ head-2008-11-25/include/xen/interface/hvm/e820.h 2007-06-12 13:14:19.000000000 +0200
3269 @@ -0,0 +1,34 @@
3270 +
3271 +/*
3272 + * Permission is hereby granted, free of charge, to any person obtaining a copy
3273 + * of this software and associated documentation files (the "Software"), to
3274 + * deal in the Software without restriction, including without limitation the
3275 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
3276 + * sell copies of the Software, and to permit persons to whom the Software is
3277 + * furnished to do so, subject to the following conditions:
3278 + *
3279 + * The above copyright notice and this permission notice shall be included in
3280 + * all copies or substantial portions of the Software.
3281 + *
3282 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3283 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3284 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3285 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3286 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3287 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3288 + * DEALINGS IN THE SOFTWARE.
3289 + */
3290 +
3291 +#ifndef __XEN_PUBLIC_HVM_E820_H__
3292 +#define __XEN_PUBLIC_HVM_E820_H__
3293 +
3294 +/* E820 location in HVM virtual address space. */
3295 +#define HVM_E820_PAGE 0x00090000
3296 +#define HVM_E820_NR_OFFSET 0x000001E8
3297 +#define HVM_E820_OFFSET 0x000002D0
3298 +
3299 +#define HVM_BELOW_4G_RAM_END 0xF0000000
3300 +#define HVM_BELOW_4G_MMIO_START HVM_BELOW_4G_RAM_END
3301 +#define HVM_BELOW_4G_MMIO_LENGTH ((1ULL << 32) - HVM_BELOW_4G_MMIO_START)
3302 +
3303 +#endif /* __XEN_PUBLIC_HVM_E820_H__ */
3304 Index: head-2008-11-25/include/xen/interface/hvm/hvm_info_table.h
3305 ===================================================================
3306 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
3307 +++ head-2008-11-25/include/xen/interface/hvm/hvm_info_table.h 2007-06-12 13:14:19.000000000 +0200
3308 @@ -0,0 +1,41 @@
3309 +/******************************************************************************
3310 + * hvm/hvm_info_table.h
3311 + *
3312 + * HVM parameter and information table, written into guest memory map.
3313 + *
3314 + * Permission is hereby granted, free of charge, to any person obtaining a copy
3315 + * of this software and associated documentation files (the "Software"), to
3316 + * deal in the Software without restriction, including without limitation the
3317 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
3318 + * sell copies of the Software, and to permit persons to whom the Software is
3319 + * furnished to do so, subject to the following conditions:
3320 + *
3321 + * The above copyright notice and this permission notice shall be included in
3322 + * all copies or substantial portions of the Software.
3323 + *
3324 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3325 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3326 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3327 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3328 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3329 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3330 + * DEALINGS IN THE SOFTWARE.
3331 + */
3332 +
3333 +#ifndef __XEN_PUBLIC_HVM_HVM_INFO_TABLE_H__
3334 +#define __XEN_PUBLIC_HVM_HVM_INFO_TABLE_H__
3335 +
3336 +#define HVM_INFO_PFN 0x09F
3337 +#define HVM_INFO_OFFSET 0x800
3338 +#define HVM_INFO_PADDR ((HVM_INFO_PFN << 12) + HVM_INFO_OFFSET)
3339 +
3340 +struct hvm_info_table {
3341 + char signature[8]; /* "HVM INFO" */
3342 + uint32_t length;
3343 + uint8_t checksum;
3344 + uint8_t acpi_enabled;
3345 + uint8_t apic_mode;
3346 + uint32_t nr_vcpus;
3347 +};
3348 +
3349 +#endif /* __XEN_PUBLIC_HVM_HVM_INFO_TABLE_H__ */
3350 Index: head-2008-11-25/include/xen/interface/hvm/hvm_op.h
3351 ===================================================================
3352 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
3353 +++ head-2008-11-25/include/xen/interface/hvm/hvm_op.h 2008-09-01 12:07:31.000000000 +0200
3354 @@ -0,0 +1,131 @@
3355 +/*
3356 + * Permission is hereby granted, free of charge, to any person obtaining a copy
3357 + * of this software and associated documentation files (the "Software"), to
3358 + * deal in the Software without restriction, including without limitation the
3359 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
3360 + * sell copies of the Software, and to permit persons to whom the Software is
3361 + * furnished to do so, subject to the following conditions:
3362 + *
3363 + * The above copyright notice and this permission notice shall be included in
3364 + * all copies or substantial portions of the Software.
3365 + *
3366 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3367 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3368 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3369 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3370 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3371 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3372 + * DEALINGS IN THE SOFTWARE.
3373 + */
3374 +
3375 +#ifndef __XEN_PUBLIC_HVM_HVM_OP_H__
3376 +#define __XEN_PUBLIC_HVM_HVM_OP_H__
3377 +
3378 +/* Get/set subcommands: extra argument == pointer to xen_hvm_param struct. */
3379 +#define HVMOP_set_param 0
3380 +#define HVMOP_get_param 1
3381 +struct xen_hvm_param {
3382 + domid_t domid; /* IN */
3383 + uint32_t index; /* IN */
3384 + uint64_t value; /* IN/OUT */
3385 +};
3386 +typedef struct xen_hvm_param xen_hvm_param_t;
3387 +DEFINE_XEN_GUEST_HANDLE(xen_hvm_param_t);
3388 +
3389 +/* Set the logical level of one of a domain's PCI INTx wires. */
3390 +#define HVMOP_set_pci_intx_level 2
3391 +struct xen_hvm_set_pci_intx_level {
3392 + /* Domain to be updated. */
3393 + domid_t domid;
3394 + /* PCI INTx identification in PCI topology (domain:bus:device:intx). */
3395 + uint8_t domain, bus, device, intx;
3396 + /* Assertion level (0 = unasserted, 1 = asserted). */
3397 + uint8_t level;
3398 +};
3399 +typedef struct xen_hvm_set_pci_intx_level xen_hvm_set_pci_intx_level_t;
3400 +DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_intx_level_t);
3401 +
3402 +/* Set the logical level of one of a domain's ISA IRQ wires. */
3403 +#define HVMOP_set_isa_irq_level 3
3404 +struct xen_hvm_set_isa_irq_level {
3405 + /* Domain to be updated. */
3406 + domid_t domid;
3407 + /* ISA device identification, by ISA IRQ (0-15). */
3408 + uint8_t isa_irq;
3409 + /* Assertion level (0 = unasserted, 1 = asserted). */
3410 + uint8_t level;
3411 +};
3412 +typedef struct xen_hvm_set_isa_irq_level xen_hvm_set_isa_irq_level_t;
3413 +DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_isa_irq_level_t);
3414 +
3415 +#define HVMOP_set_pci_link_route 4
3416 +struct xen_hvm_set_pci_link_route {
3417 + /* Domain to be updated. */
3418 + domid_t domid;
3419 + /* PCI link identifier (0-3). */
3420 + uint8_t link;
3421 + /* ISA IRQ (1-15), or 0 (disable link). */
3422 + uint8_t isa_irq;
3423 +};
3424 +typedef struct xen_hvm_set_pci_link_route xen_hvm_set_pci_link_route_t;
3425 +DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_link_route_t);
3426 +
3427 +/* Flushes all VCPU TLBs: @arg must be NULL. */
3428 +#define HVMOP_flush_tlbs 5
3429 +
3430 +/* Following tools-only interfaces may change in future. */
3431 +#if defined(__XEN__) || defined(__XEN_TOOLS__)
3432 +
3433 +/* Track dirty VRAM. */
3434 +#define HVMOP_track_dirty_vram 6
3435 +struct xen_hvm_track_dirty_vram {
3436 + /* Domain to be tracked. */
3437 + domid_t domid;
3438 + /* First pfn to track. */
3439 + uint64_aligned_t first_pfn;
3440 + /* Number of pages to track. */
3441 + uint64_aligned_t nr;
3442 + /* OUT variable. */
3443 + /* Dirty bitmap buffer. */
3444 + XEN_GUEST_HANDLE_64(uint8) dirty_bitmap;
3445 +};
3446 +typedef struct xen_hvm_track_dirty_vram xen_hvm_track_dirty_vram_t;
3447 +DEFINE_XEN_GUEST_HANDLE(xen_hvm_track_dirty_vram_t);
3448 +
3449 +/* Notify that some pages got modified by the Device Model. */
3450 +#define HVMOP_modified_memory 7
3451 +struct xen_hvm_modified_memory {
3452 + /* Domain to be updated. */
3453 + domid_t domid;
3454 + /* First pfn. */
3455 + uint64_aligned_t first_pfn;
3456 + /* Number of pages. */
3457 + uint64_aligned_t nr;
3458 +};
3459 +typedef struct xen_hvm_modified_memory xen_hvm_modified_memory_t;
3460 +DEFINE_XEN_GUEST_HANDLE(xen_hvm_modified_memory_t);
3461 +
3462 +#define HVMOP_set_mem_type 8
3463 +typedef enum {
3464 + HVMMEM_ram_rw, /* Normal read/write guest RAM */
3465 + HVMMEM_ram_ro, /* Read-only; writes are discarded */
3466 + HVMMEM_mmio_dm, /* Reads and write go to the device model */
3467 +} hvmmem_type_t;
3468 +/* Notify that a region of memory is to be treated in a specific way. */
3469 +struct xen_hvm_set_mem_type {
3470 + /* Domain to be updated. */
3471 + domid_t domid;
3472 + /* Memory type */
3473 + hvmmem_type_t hvmmem_type;
3474 + /* First pfn. */
3475 + uint64_aligned_t first_pfn;
3476 + /* Number of pages. */
3477 + uint64_aligned_t nr;
3478 +};
3479 +typedef struct xen_hvm_set_mem_type xen_hvm_set_mem_type_t;
3480 +DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_mem_type_t);
3481 +
3482 +
3483 +#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
3484 +
3485 +#endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */
3486 Index: head-2008-11-25/include/xen/interface/hvm/ioreq.h
3487 ===================================================================
3488 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
3489 +++ head-2008-11-25/include/xen/interface/hvm/ioreq.h 2008-04-02 12:34:02.000000000 +0200
3490 @@ -0,0 +1,127 @@
3491 +/*
3492 + * ioreq.h: I/O request definitions for device models
3493 + * Copyright (c) 2004, Intel Corporation.
3494 + *
3495 + * Permission is hereby granted, free of charge, to any person obtaining a copy
3496 + * of this software and associated documentation files (the "Software"), to
3497 + * deal in the Software without restriction, including without limitation the
3498 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
3499 + * sell copies of the Software, and to permit persons to whom the Software is
3500 + * furnished to do so, subject to the following conditions:
3501 + *
3502 + * The above copyright notice and this permission notice shall be included in
3503 + * all copies or substantial portions of the Software.
3504 + *
3505 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3506 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3507 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3508 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3509 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3510 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3511 + * DEALINGS IN THE SOFTWARE.
3512 + */
3513 +
3514 +#ifndef _IOREQ_H_
3515 +#define _IOREQ_H_
3516 +
3517 +#define IOREQ_READ 1
3518 +#define IOREQ_WRITE 0
3519 +
3520 +#define STATE_IOREQ_NONE 0
3521 +#define STATE_IOREQ_READY 1
3522 +#define STATE_IOREQ_INPROCESS 2
3523 +#define STATE_IORESP_READY 3
3524 +
3525 +#define IOREQ_TYPE_PIO 0 /* pio */
3526 +#define IOREQ_TYPE_COPY 1 /* mmio ops */
3527 +#define IOREQ_TYPE_TIMEOFFSET 7
3528 +#define IOREQ_TYPE_INVALIDATE 8 /* mapcache */
3529 +
3530 +/*
3531 + * VMExit dispatcher should cooperate with instruction decoder to
3532 + * prepare this structure and notify service OS and DM by sending
3533 + * virq
3534 + */
3535 +struct ioreq {
3536 + uint64_t addr; /* physical address */
3537 + uint64_t size; /* size in bytes */
3538 + uint64_t count; /* for rep prefixes */
3539 + uint64_t data; /* data (or paddr of data) */
3540 + uint8_t state:4;
3541 + uint8_t data_is_ptr:1; /* if 1, data above is the guest paddr
3542 + * of the real data to use. */
3543 + uint8_t dir:1; /* 1=read, 0=write */
3544 + uint8_t df:1;
3545 + uint8_t pad:1;
3546 + uint8_t type; /* I/O type */
3547 + uint8_t _pad0[6];
3548 + uint64_t io_count; /* How many IO done on a vcpu */
3549 +};
3550 +typedef struct ioreq ioreq_t;
3551 +
3552 +struct vcpu_iodata {
3553 + struct ioreq vp_ioreq;
3554 + /* Event channel port, used for notifications to/from the device model. */
3555 + uint32_t vp_eport;
3556 + uint32_t _pad0;
3557 +};
3558 +typedef struct vcpu_iodata vcpu_iodata_t;
3559 +
3560 +struct shared_iopage {
3561 + struct vcpu_iodata vcpu_iodata[1];
3562 +};
3563 +typedef struct shared_iopage shared_iopage_t;
3564 +
3565 +struct buf_ioreq {
3566 + uint8_t type; /* I/O type */
3567 + uint8_t pad:1;
3568 + uint8_t dir:1; /* 1=read, 0=write */
3569 + uint8_t size:2; /* 0=>1, 1=>2, 2=>4, 3=>8. If 8, use two buf_ioreqs */
3570 + uint32_t addr:20;/* physical address */
3571 + uint32_t data; /* data */
3572 +};
3573 +typedef struct buf_ioreq buf_ioreq_t;
3574 +
3575 +#define IOREQ_BUFFER_SLOT_NUM 511 /* 8 bytes each, plus 2 4-byte indexes */
3576 +struct buffered_iopage {
3577 + unsigned int read_pointer;
3578 + unsigned int write_pointer;
3579 + buf_ioreq_t buf_ioreq[IOREQ_BUFFER_SLOT_NUM];
3580 +}; /* NB. Size of this structure must be no greater than one page. */
3581 +typedef struct buffered_iopage buffered_iopage_t;
3582 +
3583 +#if defined(__ia64__)
3584 +struct pio_buffer {
3585 + uint32_t page_offset;
3586 + uint32_t pointer;
3587 + uint32_t data_end;
3588 + uint32_t buf_size;
3589 + void *opaque;
3590 +};
3591 +
3592 +#define PIO_BUFFER_IDE_PRIMARY 0 /* I/O port = 0x1F0 */
3593 +#define PIO_BUFFER_IDE_SECONDARY 1 /* I/O port = 0x170 */
3594 +#define PIO_BUFFER_ENTRY_NUM 2
3595 +struct buffered_piopage {
3596 + struct pio_buffer pio[PIO_BUFFER_ENTRY_NUM];
3597 + uint8_t buffer[1];
3598 +};
3599 +#endif /* defined(__ia64__) */
3600 +
3601 +#define ACPI_PM1A_EVT_BLK_ADDRESS 0x0000000000001f40
3602 +#define ACPI_PM1A_CNT_BLK_ADDRESS (ACPI_PM1A_EVT_BLK_ADDRESS + 0x04)
3603 +#define ACPI_PM_TMR_BLK_ADDRESS (ACPI_PM1A_EVT_BLK_ADDRESS + 0x08)
3604 +#define ACPI_GPE0_BLK_ADDRESS (ACPI_PM_TMR_BLK_ADDRESS + 0x20)
3605 +#define ACPI_GPE0_BLK_LEN 0x08
3606 +
3607 +#endif /* _IOREQ_H_ */
3608 +
3609 +/*
3610 + * Local variables:
3611 + * mode: C
3612 + * c-set-style: "BSD"
3613 + * c-basic-offset: 4
3614 + * tab-width: 4
3615 + * indent-tabs-mode: nil
3616 + * End:
3617 + */
3618 Index: head-2008-11-25/include/xen/interface/hvm/params.h
3619 ===================================================================
3620 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
3621 +++ head-2008-11-25/include/xen/interface/hvm/params.h 2008-10-29 09:55:56.000000000 +0100
3622 @@ -0,0 +1,105 @@
3623 +/*
3624 + * Permission is hereby granted, free of charge, to any person obtaining a copy
3625 + * of this software and associated documentation files (the "Software"), to
3626 + * deal in the Software without restriction, including without limitation the
3627 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
3628 + * sell copies of the Software, and to permit persons to whom the Software is
3629 + * furnished to do so, subject to the following conditions:
3630 + *
3631 + * The above copyright notice and this permission notice shall be included in
3632 + * all copies or substantial portions of the Software.
3633 + *
3634 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3635 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3636 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3637 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3638 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3639 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3640 + * DEALINGS IN THE SOFTWARE.
3641 + */
3642 +
3643 +#ifndef __XEN_PUBLIC_HVM_PARAMS_H__
3644 +#define __XEN_PUBLIC_HVM_PARAMS_H__
3645 +
3646 +#include "hvm_op.h"
3647 +
3648 +/*
3649 + * Parameter space for HVMOP_{set,get}_param.
3650 + */
3651 +
3652 +/*
3653 + * How should CPU0 event-channel notifications be delivered?
3654 + * val[63:56] == 0: val[55:0] is a delivery GSI (Global System Interrupt).
3655 + * val[63:56] == 1: val[55:0] is a delivery PCI INTx line, as follows:
3656 + * Domain = val[47:32], Bus = val[31:16],
3657 + * DevFn = val[15: 8], IntX = val[ 1: 0]
3658 + * If val == 0 then CPU0 event-channel notifications are not delivered.
3659 + */
3660 +#define HVM_PARAM_CALLBACK_IRQ 0
3661 +
3662 +/*
3663 + * These are not used by Xen. They are here for convenience of HVM-guest
3664 + * xenbus implementations.
3665 + */
3666 +#define HVM_PARAM_STORE_PFN 1
3667 +#define HVM_PARAM_STORE_EVTCHN 2
3668 +
3669 +#define HVM_PARAM_PAE_ENABLED 4
3670 +
3671 +#define HVM_PARAM_IOREQ_PFN 5
3672 +
3673 +#define HVM_PARAM_BUFIOREQ_PFN 6
3674 +
3675 +#ifdef __ia64__
3676 +
3677 +#define HVM_PARAM_NVRAM_FD 7
3678 +#define HVM_PARAM_VHPT_SIZE 8
3679 +#define HVM_PARAM_BUFPIOREQ_PFN 9
3680 +
3681 +#elif defined(__i386__) || defined(__x86_64__)
3682 +
3683 +/* Expose Viridian interfaces to this HVM guest? */
3684 +#define HVM_PARAM_VIRIDIAN 9
3685 +
3686 +#endif
3687 +
3688 +/*
3689 + * Set mode for virtual timers (currently x86 only):
3690 + * delay_for_missed_ticks (default):
3691 + * Do not advance a vcpu's time beyond the correct delivery time for
3692 + * interrupts that have been missed due to preemption. Deliver missed
3693 + * interrupts when the vcpu is rescheduled and advance the vcpu's virtual
3694 + * time stepwise for each one.
3695 + * no_delay_for_missed_ticks:
3696 + * As above, missed interrupts are delivered, but guest time always tracks
3697 + * wallclock (i.e., real) time while doing so.
3698 + * no_missed_ticks_pending:
3699 + * No missed interrupts are held pending. Instead, to ensure ticks are
3700 + * delivered at some non-zero rate, if we detect missed ticks then the
3701 + * internal tick alarm is not disabled if the VCPU is preempted during the
3702 + * next tick period.
3703 + * one_missed_tick_pending:
3704 + * Missed interrupts are collapsed together and delivered as one 'late tick'.
3705 + * Guest time always tracks wallclock (i.e., real) time.
3706 + */
3707 +#define HVM_PARAM_TIMER_MODE 10
3708 +#define HVMPTM_delay_for_missed_ticks 0
3709 +#define HVMPTM_no_delay_for_missed_ticks 1
3710 +#define HVMPTM_no_missed_ticks_pending 2
3711 +#define HVMPTM_one_missed_tick_pending 3
3712 +
3713 +/* Boolean: Enable virtual HPET (high-precision event timer)? (x86-only) */
3714 +#define HVM_PARAM_HPET_ENABLED 11
3715 +
3716 +/* Identity-map page directory used by Intel EPT when CR0.PG=0. */
3717 +#define HVM_PARAM_IDENT_PT 12
3718 +
3719 +/* Device Model domain, defaults to 0. */
3720 +#define HVM_PARAM_DM_DOMAIN 13
3721 +
3722 +/* ACPI S state: currently support S0 and S3 on x86. */
3723 +#define HVM_PARAM_ACPI_S_STATE 14
3724 +
3725 +#define HVM_NR_PARAMS 15
3726 +
3727 +#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
3728 Index: head-2008-11-25/include/xen/interface/hvm/save.h
3729 ===================================================================
3730 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
3731 +++ head-2008-11-25/include/xen/interface/hvm/save.h 2008-04-02 12:34:02.000000000 +0200
3732 @@ -0,0 +1,88 @@
3733 +/*
3734 + * hvm/save.h
3735 + *
3736 + * Structure definitions for HVM state that is held by Xen and must
3737 + * be saved along with the domain's memory and device-model state.
3738 + *
3739 + * Copyright (c) 2007 XenSource Ltd.
3740 + *
3741 + * Permission is hereby granted, free of charge, to any person obtaining a copy
3742 + * of this software and associated documentation files (the "Software"), to
3743 + * deal in the Software without restriction, including without limitation the
3744 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
3745 + * sell copies of the Software, and to permit persons to whom the Software is
3746 + * furnished to do so, subject to the following conditions:
3747 + *
3748 + * The above copyright notice and this permission notice shall be included in
3749 + * all copies or substantial portions of the Software.
3750 + *
3751 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3752 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3753 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3754 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3755 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3756 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3757 + * DEALINGS IN THE SOFTWARE.
3758 + */
3759 +
3760 +#ifndef __XEN_PUBLIC_HVM_SAVE_H__
3761 +#define __XEN_PUBLIC_HVM_SAVE_H__
3762 +
3763 +/*
3764 + * Structures in this header *must* have the same layout in 32bit
3765 + * and 64bit environments: this means that all fields must be explicitly
3766 + * sized types and aligned to their sizes, and the structs must be
3767 + * a multiple of eight bytes long.
3768 + *
3769 + * Only the state necessary for saving and restoring (i.e. fields
3770 + * that are analogous to actual hardware state) should go in this file.
3771 + * Internal mechanisms should be kept in Xen-private headers.
3772 + */
3773 +
3774 +#if !defined(__GNUC__) || defined(__STRICT_ANSI__)
3775 +#error "Anonymous structs/unions are a GNU extension."
3776 +#endif
3777 +
3778 +/*
3779 + * Each entry is preceded by a descriptor giving its type and length
3780 + */
3781 +struct hvm_save_descriptor {
3782 + uint16_t typecode; /* Used to demux the various types below */
3783 + uint16_t instance; /* Further demux within a type */
3784 + uint32_t length; /* In bytes, *not* including this descriptor */
3785 +};
3786 +
3787 +
3788 +/*
3789 + * Each entry has a datatype associated with it: for example, the CPU state
3790 + * is saved as a HVM_SAVE_TYPE(CPU), which has HVM_SAVE_LENGTH(CPU),
3791 + * and is identified by a descriptor with typecode HVM_SAVE_CODE(CPU).
3792 + * DECLARE_HVM_SAVE_TYPE binds these things together with some type-system
3793 + * ugliness.
3794 + */
3795 +
3796 +#define DECLARE_HVM_SAVE_TYPE(_x, _code, _type) \
3797 + struct __HVM_SAVE_TYPE_##_x { _type t; char c[_code]; }
3798 +
3799 +#define HVM_SAVE_TYPE(_x) typeof (((struct __HVM_SAVE_TYPE_##_x *)(0))->t)
3800 +#define HVM_SAVE_LENGTH(_x) (sizeof (HVM_SAVE_TYPE(_x)))
3801 +#define HVM_SAVE_CODE(_x) (sizeof (((struct __HVM_SAVE_TYPE_##_x *)(0))->c))
3802 +
3803 +
3804 +/*
3805 + * The series of save records is teminated by a zero-type, zero-length
3806 + * descriptor.
3807 + */
3808 +
3809 +struct hvm_save_end {};
3810 +DECLARE_HVM_SAVE_TYPE(END, 0, struct hvm_save_end);
3811 +
3812 +#if defined(__i386__) || defined(__x86_64__)
3813 +#include "../arch-x86/hvm/save.h"
3814 +#elif defined(__ia64__)
3815 +#include "../arch-ia64/hvm/save.h"
3816 +#else
3817 +#error "unsupported architecture"
3818 +#endif
3819 +
3820 +#endif /* __XEN_PUBLIC_HVM_SAVE_H__ */
3821 Index: head-2008-11-25/include/xen/interface/hvm/vmx_assist.h
3822 ===================================================================
3823 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
3824 +++ head-2008-11-25/include/xen/interface/hvm/vmx_assist.h 2007-06-12 13:14:19.000000000 +0200
3825 @@ -0,0 +1,122 @@
3826 +/*
3827 + * vmx_assist.h: Context definitions for the VMXASSIST world switch.
3828 + *
3829 + * Permission is hereby granted, free of charge, to any person obtaining a copy
3830 + * of this software and associated documentation files (the "Software"), to
3831 + * deal in the Software without restriction, including without limitation the
3832 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
3833 + * sell copies of the Software, and to permit persons to whom the Software is
3834 + * furnished to do so, subject to the following conditions:
3835 + *
3836 + * The above copyright notice and this permission notice shall be included in
3837 + * all copies or substantial portions of the Software.
3838 + *
3839 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3840 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3841 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3842 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3843 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3844 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3845 + * DEALINGS IN THE SOFTWARE.
3846 + *
3847 + * Leendert van Doorn, leendert@watson.ibm.com
3848 + * Copyright (c) 2005, International Business Machines Corporation.
3849 + */
3850 +
3851 +#ifndef _VMX_ASSIST_H_
3852 +#define _VMX_ASSIST_H_
3853 +
3854 +#define VMXASSIST_BASE 0xD0000
3855 +#define VMXASSIST_MAGIC 0x17101966
3856 +#define VMXASSIST_MAGIC_OFFSET (VMXASSIST_BASE+8)
3857 +
3858 +#define VMXASSIST_NEW_CONTEXT (VMXASSIST_BASE + 12)
3859 +#define VMXASSIST_OLD_CONTEXT (VMXASSIST_NEW_CONTEXT + 4)
3860 +
3861 +#ifndef __ASSEMBLY__
3862 +
3863 +#define NR_EXCEPTION_HANDLER 32
3864 +#define NR_INTERRUPT_HANDLERS 16
3865 +#define NR_TRAPS (NR_EXCEPTION_HANDLER+NR_INTERRUPT_HANDLERS)
3866 +
3867 +union vmcs_arbytes {
3868 + struct arbyte_fields {
3869 + unsigned int seg_type : 4,
3870 + s : 1,
3871 + dpl : 2,
3872 + p : 1,
3873 + reserved0 : 4,
3874 + avl : 1,
3875 + reserved1 : 1,
3876 + default_ops_size: 1,
3877 + g : 1,
3878 + null_bit : 1,
3879 + reserved2 : 15;
3880 + } fields;
3881 + unsigned int bytes;
3882 +};
3883 +
3884 +/*
3885 + * World switch state
3886 + */
3887 +struct vmx_assist_context {
3888 + uint32_t eip; /* execution pointer */
3889 + uint32_t esp; /* stack pointer */
3890 + uint32_t eflags; /* flags register */
3891 + uint32_t cr0;
3892 + uint32_t cr3; /* page table directory */
3893 + uint32_t cr4;
3894 + uint32_t idtr_limit; /* idt */
3895 + uint32_t idtr_base;
3896 + uint32_t gdtr_limit; /* gdt */
3897 + uint32_t gdtr_base;
3898 + uint32_t cs_sel; /* cs selector */
3899 + uint32_t cs_limit;
3900 + uint32_t cs_base;
3901 + union vmcs_arbytes cs_arbytes;
3902 + uint32_t ds_sel; /* ds selector */
3903 + uint32_t ds_limit;
3904 + uint32_t ds_base;
3905 + union vmcs_arbytes ds_arbytes;
3906 + uint32_t es_sel; /* es selector */
3907 + uint32_t es_limit;
3908 + uint32_t es_base;
3909 + union vmcs_arbytes es_arbytes;
3910 + uint32_t ss_sel; /* ss selector */
3911 + uint32_t ss_limit;
3912 + uint32_t ss_base;
3913 + union vmcs_arbytes ss_arbytes;
3914 + uint32_t fs_sel; /* fs selector */
3915 + uint32_t fs_limit;
3916 + uint32_t fs_base;
3917 + union vmcs_arbytes fs_arbytes;
3918 + uint32_t gs_sel; /* gs selector */
3919 + uint32_t gs_limit;
3920 + uint32_t gs_base;
3921 + union vmcs_arbytes gs_arbytes;
3922 + uint32_t tr_sel; /* task selector */
3923 + uint32_t tr_limit;
3924 + uint32_t tr_base;
3925 + union vmcs_arbytes tr_arbytes;
3926 + uint32_t ldtr_sel; /* ldtr selector */
3927 + uint32_t ldtr_limit;
3928 + uint32_t ldtr_base;
3929 + union vmcs_arbytes ldtr_arbytes;
3930 +
3931 + unsigned char rm_irqbase[2];
3932 +};
3933 +typedef struct vmx_assist_context vmx_assist_context_t;
3934 +
3935 +#endif /* __ASSEMBLY__ */
3936 +
3937 +#endif /* _VMX_ASSIST_H_ */
3938 +
3939 +/*
3940 + * Local variables:
3941 + * mode: C
3942 + * c-set-style: "BSD"
3943 + * c-basic-offset: 4
3944 + * tab-width: 4
3945 + * indent-tabs-mode: nil
3946 + * End:
3947 + */
3948 Index: head-2008-11-25/include/xen/interface/io/fsif.h
3949 ===================================================================
3950 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
3951 +++ head-2008-11-25/include/xen/interface/io/fsif.h 2008-09-01 12:07:31.000000000 +0200
3952 @@ -0,0 +1,191 @@
3953 +/******************************************************************************
3954 + * fsif.h
3955 + *
3956 + * Interface to FS level split device drivers.
3957 + *
3958 + * Permission is hereby granted, free of charge, to any person obtaining a copy
3959 + * of this software and associated documentation files (the "Software"), to
3960 + * deal in the Software without restriction, including without limitation the
3961 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
3962 + * sell copies of the Software, and to permit persons to whom the Software is
3963 + * furnished to do so, subject to the following conditions:
3964 + *
3965 + * The above copyright notice and this permission notice shall be included in
3966 + * all copies or substantial portions of the Software.
3967 + *
3968 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3969 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3970 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3971 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3972 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3973 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3974 + * DEALINGS IN THE SOFTWARE.
3975 + *
3976 + * Copyright (c) 2007, Grzegorz Milos, <gm281@cam.ac.uk>.
3977 + */
3978 +
3979 +#ifndef __XEN_PUBLIC_IO_FSIF_H__
3980 +#define __XEN_PUBLIC_IO_FSIF_H__
3981 +
3982 +#include "ring.h"
3983 +#include "../grant_table.h"
3984 +
3985 +#define REQ_FILE_OPEN 1
3986 +#define REQ_FILE_CLOSE 2
3987 +#define REQ_FILE_READ 3
3988 +#define REQ_FILE_WRITE 4
3989 +#define REQ_STAT 5
3990 +#define REQ_FILE_TRUNCATE 6
3991 +#define REQ_REMOVE 7
3992 +#define REQ_RENAME 8
3993 +#define REQ_CREATE 9
3994 +#define REQ_DIR_LIST 10
3995 +#define REQ_CHMOD 11
3996 +#define REQ_FS_SPACE 12
3997 +#define REQ_FILE_SYNC 13
3998 +
3999 +struct fsif_open_request {
4000 + grant_ref_t gref;
4001 +};
4002 +
4003 +struct fsif_close_request {
4004 + uint32_t fd;
4005 +};
4006 +
4007 +struct fsif_read_request {
4008 + uint32_t fd;
4009 + int32_t pad;
4010 + uint64_t len;
4011 + uint64_t offset;
4012 + grant_ref_t grefs[1]; /* Variable length */
4013 +};
4014 +
4015 +struct fsif_write_request {
4016 + uint32_t fd;
4017 + int32_t pad;
4018 + uint64_t len;
4019 + uint64_t offset;
4020 + grant_ref_t grefs[1]; /* Variable length */
4021 +};
4022 +
4023 +struct fsif_stat_request {
4024 + uint32_t fd;
4025 +};
4026 +
4027 +/* This structure is a copy of some fields from stat structure, returned
4028 + * via the ring. */
4029 +struct fsif_stat_response {
4030 + int32_t stat_mode;
4031 + uint32_t stat_uid;
4032 + uint32_t stat_gid;
4033 + int32_t stat_ret;
4034 + int64_t stat_size;
4035 + int64_t stat_atime;
4036 + int64_t stat_mtime;
4037 + int64_t stat_ctime;
4038 +};
4039 +
4040 +struct fsif_truncate_request {
4041 + uint32_t fd;
4042 + int32_t pad;
4043 + int64_t length;
4044 +};
4045 +
4046 +struct fsif_remove_request {
4047 + grant_ref_t gref;
4048 +};
4049 +
4050 +struct fsif_rename_request {
4051 + uint16_t old_name_offset;
4052 + uint16_t new_name_offset;
4053 + grant_ref_t gref;
4054 +};
4055 +
4056 +struct fsif_create_request {
4057 + int8_t directory;
4058 + int8_t pad;
4059 + int16_t pad2;
4060 + int32_t mode;
4061 + grant_ref_t gref;
4062 +};
4063 +
4064 +struct fsif_list_request {
4065 + uint32_t offset;
4066 + grant_ref_t gref;
4067 +};
4068 +
4069 +#define NR_FILES_SHIFT 0
4070 +#define NR_FILES_SIZE 16 /* 16 bits for the number of files mask */
4071 +#define NR_FILES_MASK (((1ULL << NR_FILES_SIZE) - 1) << NR_FILES_SHIFT)
4072 +#define ERROR_SIZE 32 /* 32 bits for the error mask */
4073 +#define ERROR_SHIFT (NR_FILES_SIZE + NR_FILES_SHIFT)
4074 +#define ERROR_MASK (((1ULL << ERROR_SIZE) - 1) << ERROR_SHIFT)
4075 +#define HAS_MORE_SHIFT (ERROR_SHIFT + ERROR_SIZE)
4076 +#define HAS_MORE_FLAG (1ULL << HAS_MORE_SHIFT)
4077 +
4078 +struct fsif_chmod_request {
4079 + uint32_t fd;
4080 + int32_t mode;
4081 +};
4082 +
4083 +struct fsif_space_request {
4084 + grant_ref_t gref;
4085 +};
4086 +
4087 +struct fsif_sync_request {
4088 + uint32_t fd;
4089 +};
4090 +
4091 +
4092 +/* FS operation request */
4093 +struct fsif_request {
4094 + uint8_t type; /* Type of the request */
4095 + uint8_t pad;
4096 + uint16_t id; /* Request ID, copied to the response */
4097 + uint32_t pad2;
4098 + union {
4099 + struct fsif_open_request fopen;
4100 + struct fsif_close_request fclose;
4101 + struct fsif_read_request fread;
4102 + struct fsif_write_request fwrite;
4103 + struct fsif_stat_request fstat;
4104 + struct fsif_truncate_request ftruncate;
4105 + struct fsif_remove_request fremove;
4106 + struct fsif_rename_request frename;
4107 + struct fsif_create_request fcreate;
4108 + struct fsif_list_request flist;
4109 + struct fsif_chmod_request fchmod;
4110 + struct fsif_space_request fspace;
4111 + struct fsif_sync_request fsync;
4112 + } u;
4113 +};
4114 +typedef struct fsif_request fsif_request_t;
4115 +
4116 +/* FS operation response */
4117 +struct fsif_response {
4118 + uint16_t id;
4119 + uint16_t pad1;
4120 + uint32_t pad2;
4121 + union {
4122 + uint64_t ret_val;
4123 + struct fsif_stat_response fstat;
4124 + };
4125 +};
4126 +
4127 +typedef struct fsif_response fsif_response_t;
4128 +
4129 +#define FSIF_RING_ENTRY_SIZE 64
4130 +
4131 +#define FSIF_NR_READ_GNTS ((FSIF_RING_ENTRY_SIZE - sizeof(struct fsif_read_request)) / \
4132 + sizeof(grant_ref_t) + 1)
4133 +#define FSIF_NR_WRITE_GNTS ((FSIF_RING_ENTRY_SIZE - sizeof(struct fsif_write_request)) / \
4134 + sizeof(grant_ref_t) + 1)
4135 +
4136 +DEFINE_RING_TYPES(fsif, struct fsif_request, struct fsif_response);
4137 +
4138 +#define STATE_INITIALISED "init"
4139 +#define STATE_READY "ready"
4140 +
4141 +
4142 +
4143 +#endif
4144 Index: head-2008-11-25/include/xen/interface/io/pciif.h
4145 ===================================================================
4146 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4147 +++ head-2008-11-25/include/xen/interface/io/pciif.h 2008-07-21 11:00:33.000000000 +0200
4148 @@ -0,0 +1,101 @@
4149 +/*
4150 + * PCI Backend/Frontend Common Data Structures & Macros
4151 + *
4152 + * Permission is hereby granted, free of charge, to any person obtaining a copy
4153 + * of this software and associated documentation files (the "Software"), to
4154 + * deal in the Software without restriction, including without limitation the
4155 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
4156 + * sell copies of the Software, and to permit persons to whom the Software is
4157 + * furnished to do so, subject to the following conditions:
4158 + *
4159 + * The above copyright notice and this permission notice shall be included in
4160 + * all copies or substantial portions of the Software.
4161 + *
4162 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4163 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4164 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4165 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4166 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4167 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
4168 + * DEALINGS IN THE SOFTWARE.
4169 + *
4170 + * Author: Ryan Wilson <hap9@epoch.ncsc.mil>
4171 + */
4172 +#ifndef __XEN_PCI_COMMON_H__
4173 +#define __XEN_PCI_COMMON_H__
4174 +
4175 +/* Be sure to bump this number if you change this file */
4176 +#define XEN_PCI_MAGIC "7"
4177 +
4178 +/* xen_pci_sharedinfo flags */
4179 +#define _XEN_PCIF_active (0)
4180 +#define XEN_PCIF_active (1<<_XEN_PCI_active)
4181 +
4182 +/* xen_pci_op commands */
4183 +#define XEN_PCI_OP_conf_read (0)
4184 +#define XEN_PCI_OP_conf_write (1)
4185 +#define XEN_PCI_OP_enable_msi (2)
4186 +#define XEN_PCI_OP_disable_msi (3)
4187 +#define XEN_PCI_OP_enable_msix (4)
4188 +#define XEN_PCI_OP_disable_msix (5)
4189 +
4190 +/* xen_pci_op error numbers */
4191 +#define XEN_PCI_ERR_success (0)
4192 +#define XEN_PCI_ERR_dev_not_found (-1)
4193 +#define XEN_PCI_ERR_invalid_offset (-2)
4194 +#define XEN_PCI_ERR_access_denied (-3)
4195 +#define XEN_PCI_ERR_not_implemented (-4)
4196 +/* XEN_PCI_ERR_op_failed - backend failed to complete the operation */
4197 +#define XEN_PCI_ERR_op_failed (-5)
4198 +
4199 +/*
4200 + * it should be PAGE_SIZE-sizeof(struct xen_pci_op))/sizeof(struct msix_entry))
4201 + * Should not exceed 128
4202 + */
4203 +#define SH_INFO_MAX_VEC 128
4204 +
4205 +struct xen_msix_entry {
4206 + uint16_t vector;
4207 + uint16_t entry;
4208 +};
4209 +struct xen_pci_op {
4210 + /* IN: what action to perform: XEN_PCI_OP_* */
4211 + uint32_t cmd;
4212 +
4213 + /* OUT: will contain an error number (if any) from errno.h */
4214 + int32_t err;
4215 +
4216 + /* IN: which device to touch */
4217 + uint32_t domain; /* PCI Domain/Segment */
4218 + uint32_t bus;
4219 + uint32_t devfn;
4220 +
4221 + /* IN: which configuration registers to touch */
4222 + int32_t offset;
4223 + int32_t size;
4224 +
4225 + /* IN/OUT: Contains the result after a READ or the value to WRITE */
4226 + uint32_t value;
4227 + /* IN: Contains extra infor for this operation */
4228 + uint32_t info;
4229 + /*IN: param for msi-x */
4230 + struct xen_msix_entry msix_entries[SH_INFO_MAX_VEC];
4231 +};
4232 +
4233 +struct xen_pci_sharedinfo {
4234 + /* flags - XEN_PCIF_* */
4235 + uint32_t flags;
4236 + struct xen_pci_op op;
4237 +};
4238 +
4239 +#endif /* __XEN_PCI_COMMON_H__ */
4240 +
4241 +/*
4242 + * Local variables:
4243 + * mode: C
4244 + * c-set-style: "BSD"
4245 + * c-basic-offset: 4
4246 + * tab-width: 4
4247 + * indent-tabs-mode: nil
4248 + * End:
4249 + */
4250 Index: head-2008-11-25/include/xen/interface/io/tpmif.h
4251 ===================================================================
4252 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4253 +++ head-2008-11-25/include/xen/interface/io/tpmif.h 2007-06-12 13:14:19.000000000 +0200
4254 @@ -0,0 +1,77 @@
4255 +/******************************************************************************
4256 + * tpmif.h
4257 + *
4258 + * TPM I/O interface for Xen guest OSes.
4259 + *
4260 + * Permission is hereby granted, free of charge, to any person obtaining a copy
4261 + * of this software and associated documentation files (the "Software"), to
4262 + * deal in the Software without restriction, including without limitation the
4263 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
4264 + * sell copies of the Software, and to permit persons to whom the Software is
4265 + * furnished to do so, subject to the following conditions:
4266 + *
4267 + * The above copyright notice and this permission notice shall be included in
4268 + * all copies or substantial portions of the Software.
4269 + *
4270 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4271 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4272 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4273 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4274 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4275 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
4276 + * DEALINGS IN THE SOFTWARE.
4277 + *
4278 + * Copyright (c) 2005, IBM Corporation
4279 + *
4280 + * Author: Stefan Berger, stefanb@us.ibm.com
4281 + * Grant table support: Mahadevan Gomathisankaran
4282 + *
4283 + * This code has been derived from tools/libxc/xen/io/netif.h
4284 + *
4285 + * Copyright (c) 2003-2004, Keir Fraser
4286 + */
4287 +
4288 +#ifndef __XEN_PUBLIC_IO_TPMIF_H__
4289 +#define __XEN_PUBLIC_IO_TPMIF_H__
4290 +
4291 +#include "../grant_table.h"
4292 +
4293 +struct tpmif_tx_request {
4294 + unsigned long addr; /* Machine address of packet. */
4295 + grant_ref_t ref; /* grant table access reference */
4296 + uint16_t unused;
4297 + uint16_t size; /* Packet size in bytes. */
4298 +};
4299 +typedef struct tpmif_tx_request tpmif_tx_request_t;
4300 +
4301 +/*
4302 + * The TPMIF_TX_RING_SIZE defines the number of pages the
4303 + * front-end and backend can exchange (= size of array).
4304 + */
4305 +typedef uint32_t TPMIF_RING_IDX;
4306 +
4307 +#define TPMIF_TX_RING_SIZE 1
4308 +
4309 +/* This structure must fit in a memory page. */
4310 +
4311 +struct tpmif_ring {
4312 + struct tpmif_tx_request req;
4313 +};
4314 +typedef struct tpmif_ring tpmif_ring_t;
4315 +
4316 +struct tpmif_tx_interface {
4317 + struct tpmif_ring ring[TPMIF_TX_RING_SIZE];
4318 +};
4319 +typedef struct tpmif_tx_interface tpmif_tx_interface_t;
4320 +
4321 +#endif
4322 +
4323 +/*
4324 + * Local variables:
4325 + * mode: C
4326 + * c-set-style: "BSD"
4327 + * c-basic-offset: 4
4328 + * tab-width: 4
4329 + * indent-tabs-mode: nil
4330 + * End:
4331 + */
4332 Index: head-2008-11-25/include/xen/interface/io/vscsiif.h
4333 ===================================================================
4334 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4335 +++ head-2008-11-25/include/xen/interface/io/vscsiif.h 2008-07-21 11:00:33.000000000 +0200
4336 @@ -0,0 +1,105 @@
4337 +/******************************************************************************
4338 + * vscsiif.h
4339 + *
4340 + * Based on the blkif.h code.
4341 + *
4342 + * Permission is hereby granted, free of charge, to any person obtaining a copy
4343 + * of this software and associated documentation files (the "Software"), to
4344 + * deal in the Software without restriction, including without limitation the
4345 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
4346 + * sell copies of the Software, and to permit persons to whom the Software is
4347 + * furnished to do so, subject to the following conditions:
4348 + *
4349 + * The above copyright notice and this permission notice shall be included in
4350 + * all copies or substantial portions of the Software.
4351 + *
4352 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4353 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4354 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4355 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4356 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4357 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
4358 + * DEALINGS IN THE SOFTWARE.
4359 + *
4360 + * Copyright(c) FUJITSU Limited 2008.
4361 + */
4362 +
4363 +#ifndef __XEN__PUBLIC_IO_SCSI_H__
4364 +#define __XEN__PUBLIC_IO_SCSI_H__
4365 +
4366 +#include "ring.h"
4367 +#include "../grant_table.h"
4368 +
4369 +/* command between backend and frontend */
4370 +#define VSCSIIF_ACT_SCSI_CDB 1 /* SCSI CDB command */
4371 +#define VSCSIIF_ACT_SCSI_ABORT 2 /* SCSI Device(Lun) Abort*/
4372 +#define VSCSIIF_ACT_SCSI_RESET 3 /* SCSI Device(Lun) Reset*/
4373 +
4374 +
4375 +#define VSCSIIF_BACK_MAX_PENDING_REQS 128
4376 +
4377 +/*
4378 + * Maximum scatter/gather segments per request.
4379 + *
4380 + * Considering balance between allocating al least 16 "vscsiif_request"
4381 + * structures on one page (4096bytes) and number of scatter gather
4382 + * needed, we decided to use 26 as a magic number.
4383 + */
4384 +#define VSCSIIF_SG_TABLESIZE 26
4385 +
4386 +/*
4387 + * base on linux kernel 2.6.18
4388 + */
4389 +#define VSCSIIF_MAX_COMMAND_SIZE 16
4390 +#define VSCSIIF_SENSE_BUFFERSIZE 96
4391 +
4392 +
4393 +struct vscsiif_request {
4394 + uint16_t rqid; /* private guest value, echoed in resp */
4395 + uint8_t act; /* command between backend and frontend */
4396 + uint8_t cmd_len;
4397 +
4398 + uint8_t cmnd[VSCSIIF_MAX_COMMAND_SIZE];
4399 + uint16_t timeout_per_command; /* The command is issued by twice
4400 + the value in Backend. */
4401 + uint16_t channel, id, lun;
4402 + uint16_t padding;
4403 + uint8_t sc_data_direction; /* for DMA_TO_DEVICE(1)
4404 + DMA_FROM_DEVICE(2)
4405 + DMA_NONE(3) requests */
4406 + uint8_t nr_segments; /* Number of pieces of scatter-gather */
4407 +
4408 + struct scsiif_request_segment {
4409 + grant_ref_t gref;
4410 + uint16_t offset;
4411 + uint16_t length;
4412 + } seg[VSCSIIF_SG_TABLESIZE];
4413 + uint32_t reserved[3];
4414 +};
4415 +typedef struct vscsiif_request vscsiif_request_t;
4416 +
4417 +struct vscsiif_response {
4418 + uint16_t rqid;
4419 + uint8_t padding;
4420 + uint8_t sense_len;
4421 + uint8_t sense_buffer[VSCSIIF_SENSE_BUFFERSIZE];
4422 + int32_t rslt;
4423 + uint32_t residual_len; /* request bufflen -
4424 + return the value from physical device */
4425 + uint32_t reserved[36];
4426 +};
4427 +typedef struct vscsiif_response vscsiif_response_t;
4428 +
4429 +DEFINE_RING_TYPES(vscsiif, struct vscsiif_request, struct vscsiif_response);
4430 +
4431 +
4432 +#endif /*__XEN__PUBLIC_IO_SCSI_H__*/
4433 +/*
4434 + * Local variables:
4435 + * mode: C
4436 + * c-set-style: "BSD"
4437 + * c-basic-offset: 4
4438 + * tab-width: 4
4439 + * indent-tabs-mode: nil
4440 + * End:
4441 + */
4442 Index: head-2008-11-25/include/xen/interface/kexec.h
4443 ===================================================================
4444 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4445 +++ head-2008-11-25/include/xen/interface/kexec.h 2008-11-25 12:22:34.000000000 +0100
4446 @@ -0,0 +1,168 @@
4447 +/******************************************************************************
4448 + * kexec.h - Public portion
4449 + *
4450 + * Permission is hereby granted, free of charge, to any person obtaining a copy
4451 + * of this software and associated documentation files (the "Software"), to
4452 + * deal in the Software without restriction, including without limitation the
4453 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
4454 + * sell copies of the Software, and to permit persons to whom the Software is
4455 + * furnished to do so, subject to the following conditions:
4456 + *
4457 + * The above copyright notice and this permission notice shall be included in
4458 + * all copies or substantial portions of the Software.
4459 + *
4460 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4461 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4462 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4463 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4464 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4465 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
4466 + * DEALINGS IN THE SOFTWARE.
4467 + *
4468 + * Xen port written by:
4469 + * - Simon 'Horms' Horman <horms@verge.net.au>
4470 + * - Magnus Damm <magnus@valinux.co.jp>
4471 + */
4472 +
4473 +#ifndef _XEN_PUBLIC_KEXEC_H
4474 +#define _XEN_PUBLIC_KEXEC_H
4475 +
4476 +
4477 +/* This file describes the Kexec / Kdump hypercall interface for Xen.
4478 + *
4479 + * Kexec under vanilla Linux allows a user to reboot the physical machine
4480 + * into a new user-specified kernel. The Xen port extends this idea
4481 + * to allow rebooting of the machine from dom0. When kexec for dom0
4482 + * is used to reboot, both the hypervisor and the domains get replaced
4483 + * with some other kernel. It is possible to kexec between vanilla
4484 + * Linux and Xen and back again. Xen to Xen works well too.
4485 + *
4486 + * The hypercall interface for kexec can be divided into three main
4487 + * types of hypercall operations:
4488 + *
4489 + * 1) Range information:
4490 + * This is used by the dom0 kernel to ask the hypervisor about various
4491 + * address information. This information is needed to allow kexec-tools
4492 + * to fill in the ELF headers for /proc/vmcore properly.
4493 + *
4494 + * 2) Load and unload of images:
4495 + * There are no big surprises here, the kexec binary from kexec-tools
4496 + * runs in userspace in dom0. The tool loads/unloads data into the
4497 + * dom0 kernel such as new kernel, initramfs and hypervisor. When
4498 + * loaded the dom0 kernel performs a load hypercall operation, and
4499 + * before releasing all page references the dom0 kernel calls unload.
4500 + *
4501 + * 3) Kexec operation:
4502 + * This is used to start a previously loaded kernel.
4503 + */
4504 +
4505 +#include "xen.h"
4506 +
4507 +#if defined(__i386__) || defined(__x86_64__)
4508 +#define KEXEC_XEN_NO_PAGES 17
4509 +#endif
4510 +
4511 +/*
4512 + * Prototype for this hypercall is:
4513 + * int kexec_op(int cmd, void *args)
4514 + * @cmd == KEXEC_CMD_...
4515 + * KEXEC operation to perform
4516 + * @args == Operation-specific extra arguments (NULL if none).
4517 + */
4518 +
4519 +/*
4520 + * Kexec supports two types of operation:
4521 + * - kexec into a regular kernel, very similar to a standard reboot
4522 + * - KEXEC_TYPE_DEFAULT is used to specify this type
4523 + * - kexec into a special "crash kernel", aka kexec-on-panic
4524 + * - KEXEC_TYPE_CRASH is used to specify this type
4525 + * - parts of our system may be broken at kexec-on-panic time
4526 + * - the code should be kept as simple and self-contained as possible
4527 + */
4528 +
4529 +#define KEXEC_TYPE_DEFAULT 0
4530 +#define KEXEC_TYPE_CRASH 1
4531 +
4532 +
4533 +/* The kexec implementation for Xen allows the user to load two
4534 + * types of kernels, KEXEC_TYPE_DEFAULT and KEXEC_TYPE_CRASH.
4535 + * All data needed for a kexec reboot is kept in one xen_kexec_image_t
4536 + * per "instance". The data mainly consists of machine address lists to pages
4537 + * together with destination addresses. The data in xen_kexec_image_t
4538 + * is passed to the "code page" which is one page of code that performs
4539 + * the final relocations before jumping to the new kernel.
4540 + */
4541 +
4542 +typedef struct xen_kexec_image {
4543 +#if defined(__i386__) || defined(__x86_64__)
4544 + unsigned long page_list[KEXEC_XEN_NO_PAGES];
4545 +#endif
4546 +#if defined(__ia64__)
4547 + unsigned long reboot_code_buffer;
4548 +#endif
4549 + unsigned long indirection_page;
4550 + unsigned long start_address;
4551 +} xen_kexec_image_t;
4552 +
4553 +/*
4554 + * Perform kexec having previously loaded a kexec or kdump kernel
4555 + * as appropriate.
4556 + * type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in]
4557 + */
4558 +#define KEXEC_CMD_kexec 0
4559 +typedef struct xen_kexec_exec {
4560 + int type;
4561 +} xen_kexec_exec_t;
4562 +
4563 +/*
4564 + * Load/Unload kernel image for kexec or kdump.
4565 + * type == KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in]
4566 + * image == relocation information for kexec (ignored for unload) [in]
4567 + */
4568 +#define KEXEC_CMD_kexec_load 1
4569 +#define KEXEC_CMD_kexec_unload 2
4570 +typedef struct xen_kexec_load {
4571 + int type;
4572 + xen_kexec_image_t image;
4573 +} xen_kexec_load_t;
4574 +
4575 +#define KEXEC_RANGE_MA_CRASH 0 /* machine address and size of crash area */
4576 +#define KEXEC_RANGE_MA_XEN 1 /* machine address and size of Xen itself */
4577 +#define KEXEC_RANGE_MA_CPU 2 /* machine address and size of a CPU note */
4578 +#define KEXEC_RANGE_MA_XENHEAP 3 /* machine address and size of xenheap
4579 + * Note that although this is adjacent
4580 + * to Xen it exists in a separate EFI
4581 + * region on ia64, and thus needs to be
4582 + * inserted into iomem_machine separately */
4583 +#define KEXEC_RANGE_MA_BOOT_PARAM 4 /* machine address and size of
4584 + * the ia64_boot_param */
4585 +#define KEXEC_RANGE_MA_EFI_MEMMAP 5 /* machine address and size of
4586 + * of the EFI Memory Map */
4587 +#define KEXEC_RANGE_MA_VMCOREINFO 6 /* machine address and size of vmcoreinfo */
4588 +
4589 +/*
4590 + * Find the address and size of certain memory areas
4591 + * range == KEXEC_RANGE_... [in]
4592 + * nr == physical CPU number (starting from 0) if KEXEC_RANGE_MA_CPU [in]
4593 + * size == number of bytes reserved in window [out]
4594 + * start == address of the first byte in the window [out]
4595 + */
4596 +#define KEXEC_CMD_kexec_get_range 3
4597 +typedef struct xen_kexec_range {
4598 + int range;
4599 + int nr;
4600 + unsigned long size;
4601 + unsigned long start;
4602 +} xen_kexec_range_t;
4603 +
4604 +#endif /* _XEN_PUBLIC_KEXEC_H */
4605 +
4606 +/*
4607 + * Local variables:
4608 + * mode: C
4609 + * c-set-style: "BSD"
4610 + * c-basic-offset: 4
4611 + * tab-width: 4
4612 + * indent-tabs-mode: nil
4613 + * End:
4614 + */
4615 Index: head-2008-11-25/include/xen/interface/libelf.h
4616 ===================================================================
4617 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4618 +++ head-2008-11-25/include/xen/interface/libelf.h 2008-07-21 11:00:33.000000000 +0200
4619 @@ -0,0 +1,265 @@
4620 +/******************************************************************************
4621 + * libelf.h
4622 + *
4623 + * Permission is hereby granted, free of charge, to any person obtaining a copy
4624 + * of this software and associated documentation files (the "Software"), to
4625 + * deal in the Software without restriction, including without limitation the
4626 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
4627 + * sell copies of the Software, and to permit persons to whom the Software is
4628 + * furnished to do so, subject to the following conditions:
4629 + *
4630 + * The above copyright notice and this permission notice shall be included in
4631 + * all copies or substantial portions of the Software.
4632 + *
4633 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4634 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4635 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4636 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4637 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4638 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
4639 + * DEALINGS IN THE SOFTWARE.
4640 + */
4641 +
4642 +#ifndef __XC_LIBELF__
4643 +#define __XC_LIBELF__ 1
4644 +
4645 +#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__)
4646 +#define XEN_ELF_LITTLE_ENDIAN
4647 +#else
4648 +#error define architectural endianness
4649 +#endif
4650 +
4651 +#undef ELFSIZE
4652 +#include "elfnote.h"
4653 +#include "elfstructs.h"
4654 +#include "features.h"
4655 +
4656 +/* ------------------------------------------------------------------------ */
4657 +
4658 +typedef union {
4659 + Elf32_Ehdr e32;
4660 + Elf64_Ehdr e64;
4661 +} elf_ehdr;
4662 +
4663 +typedef union {
4664 + Elf32_Phdr e32;
4665 + Elf64_Phdr e64;
4666 +} elf_phdr;
4667 +
4668 +typedef union {
4669 + Elf32_Shdr e32;
4670 + Elf64_Shdr e64;
4671 +} elf_shdr;
4672 +
4673 +typedef union {
4674 + Elf32_Sym e32;
4675 + Elf64_Sym e64;
4676 +} elf_sym;
4677 +
4678 +typedef union {
4679 + Elf32_Rel e32;
4680 + Elf64_Rel e64;
4681 +} elf_rel;
4682 +
4683 +typedef union {
4684 + Elf32_Rela e32;
4685 + Elf64_Rela e64;
4686 +} elf_rela;
4687 +
4688 +typedef union {
4689 + Elf32_Note e32;
4690 + Elf64_Note e64;
4691 +} elf_note;
4692 +
4693 +struct elf_binary {
4694 + /* elf binary */
4695 + const char *image;
4696 + size_t size;
4697 + char class;
4698 + char data;
4699 +
4700 + const elf_ehdr *ehdr;
4701 + const char *sec_strtab;
4702 + const elf_shdr *sym_tab;
4703 + const char *sym_strtab;
4704 +
4705 + /* loaded to */
4706 + char *dest;
4707 + uint64_t pstart;
4708 + uint64_t pend;
4709 + uint64_t reloc_offset;
4710 +
4711 + uint64_t bsd_symtab_pstart;
4712 + uint64_t bsd_symtab_pend;
4713 +
4714 +#ifndef __XEN__
4715 + /* misc */
4716 + FILE *log;
4717 +#endif
4718 + int verbose;
4719 +};
4720 +
4721 +/* ------------------------------------------------------------------------ */
4722 +/* accessing elf header fields */
4723 +
4724 +#ifdef XEN_ELF_BIG_ENDIAN
4725 +# define NATIVE_ELFDATA ELFDATA2MSB
4726 +#else
4727 +# define NATIVE_ELFDATA ELFDATA2LSB
4728 +#endif
4729 +
4730 +#define elf_32bit(elf) (ELFCLASS32 == (elf)->class)
4731 +#define elf_64bit(elf) (ELFCLASS64 == (elf)->class)
4732 +#define elf_msb(elf) (ELFDATA2MSB == (elf)->data)
4733 +#define elf_lsb(elf) (ELFDATA2LSB == (elf)->data)
4734 +#define elf_swap(elf) (NATIVE_ELFDATA != (elf)->data)
4735 +
4736 +#define elf_uval(elf, str, elem) \
4737 + ((ELFCLASS64 == (elf)->class) \
4738 + ? elf_access_unsigned((elf), (str), \
4739 + offsetof(typeof(*(str)),e64.elem), \
4740 + sizeof((str)->e64.elem)) \
4741 + : elf_access_unsigned((elf), (str), \
4742 + offsetof(typeof(*(str)),e32.elem), \
4743 + sizeof((str)->e32.elem)))
4744 +
4745 +#define elf_sval(elf, str, elem) \
4746 + ((ELFCLASS64 == (elf)->class) \
4747 + ? elf_access_signed((elf), (str), \
4748 + offsetof(typeof(*(str)),e64.elem), \
4749 + sizeof((str)->e64.elem)) \
4750 + : elf_access_signed((elf), (str), \
4751 + offsetof(typeof(*(str)),e32.elem), \
4752 + sizeof((str)->e32.elem)))
4753 +
4754 +#define elf_size(elf, str) \
4755 + ((ELFCLASS64 == (elf)->class) \
4756 + ? sizeof((str)->e64) : sizeof((str)->e32))
4757 +
4758 +uint64_t elf_access_unsigned(struct elf_binary *elf, const void *ptr,
4759 + uint64_t offset, size_t size);
4760 +int64_t elf_access_signed(struct elf_binary *elf, const void *ptr,
4761 + uint64_t offset, size_t size);
4762 +
4763 +uint64_t elf_round_up(struct elf_binary *elf, uint64_t addr);
4764 +
4765 +/* ------------------------------------------------------------------------ */
4766 +/* xc_libelf_tools.c */
4767 +
4768 +int elf_shdr_count(struct elf_binary *elf);
4769 +int elf_phdr_count(struct elf_binary *elf);
4770 +
4771 +const elf_shdr *elf_shdr_by_name(struct elf_binary *elf, const char *name);
4772 +const elf_shdr *elf_shdr_by_index(struct elf_binary *elf, int index);
4773 +const elf_phdr *elf_phdr_by_index(struct elf_binary *elf, int index);
4774 +
4775 +const char *elf_section_name(struct elf_binary *elf, const elf_shdr * shdr);
4776 +const void *elf_section_start(struct elf_binary *elf, const elf_shdr * shdr);
4777 +const void *elf_section_end(struct elf_binary *elf, const elf_shdr * shdr);
4778 +
4779 +const void *elf_segment_start(struct elf_binary *elf, const elf_phdr * phdr);
4780 +const void *elf_segment_end(struct elf_binary *elf, const elf_phdr * phdr);
4781 +
4782 +const elf_sym *elf_sym_by_name(struct elf_binary *elf, const char *symbol);
4783 +const elf_sym *elf_sym_by_index(struct elf_binary *elf, int index);
4784 +
4785 +const char *elf_note_name(struct elf_binary *elf, const elf_note * note);
4786 +const void *elf_note_desc(struct elf_binary *elf, const elf_note * note);
4787 +uint64_t elf_note_numeric(struct elf_binary *elf, const elf_note * note);
4788 +const elf_note *elf_note_next(struct elf_binary *elf, const elf_note * note);
4789 +
4790 +int elf_is_elfbinary(const void *image);
4791 +int elf_phdr_is_loadable(struct elf_binary *elf, const elf_phdr * phdr);
4792 +
4793 +/* ------------------------------------------------------------------------ */
4794 +/* xc_libelf_loader.c */
4795 +
4796 +int elf_init(struct elf_binary *elf, const char *image, size_t size);
4797 +#ifdef __XEN__
4798 +void elf_set_verbose(struct elf_binary *elf);
4799 +#else
4800 +void elf_set_logfile(struct elf_binary *elf, FILE * log, int verbose);
4801 +#endif
4802 +
4803 +void elf_parse_binary(struct elf_binary *elf);
4804 +void elf_load_binary(struct elf_binary *elf);
4805 +
4806 +void *elf_get_ptr(struct elf_binary *elf, unsigned long addr);
4807 +uint64_t elf_lookup_addr(struct elf_binary *elf, const char *symbol);
4808 +
4809 +void elf_parse_bsdsyms(struct elf_binary *elf, uint64_t pstart); /* private */
4810 +
4811 +/* ------------------------------------------------------------------------ */
4812 +/* xc_libelf_relocate.c */
4813 +
4814 +int elf_reloc(struct elf_binary *elf);
4815 +
4816 +/* ------------------------------------------------------------------------ */
4817 +/* xc_libelf_dominfo.c */
4818 +
4819 +#define UNSET_ADDR ((uint64_t)-1)
4820 +
4821 +enum xen_elfnote_type {
4822 + XEN_ENT_NONE = 0,
4823 + XEN_ENT_LONG = 1,
4824 + XEN_ENT_STR = 2
4825 +};
4826 +
4827 +struct xen_elfnote {
4828 + enum xen_elfnote_type type;
4829 + const char *name;
4830 + union {
4831 + const char *str;
4832 + uint64_t num;
4833 + } data;
4834 +};
4835 +
4836 +struct elf_dom_parms {
4837 + /* raw */
4838 + const char *guest_info;
4839 + const void *elf_note_start;
4840 + const void *elf_note_end;
4841 + struct xen_elfnote elf_notes[XEN_ELFNOTE_MAX + 1];
4842 +
4843 + /* parsed */
4844 + char guest_os[16];
4845 + char guest_ver[16];
4846 + char xen_ver[16];
4847 + char loader[16];
4848 + int pae;
4849 + int bsd_symtab;
4850 + uint64_t virt_base;
4851 + uint64_t virt_entry;
4852 + uint64_t virt_hypercall;
4853 + uint64_t virt_hv_start_low;
4854 + uint64_t elf_paddr_offset;
4855 + uint32_t f_supported[XENFEAT_NR_SUBMAPS];
4856 + uint32_t f_required[XENFEAT_NR_SUBMAPS];
4857 +
4858 + /* calculated */
4859 + uint64_t virt_offset;
4860 + uint64_t virt_kstart;
4861 + uint64_t virt_kend;
4862 +};
4863 +
4864 +static inline void elf_xen_feature_set(int nr, uint32_t * addr)
4865 +{
4866 + addr[nr >> 5] |= 1 << (nr & 31);
4867 +}
4868 +static inline int elf_xen_feature_get(int nr, uint32_t * addr)
4869 +{
4870 + return !!(addr[nr >> 5] & (1 << (nr & 31)));
4871 +}
4872 +
4873 +int elf_xen_parse_features(const char *features,
4874 + uint32_t *supported,
4875 + uint32_t *required);
4876 +int elf_xen_parse_note(struct elf_binary *elf,
4877 + struct elf_dom_parms *parms,
4878 + const elf_note *note);
4879 +int elf_xen_parse_guest_info(struct elf_binary *elf,
4880 + struct elf_dom_parms *parms);
4881 +int elf_xen_parse(struct elf_binary *elf,
4882 + struct elf_dom_parms *parms);
4883 +
4884 +#endif /* __XC_LIBELF__ */
4885 Index: head-2008-11-25/include/xen/interface/nmi.h
4886 ===================================================================
4887 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4888 +++ head-2008-11-25/include/xen/interface/nmi.h 2007-06-12 13:14:19.000000000 +0200
4889 @@ -0,0 +1,78 @@
4890 +/******************************************************************************
4891 + * nmi.h
4892 + *
4893 + * NMI callback registration and reason codes.
4894 + *
4895 + * Permission is hereby granted, free of charge, to any person obtaining a copy
4896 + * of this software and associated documentation files (the "Software"), to
4897 + * deal in the Software without restriction, including without limitation the
4898 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
4899 + * sell copies of the Software, and to permit persons to whom the Software is
4900 + * furnished to do so, subject to the following conditions:
4901 + *
4902 + * The above copyright notice and this permission notice shall be included in
4903 + * all copies or substantial portions of the Software.
4904 + *
4905 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4906 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4907 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4908 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4909 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4910 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
4911 + * DEALINGS IN THE SOFTWARE.
4912 + *
4913 + * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
4914 + */
4915 +
4916 +#ifndef __XEN_PUBLIC_NMI_H__
4917 +#define __XEN_PUBLIC_NMI_H__
4918 +
4919 +/*
4920 + * NMI reason codes:
4921 + * Currently these are x86-specific, stored in arch_shared_info.nmi_reason.
4922 + */
4923 + /* I/O-check error reported via ISA port 0x61, bit 6. */
4924 +#define _XEN_NMIREASON_io_error 0
4925 +#define XEN_NMIREASON_io_error (1UL << _XEN_NMIREASON_io_error)
4926 + /* Parity error reported via ISA port 0x61, bit 7. */
4927 +#define _XEN_NMIREASON_parity_error 1
4928 +#define XEN_NMIREASON_parity_error (1UL << _XEN_NMIREASON_parity_error)
4929 + /* Unknown hardware-generated NMI. */
4930 +#define _XEN_NMIREASON_unknown 2
4931 +#define XEN_NMIREASON_unknown (1UL << _XEN_NMIREASON_unknown)
4932 +
4933 +/*
4934 + * long nmi_op(unsigned int cmd, void *arg)
4935 + * NB. All ops return zero on success, else a negative error code.
4936 + */
4937 +
4938 +/*
4939 + * Register NMI callback for this (calling) VCPU. Currently this only makes
4940 + * sense for domain 0, vcpu 0. All other callers will be returned EINVAL.
4941 + * arg == pointer to xennmi_callback structure.
4942 + */
4943 +#define XENNMI_register_callback 0
4944 +struct xennmi_callback {
4945 + unsigned long handler_address;
4946 + unsigned long pad;
4947 +};
4948 +typedef struct xennmi_callback xennmi_callback_t;
4949 +DEFINE_XEN_GUEST_HANDLE(xennmi_callback_t);
4950 +
4951 +/*
4952 + * Deregister NMI callback for this (calling) VCPU.
4953 + * arg == NULL.
4954 + */
4955 +#define XENNMI_unregister_callback 1
4956 +
4957 +#endif /* __XEN_PUBLIC_NMI_H__ */
4958 +
4959 +/*
4960 + * Local variables:
4961 + * mode: C
4962 + * c-set-style: "BSD"
4963 + * c-basic-offset: 4
4964 + * tab-width: 4
4965 + * indent-tabs-mode: nil
4966 + * End:
4967 + */
4968 Index: head-2008-11-25/include/xen/interface/platform.h
4969 ===================================================================
4970 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4971 +++ head-2008-11-25/include/xen/interface/platform.h 2008-09-25 13:55:33.000000000 +0200
4972 @@ -0,0 +1,346 @@
4973 +/******************************************************************************
4974 + * platform.h
4975 + *
4976 + * Hardware platform operations. Intended for use by domain-0 kernel.
4977 + *
4978 + * Permission is hereby granted, free of charge, to any person obtaining a copy
4979 + * of this software and associated documentation files (the "Software"), to
4980 + * deal in the Software without restriction, including without limitation the
4981 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
4982 + * sell copies of the Software, and to permit persons to whom the Software is
4983 + * furnished to do so, subject to the following conditions:
4984 + *
4985 + * The above copyright notice and this permission notice shall be included in
4986 + * all copies or substantial portions of the Software.
4987 + *
4988 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4989 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4990 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4991 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4992 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4993 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
4994 + * DEALINGS IN THE SOFTWARE.
4995 + *
4996 + * Copyright (c) 2002-2006, K Fraser
4997 + */
4998 +
4999 +#ifndef __XEN_PUBLIC_PLATFORM_H__
5000 +#define __XEN_PUBLIC_PLATFORM_H__
5001 +
5002 +#include "xen.h"
5003 +
5004 +#define XENPF_INTERFACE_VERSION 0x03000001
5005 +
5006 +/*
5007 + * Set clock such that it would read <secs,nsecs> after 00:00:00 UTC,
5008 + * 1 January, 1970 if the current system time was <system_time>.
5009 + */
5010 +#define XENPF_settime 17
5011 +struct xenpf_settime {
5012 + /* IN variables. */
5013 + uint32_t secs;
5014 + uint32_t nsecs;
5015 + uint64_t system_time;
5016 +};
5017 +typedef struct xenpf_settime xenpf_settime_t;
5018 +DEFINE_XEN_GUEST_HANDLE(xenpf_settime_t);
5019 +
5020 +/*
5021 + * Request memory range (@mfn, @mfn+@nr_mfns-1) to have type @type.
5022 + * On x86, @type is an architecture-defined MTRR memory type.
5023 + * On success, returns the MTRR that was used (@reg) and a handle that can
5024 + * be passed to XENPF_DEL_MEMTYPE to accurately tear down the new setting.
5025 + * (x86-specific).
5026 + */
5027 +#define XENPF_add_memtype 31
5028 +struct xenpf_add_memtype {
5029 + /* IN variables. */
5030 + xen_pfn_t mfn;
5031 + uint64_t nr_mfns;
5032 + uint32_t type;
5033 + /* OUT variables. */
5034 + uint32_t handle;
5035 + uint32_t reg;
5036 +};
5037 +typedef struct xenpf_add_memtype xenpf_add_memtype_t;
5038 +DEFINE_XEN_GUEST_HANDLE(xenpf_add_memtype_t);
5039 +
5040 +/*
5041 + * Tear down an existing memory-range type. If @handle is remembered then it
5042 + * should be passed in to accurately tear down the correct setting (in case
5043 + * of overlapping memory regions with differing types). If it is not known
5044 + * then @handle should be set to zero. In all cases @reg must be set.
5045 + * (x86-specific).
5046 + */
5047 +#define XENPF_del_memtype 32
5048 +struct xenpf_del_memtype {
5049 + /* IN variables. */
5050 + uint32_t handle;
5051 + uint32_t reg;
5052 +};
5053 +typedef struct xenpf_del_memtype xenpf_del_memtype_t;
5054 +DEFINE_XEN_GUEST_HANDLE(xenpf_del_memtype_t);
5055 +
5056 +/* Read current type of an MTRR (x86-specific). */
5057 +#define XENPF_read_memtype 33
5058 +struct xenpf_read_memtype {
5059 + /* IN variables. */
5060 + uint32_t reg;
5061 + /* OUT variables. */
5062 + xen_pfn_t mfn;
5063 + uint64_t nr_mfns;
5064 + uint32_t type;
5065 +};
5066 +typedef struct xenpf_read_memtype xenpf_read_memtype_t;
5067 +DEFINE_XEN_GUEST_HANDLE(xenpf_read_memtype_t);
5068 +
5069 +#define XENPF_microcode_update 35
5070 +struct xenpf_microcode_update {
5071 + /* IN variables. */
5072 + XEN_GUEST_HANDLE(const_void) data;/* Pointer to microcode data */
5073 + uint32_t length; /* Length of microcode data. */
5074 +};
5075 +typedef struct xenpf_microcode_update xenpf_microcode_update_t;
5076 +DEFINE_XEN_GUEST_HANDLE(xenpf_microcode_update_t);
5077 +
5078 +#define XENPF_platform_quirk 39
5079 +#define QUIRK_NOIRQBALANCING 1 /* Do not restrict IO-APIC RTE targets */
5080 +#define QUIRK_IOAPIC_BAD_REGSEL 2 /* IO-APIC REGSEL forgets its value */
5081 +#define QUIRK_IOAPIC_GOOD_REGSEL 3 /* IO-APIC REGSEL behaves properly */
5082 +struct xenpf_platform_quirk {
5083 + /* IN variables. */
5084 + uint32_t quirk_id;
5085 +};
5086 +typedef struct xenpf_platform_quirk xenpf_platform_quirk_t;
5087 +DEFINE_XEN_GUEST_HANDLE(xenpf_platform_quirk_t);
5088 +
5089 +#define XENPF_firmware_info 50
5090 +#define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */
5091 +#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */
5092 +#define XEN_FW_VBEDDC_INFO 3 /* from int 10 AX=4f15 */
5093 +struct xenpf_firmware_info {
5094 + /* IN variables. */
5095 + uint32_t type;
5096 + uint32_t index;
5097 + /* OUT variables. */
5098 + union {
5099 + struct {
5100 + /* Int13, Fn48: Check Extensions Present. */
5101 + uint8_t device; /* %dl: bios device number */
5102 + uint8_t version; /* %ah: major version */
5103 + uint16_t interface_support; /* %cx: support bitmap */
5104 + /* Int13, Fn08: Legacy Get Device Parameters. */
5105 + uint16_t legacy_max_cylinder; /* %cl[7:6]:%ch: max cyl # */
5106 + uint8_t legacy_max_head; /* %dh: max head # */
5107 + uint8_t legacy_sectors_per_track; /* %cl[5:0]: max sector # */
5108 + /* Int13, Fn41: Get Device Parameters (as filled into %ds:%esi). */
5109 + /* NB. First uint16_t of buffer must be set to buffer size. */
5110 + XEN_GUEST_HANDLE(void) edd_params;
5111 + } disk_info; /* XEN_FW_DISK_INFO */
5112 + struct {
5113 + uint8_t device; /* bios device number */
5114 + uint32_t mbr_signature; /* offset 0x1b8 in mbr */
5115 + } disk_mbr_signature; /* XEN_FW_DISK_MBR_SIGNATURE */
5116 + struct {
5117 + /* Int10, AX=4F15: Get EDID info. */
5118 + uint8_t capabilities;
5119 + uint8_t edid_transfer_time;
5120 + /* must refer to 128-byte buffer */
5121 + XEN_GUEST_HANDLE(uint8) edid;
5122 + } vbeddc_info; /* XEN_FW_VBEDDC_INFO */
5123 + } u;
5124 +};
5125 +typedef struct xenpf_firmware_info xenpf_firmware_info_t;
5126 +DEFINE_XEN_GUEST_HANDLE(xenpf_firmware_info_t);
5127 +
5128 +#define XENPF_enter_acpi_sleep 51
5129 +struct xenpf_enter_acpi_sleep {
5130 + /* IN variables */
5131 + uint16_t pm1a_cnt_val; /* PM1a control value. */
5132 + uint16_t pm1b_cnt_val; /* PM1b control value. */
5133 + uint32_t sleep_state; /* Which state to enter (Sn). */
5134 + uint32_t flags; /* Must be zero. */
5135 +};
5136 +typedef struct xenpf_enter_acpi_sleep xenpf_enter_acpi_sleep_t;
5137 +DEFINE_XEN_GUEST_HANDLE(xenpf_enter_acpi_sleep_t);
5138 +
5139 +#define XENPF_change_freq 52
5140 +struct xenpf_change_freq {
5141 + /* IN variables */
5142 + uint32_t flags; /* Must be zero. */
5143 + uint32_t cpu; /* Physical cpu. */
5144 + uint64_t freq; /* New frequency (Hz). */
5145 +};
5146 +typedef struct xenpf_change_freq xenpf_change_freq_t;
5147 +DEFINE_XEN_GUEST_HANDLE(xenpf_change_freq_t);
5148 +
5149 +/*
5150 + * Get idle times (nanoseconds since boot) for physical CPUs specified in the
5151 + * @cpumap_bitmap with range [0..@cpumap_nr_cpus-1]. The @idletime array is
5152 + * indexed by CPU number; only entries with the corresponding @cpumap_bitmap
5153 + * bit set are written to. On return, @cpumap_bitmap is modified so that any
5154 + * non-existent CPUs are cleared. Such CPUs have their @idletime array entry
5155 + * cleared.
5156 + */
5157 +#define XENPF_getidletime 53
5158 +struct xenpf_getidletime {
5159 + /* IN/OUT variables */
5160 + /* IN: CPUs to interrogate; OUT: subset of IN which are present */
5161 + XEN_GUEST_HANDLE(uint8) cpumap_bitmap;
5162 + /* IN variables */
5163 + /* Size of cpumap bitmap. */
5164 + uint32_t cpumap_nr_cpus;
5165 + /* Must be indexable for every cpu in cpumap_bitmap. */
5166 + XEN_GUEST_HANDLE(uint64) idletime;
5167 + /* OUT variables */
5168 + /* System time when the idletime snapshots were taken. */
5169 + uint64_t now;
5170 +};
5171 +typedef struct xenpf_getidletime xenpf_getidletime_t;
5172 +DEFINE_XEN_GUEST_HANDLE(xenpf_getidletime_t);
5173 +
5174 +#define XENPF_set_processor_pminfo 54
5175 +
5176 +/* ability bits */
5177 +#define XEN_PROCESSOR_PM_CX 1
5178 +#define XEN_PROCESSOR_PM_PX 2
5179 +#define XEN_PROCESSOR_PM_TX 4
5180 +
5181 +/* cmd type */
5182 +#define XEN_PM_CX 0
5183 +#define XEN_PM_PX 1
5184 +#define XEN_PM_TX 2
5185 +
5186 +/* Px sub info type */
5187 +#define XEN_PX_PCT 1
5188 +#define XEN_PX_PSS 2
5189 +#define XEN_PX_PPC 4
5190 +#define XEN_PX_PSD 8
5191 +
5192 +struct xen_power_register {
5193 + uint32_t space_id;
5194 + uint32_t bit_width;
5195 + uint32_t bit_offset;
5196 + uint32_t access_size;
5197 + uint64_t address;
5198 +};
5199 +
5200 +struct xen_processor_csd {
5201 + uint32_t domain; /* domain number of one dependent group */
5202 + uint32_t coord_type; /* coordination type */
5203 + uint32_t num; /* number of processors in same domain */
5204 +};
5205 +typedef struct xen_processor_csd xen_processor_csd_t;
5206 +DEFINE_XEN_GUEST_HANDLE(xen_processor_csd_t);
5207 +
5208 +struct xen_processor_cx {
5209 + struct xen_power_register reg; /* GAS for Cx trigger register */
5210 + uint8_t type; /* cstate value, c0: 0, c1: 1, ... */
5211 + uint32_t latency; /* worst latency (ms) to enter/exit this cstate */
5212 + uint32_t power; /* average power consumption(mW) */
5213 + uint32_t dpcnt; /* number of dependency entries */
5214 + XEN_GUEST_HANDLE(xen_processor_csd_t) dp; /* NULL if no dependency */
5215 +};
5216 +typedef struct xen_processor_cx xen_processor_cx_t;
5217 +DEFINE_XEN_GUEST_HANDLE(xen_processor_cx_t);
5218 +
5219 +struct xen_processor_flags {
5220 + uint32_t bm_control:1;
5221 + uint32_t bm_check:1;
5222 + uint32_t has_cst:1;
5223 + uint32_t power_setup_done:1;
5224 + uint32_t bm_rld_set:1;
5225 +};
5226 +
5227 +struct xen_processor_power {
5228 + uint32_t count; /* number of C state entries in array below */
5229 + struct xen_processor_flags flags; /* global flags of this processor */
5230 + XEN_GUEST_HANDLE(xen_processor_cx_t) states; /* supported c states */
5231 +};
5232 +
5233 +struct xen_pct_register {
5234 + uint8_t descriptor;
5235 + uint16_t length;
5236 + uint8_t space_id;
5237 + uint8_t bit_width;
5238 + uint8_t bit_offset;
5239 + uint8_t reserved;
5240 + uint64_t address;
5241 +};
5242 +
5243 +struct xen_processor_px {
5244 + uint64_t core_frequency; /* megahertz */
5245 + uint64_t power; /* milliWatts */
5246 + uint64_t transition_latency; /* microseconds */
5247 + uint64_t bus_master_latency; /* microseconds */
5248 + uint64_t control; /* control value */
5249 + uint64_t status; /* success indicator */
5250 +};
5251 +typedef struct xen_processor_px xen_processor_px_t;
5252 +DEFINE_XEN_GUEST_HANDLE(xen_processor_px_t);
5253 +
5254 +struct xen_psd_package {
5255 + uint64_t num_entries;
5256 + uint64_t revision;
5257 + uint64_t domain;
5258 + uint64_t coord_type;
5259 + uint64_t num_processors;
5260 +};
5261 +
5262 +struct xen_processor_performance {
5263 + uint32_t flags; /* flag for Px sub info type */
5264 + uint32_t platform_limit; /* Platform limitation on freq usage */
5265 + struct xen_pct_register control_register;
5266 + struct xen_pct_register status_register;
5267 + uint32_t state_count; /* total available performance states */
5268 + XEN_GUEST_HANDLE(xen_processor_px_t) states;
5269 + struct xen_psd_package domain_info;
5270 + uint32_t shared_type; /* coordination type of this processor */
5271 +};
5272 +typedef struct xen_processor_performance xen_processor_performance_t;
5273 +DEFINE_XEN_GUEST_HANDLE(xen_processor_performance_t);
5274 +
5275 +struct xenpf_set_processor_pminfo {
5276 + /* IN variables */
5277 + uint32_t id; /* ACPI CPU ID */
5278 + uint32_t type; /* {XEN_PM_CX, XEN_PM_PX} */
5279 + union {
5280 + struct xen_processor_power power;/* Cx: _CST/_CSD */
5281 + struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */
5282 + };
5283 +};
5284 +typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t;
5285 +DEFINE_XEN_GUEST_HANDLE(xenpf_set_processor_pminfo_t);
5286 +
5287 +struct xen_platform_op {
5288 + uint32_t cmd;
5289 + uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
5290 + union {
5291 + struct xenpf_settime settime;
5292 + struct xenpf_add_memtype add_memtype;
5293 + struct xenpf_del_memtype del_memtype;
5294 + struct xenpf_read_memtype read_memtype;
5295 + struct xenpf_microcode_update microcode;
5296 + struct xenpf_platform_quirk platform_quirk;
5297 + struct xenpf_firmware_info firmware_info;
5298 + struct xenpf_enter_acpi_sleep enter_acpi_sleep;
5299 + struct xenpf_change_freq change_freq;
5300 + struct xenpf_getidletime getidletime;
5301 + struct xenpf_set_processor_pminfo set_pminfo;
5302 + uint8_t pad[128];
5303 + } u;
5304 +};
5305 +typedef struct xen_platform_op xen_platform_op_t;
5306 +DEFINE_XEN_GUEST_HANDLE(xen_platform_op_t);
5307 +
5308 +#endif /* __XEN_PUBLIC_PLATFORM_H__ */
5309 +
5310 +/*
5311 + * Local variables:
5312 + * mode: C
5313 + * c-set-style: "BSD"
5314 + * c-basic-offset: 4
5315 + * tab-width: 4
5316 + * indent-tabs-mode: nil
5317 + * End:
5318 + */
5319 Index: head-2008-11-25/include/xen/interface/sysctl.h
5320 ===================================================================
5321 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
5322 +++ head-2008-11-25/include/xen/interface/sysctl.h 2008-09-25 13:55:33.000000000 +0200
5323 @@ -0,0 +1,308 @@
5324 +/******************************************************************************
5325 + * sysctl.h
5326 + *
5327 + * System management operations. For use by node control stack.
5328 + *
5329 + * Permission is hereby granted, free of charge, to any person obtaining a copy
5330 + * of this software and associated documentation files (the "Software"), to
5331 + * deal in the Software without restriction, including without limitation the
5332 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
5333 + * sell copies of the Software, and to permit persons to whom the Software is
5334 + * furnished to do so, subject to the following conditions:
5335 + *
5336 + * The above copyright notice and this permission notice shall be included in
5337 + * all copies or substantial portions of the Software.
5338 + *
5339 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5340 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5341 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5342 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5343 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
5344 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
5345 + * DEALINGS IN THE SOFTWARE.
5346 + *
5347 + * Copyright (c) 2002-2006, K Fraser
5348 + */
5349 +
5350 +#ifndef __XEN_PUBLIC_SYSCTL_H__
5351 +#define __XEN_PUBLIC_SYSCTL_H__
5352 +
5353 +#if !defined(__XEN__) && !defined(__XEN_TOOLS__)
5354 +#error "sysctl operations are intended for use by node control tools only"
5355 +#endif
5356 +
5357 +#include "xen.h"
5358 +#include "domctl.h"
5359 +
5360 +#define XEN_SYSCTL_INTERFACE_VERSION 0x00000006
5361 +
5362 +/*
5363 + * Read console content from Xen buffer ring.
5364 + */
5365 +#define XEN_SYSCTL_readconsole 1
5366 +struct xen_sysctl_readconsole {
5367 + /* IN: Non-zero -> clear after reading. */
5368 + uint8_t clear;
5369 + /* IN: Non-zero -> start index specified by @index field. */
5370 + uint8_t incremental;
5371 + uint8_t pad0, pad1;
5372 + /*
5373 + * IN: Start index for consuming from ring buffer (if @incremental);
5374 + * OUT: End index after consuming from ring buffer.
5375 + */
5376 + uint32_t index;
5377 + /* IN: Virtual address to write console data. */
5378 + XEN_GUEST_HANDLE_64(char) buffer;
5379 + /* IN: Size of buffer; OUT: Bytes written to buffer. */
5380 + uint32_t count;
5381 +};
5382 +typedef struct xen_sysctl_readconsole xen_sysctl_readconsole_t;
5383 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_readconsole_t);
5384 +
5385 +/* Get trace buffers machine base address */
5386 +#define XEN_SYSCTL_tbuf_op 2
5387 +struct xen_sysctl_tbuf_op {
5388 + /* IN variables */
5389 +#define XEN_SYSCTL_TBUFOP_get_info 0
5390 +#define XEN_SYSCTL_TBUFOP_set_cpu_mask 1
5391 +#define XEN_SYSCTL_TBUFOP_set_evt_mask 2
5392 +#define XEN_SYSCTL_TBUFOP_set_size 3
5393 +#define XEN_SYSCTL_TBUFOP_enable 4
5394 +#define XEN_SYSCTL_TBUFOP_disable 5
5395 + uint32_t cmd;
5396 + /* IN/OUT variables */
5397 + struct xenctl_cpumap cpu_mask;
5398 + uint32_t evt_mask;
5399 + /* OUT variables */
5400 + uint64_aligned_t buffer_mfn;
5401 + uint32_t size;
5402 +};
5403 +typedef struct xen_sysctl_tbuf_op xen_sysctl_tbuf_op_t;
5404 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t);
5405 +
5406 +/*
5407 + * Get physical information about the host machine
5408 + */
5409 +#define XEN_SYSCTL_physinfo 3
5410 + /* (x86) The platform supports HVM guests. */
5411 +#define _XEN_SYSCTL_PHYSCAP_hvm 0
5412 +#define XEN_SYSCTL_PHYSCAP_hvm (1u<<_XEN_SYSCTL_PHYSCAP_hvm)
5413 + /* (x86) The platform supports HVM-guest direct access to I/O devices. */
5414 +#define _XEN_SYSCTL_PHYSCAP_hvm_directio 1
5415 +#define XEN_SYSCTL_PHYSCAP_hvm_directio (1u<<_XEN_SYSCTL_PHYSCAP_hvm_directio)
5416 +struct xen_sysctl_physinfo {
5417 + uint32_t threads_per_core;
5418 + uint32_t cores_per_socket;
5419 + uint32_t nr_cpus;
5420 + uint32_t nr_nodes;
5421 + uint32_t cpu_khz;
5422 + uint64_aligned_t total_pages;
5423 + uint64_aligned_t free_pages;
5424 + uint64_aligned_t scrub_pages;
5425 + uint32_t hw_cap[8];
5426 +
5427 + /*
5428 + * IN: maximum addressable entry in the caller-provided cpu_to_node array.
5429 + * OUT: largest cpu identifier in the system.
5430 + * If OUT is greater than IN then the cpu_to_node array is truncated!
5431 + */
5432 + uint32_t max_cpu_id;
5433 + /*
5434 + * If not NULL, this array is filled with node identifier for each cpu.
5435 + * If a cpu has no node information (e.g., cpu not present) then the
5436 + * sentinel value ~0u is written.
5437 + * The size of this array is specified by the caller in @max_cpu_id.
5438 + * If the actual @max_cpu_id is smaller than the array then the trailing
5439 + * elements of the array will not be written by the sysctl.
5440 + */
5441 + XEN_GUEST_HANDLE_64(uint32) cpu_to_node;
5442 +
5443 + /* XEN_SYSCTL_PHYSCAP_??? */
5444 + uint32_t capabilities;
5445 +};
5446 +typedef struct xen_sysctl_physinfo xen_sysctl_physinfo_t;
5447 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_physinfo_t);
5448 +
5449 +/*
5450 + * Get the ID of the current scheduler.
5451 + */
5452 +#define XEN_SYSCTL_sched_id 4
5453 +struct xen_sysctl_sched_id {
5454 + /* OUT variable */
5455 + uint32_t sched_id;
5456 +};
5457 +typedef struct xen_sysctl_sched_id xen_sysctl_sched_id_t;
5458 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_sched_id_t);
5459 +
5460 +/* Interface for controlling Xen software performance counters. */
5461 +#define XEN_SYSCTL_perfc_op 5
5462 +/* Sub-operations: */
5463 +#define XEN_SYSCTL_PERFCOP_reset 1 /* Reset all counters to zero. */
5464 +#define XEN_SYSCTL_PERFCOP_query 2 /* Get perfctr information. */
5465 +struct xen_sysctl_perfc_desc {
5466 + char name[80]; /* name of perf counter */
5467 + uint32_t nr_vals; /* number of values for this counter */
5468 +};
5469 +typedef struct xen_sysctl_perfc_desc xen_sysctl_perfc_desc_t;
5470 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t);
5471 +typedef uint32_t xen_sysctl_perfc_val_t;
5472 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_val_t);
5473 +
5474 +struct xen_sysctl_perfc_op {
5475 + /* IN variables. */
5476 + uint32_t cmd; /* XEN_SYSCTL_PERFCOP_??? */
5477 + /* OUT variables. */
5478 + uint32_t nr_counters; /* number of counters description */
5479 + uint32_t nr_vals; /* number of values */
5480 + /* counter information (or NULL) */
5481 + XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc;
5482 + /* counter values (or NULL) */
5483 + XEN_GUEST_HANDLE_64(xen_sysctl_perfc_val_t) val;
5484 +};
5485 +typedef struct xen_sysctl_perfc_op xen_sysctl_perfc_op_t;
5486 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_op_t);
5487 +
5488 +#define XEN_SYSCTL_getdomaininfolist 6
5489 +struct xen_sysctl_getdomaininfolist {
5490 + /* IN variables. */
5491 + domid_t first_domain;
5492 + uint32_t max_domains;
5493 + XEN_GUEST_HANDLE_64(xen_domctl_getdomaininfo_t) buffer;
5494 + /* OUT variables. */
5495 + uint32_t num_domains;
5496 +};
5497 +typedef struct xen_sysctl_getdomaininfolist xen_sysctl_getdomaininfolist_t;
5498 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getdomaininfolist_t);
5499 +
5500 +/* Inject debug keys into Xen. */
5501 +#define XEN_SYSCTL_debug_keys 7
5502 +struct xen_sysctl_debug_keys {
5503 + /* IN variables. */
5504 + XEN_GUEST_HANDLE_64(char) keys;
5505 + uint32_t nr_keys;
5506 +};
5507 +typedef struct xen_sysctl_debug_keys xen_sysctl_debug_keys_t;
5508 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_debug_keys_t);
5509 +
5510 +/* Get physical CPU information. */
5511 +#define XEN_SYSCTL_getcpuinfo 8
5512 +struct xen_sysctl_cpuinfo {
5513 + uint64_aligned_t idletime;
5514 +};
5515 +typedef struct xen_sysctl_cpuinfo xen_sysctl_cpuinfo_t;
5516 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpuinfo_t);
5517 +struct xen_sysctl_getcpuinfo {
5518 + /* IN variables. */
5519 + uint32_t max_cpus;
5520 + XEN_GUEST_HANDLE_64(xen_sysctl_cpuinfo_t) info;
5521 + /* OUT variables. */
5522 + uint32_t nr_cpus;
5523 +};
5524 +typedef struct xen_sysctl_getcpuinfo xen_sysctl_getcpuinfo_t;
5525 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getcpuinfo_t);
5526 +
5527 +#define XEN_SYSCTL_availheap 9
5528 +struct xen_sysctl_availheap {
5529 + /* IN variables. */
5530 + uint32_t min_bitwidth; /* Smallest address width (zero if don't care). */
5531 + uint32_t max_bitwidth; /* Largest address width (zero if don't care). */
5532 + int32_t node; /* NUMA node of interest (-1 for all nodes). */
5533 + /* OUT variables. */
5534 + uint64_aligned_t avail_bytes;/* Bytes available in the specified region. */
5535 +};
5536 +typedef struct xen_sysctl_availheap xen_sysctl_availheap_t;
5537 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_availheap_t);
5538 +
5539 +#define XEN_SYSCTL_get_pmstat 10
5540 +struct pm_px_val {
5541 + uint64_aligned_t freq; /* Px core frequency */
5542 + uint64_aligned_t residency; /* Px residency time */
5543 + uint64_aligned_t count; /* Px transition count */
5544 +};
5545 +typedef struct pm_px_val pm_px_val_t;
5546 +DEFINE_XEN_GUEST_HANDLE(pm_px_val_t);
5547 +
5548 +struct pm_px_stat {
5549 + uint8_t total; /* total Px states */
5550 + uint8_t usable; /* usable Px states */
5551 + uint8_t last; /* last Px state */
5552 + uint8_t cur; /* current Px state */
5553 + XEN_GUEST_HANDLE_64(uint64) trans_pt; /* Px transition table */
5554 + XEN_GUEST_HANDLE_64(pm_px_val_t) pt;
5555 +};
5556 +typedef struct pm_px_stat pm_px_stat_t;
5557 +DEFINE_XEN_GUEST_HANDLE(pm_px_stat_t);
5558 +
5559 +struct pm_cx_stat {
5560 + uint32_t nr; /* entry nr in triggers & residencies, including C0 */
5561 + uint32_t last; /* last Cx state */
5562 + uint64_aligned_t idle_time; /* idle time from boot */
5563 + XEN_GUEST_HANDLE_64(uint64) triggers; /* Cx trigger counts */
5564 + XEN_GUEST_HANDLE_64(uint64) residencies; /* Cx residencies */
5565 +};
5566 +
5567 +struct xen_sysctl_get_pmstat {
5568 +#define PMSTAT_CATEGORY_MASK 0xf0
5569 +#define PMSTAT_PX 0x10
5570 +#define PMSTAT_CX 0x20
5571 +#define PMSTAT_get_max_px (PMSTAT_PX | 0x1)
5572 +#define PMSTAT_get_pxstat (PMSTAT_PX | 0x2)
5573 +#define PMSTAT_reset_pxstat (PMSTAT_PX | 0x3)
5574 +#define PMSTAT_get_max_cx (PMSTAT_CX | 0x1)
5575 +#define PMSTAT_get_cxstat (PMSTAT_CX | 0x2)
5576 +#define PMSTAT_reset_cxstat (PMSTAT_CX | 0x3)
5577 + uint32_t type;
5578 + uint32_t cpuid;
5579 + union {
5580 + struct pm_px_stat getpx;
5581 + struct pm_cx_stat getcx;
5582 + /* other struct for tx, etc */
5583 + } u;
5584 +};
5585 +typedef struct xen_sysctl_get_pmstat xen_sysctl_get_pmstat_t;
5586 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_get_pmstat_t);
5587 +
5588 +#define XEN_SYSCTL_cpu_hotplug 11
5589 +struct xen_sysctl_cpu_hotplug {
5590 + /* IN variables */
5591 + uint32_t cpu; /* Physical cpu. */
5592 +#define XEN_SYSCTL_CPU_HOTPLUG_ONLINE 0
5593 +#define XEN_SYSCTL_CPU_HOTPLUG_OFFLINE 1
5594 + uint32_t op; /* hotplug opcode */
5595 +};
5596 +typedef struct xen_sysctl_cpu_hotplug xen_sysctl_cpu_hotplug_t;
5597 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpu_hotplug_t);
5598 +
5599 +
5600 +struct xen_sysctl {
5601 + uint32_t cmd;
5602 + uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
5603 + union {
5604 + struct xen_sysctl_readconsole readconsole;
5605 + struct xen_sysctl_tbuf_op tbuf_op;
5606 + struct xen_sysctl_physinfo physinfo;
5607 + struct xen_sysctl_sched_id sched_id;
5608 + struct xen_sysctl_perfc_op perfc_op;
5609 + struct xen_sysctl_getdomaininfolist getdomaininfolist;
5610 + struct xen_sysctl_debug_keys debug_keys;
5611 + struct xen_sysctl_getcpuinfo getcpuinfo;
5612 + struct xen_sysctl_availheap availheap;
5613 + struct xen_sysctl_get_pmstat get_pmstat;
5614 + struct xen_sysctl_cpu_hotplug cpu_hotplug;
5615 + uint8_t pad[128];
5616 + } u;
5617 +};
5618 +typedef struct xen_sysctl xen_sysctl_t;
5619 +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_t);
5620 +
5621 +#endif /* __XEN_PUBLIC_SYSCTL_H__ */
5622 +
5623 +/*
5624 + * Local variables:
5625 + * mode: C
5626 + * c-set-style: "BSD"
5627 + * c-basic-offset: 4
5628 + * tab-width: 4
5629 + * indent-tabs-mode: nil
5630 + * End:
5631 + */
5632 Index: head-2008-11-25/include/xen/interface/trace.h
5633 ===================================================================
5634 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
5635 +++ head-2008-11-25/include/xen/interface/trace.h 2008-11-25 12:22:34.000000000 +0100
5636 @@ -0,0 +1,205 @@
5637 +/******************************************************************************
5638 + * include/public/trace.h
5639 + *
5640 + * Permission is hereby granted, free of charge, to any person obtaining a copy
5641 + * of this software and associated documentation files (the "Software"), to
5642 + * deal in the Software without restriction, including without limitation the
5643 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
5644 + * sell copies of the Software, and to permit persons to whom the Software is
5645 + * furnished to do so, subject to the following conditions:
5646 + *
5647 + * The above copyright notice and this permission notice shall be included in
5648 + * all copies or substantial portions of the Software.
5649 + *
5650 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5651 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5652 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5653 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5654 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
5655 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
5656 + * DEALINGS IN THE SOFTWARE.
5657 + *
5658 + * Mark Williamson, (C) 2004 Intel Research Cambridge
5659 + * Copyright (C) 2005 Bin Ren
5660 + */
5661 +
5662 +#ifndef __XEN_PUBLIC_TRACE_H__
5663 +#define __XEN_PUBLIC_TRACE_H__
5664 +
5665 +#define TRACE_EXTRA_MAX 7
5666 +#define TRACE_EXTRA_SHIFT 28
5667 +
5668 +/* Trace classes */
5669 +#define TRC_CLS_SHIFT 16
5670 +#define TRC_GEN 0x0001f000 /* General trace */
5671 +#define TRC_SCHED 0x0002f000 /* Xen Scheduler trace */
5672 +#define TRC_DOM0OP 0x0004f000 /* Xen DOM0 operation trace */
5673 +#define TRC_HVM 0x0008f000 /* Xen HVM trace */
5674 +#define TRC_MEM 0x0010f000 /* Xen memory trace */
5675 +#define TRC_PV 0x0020f000 /* Xen PV traces */
5676 +#define TRC_SHADOW 0x0040f000 /* Xen shadow tracing */
5677 +#define TRC_PM 0x0080f000 /* Xen power management trace */
5678 +#define TRC_ALL 0x0ffff000
5679 +#define TRC_HD_TO_EVENT(x) ((x)&0x0fffffff)
5680 +#define TRC_HD_CYCLE_FLAG (1UL<<31)
5681 +#define TRC_HD_INCLUDES_CYCLE_COUNT(x) ( !!( (x) & TRC_HD_CYCLE_FLAG ) )
5682 +#define TRC_HD_EXTRA(x) (((x)>>TRACE_EXTRA_SHIFT)&TRACE_EXTRA_MAX)
5683 +
5684 +/* Trace subclasses */
5685 +#define TRC_SUBCLS_SHIFT 12
5686 +
5687 +/* trace subclasses for SVM */
5688 +#define TRC_HVM_ENTRYEXIT 0x00081000 /* VMENTRY and #VMEXIT */
5689 +#define TRC_HVM_HANDLER 0x00082000 /* various HVM handlers */
5690 +
5691 +#define TRC_SCHED_MIN 0x00021000 /* Just runstate changes */
5692 +#define TRC_SCHED_VERBOSE 0x00028000 /* More inclusive scheduling */
5693 +
5694 +/* Trace events per class */
5695 +#define TRC_LOST_RECORDS (TRC_GEN + 1)
5696 +#define TRC_TRACE_WRAP_BUFFER (TRC_GEN + 2)
5697 +#define TRC_TRACE_CPU_CHANGE (TRC_GEN + 3)
5698 +
5699 +#define TRC_SCHED_RUNSTATE_CHANGE (TRC_SCHED_MIN + 1)
5700 +#define TRC_SCHED_DOM_ADD (TRC_SCHED_VERBOSE + 1)
5701 +#define TRC_SCHED_DOM_REM (TRC_SCHED_VERBOSE + 2)
5702 +#define TRC_SCHED_SLEEP (TRC_SCHED_VERBOSE + 3)
5703 +#define TRC_SCHED_WAKE (TRC_SCHED_VERBOSE + 4)
5704 +#define TRC_SCHED_YIELD (TRC_SCHED_VERBOSE + 5)
5705 +#define TRC_SCHED_BLOCK (TRC_SCHED_VERBOSE + 6)
5706 +#define TRC_SCHED_SHUTDOWN (TRC_SCHED_VERBOSE + 7)
5707 +#define TRC_SCHED_CTL (TRC_SCHED_VERBOSE + 8)
5708 +#define TRC_SCHED_ADJDOM (TRC_SCHED_VERBOSE + 9)
5709 +#define TRC_SCHED_SWITCH (TRC_SCHED_VERBOSE + 10)
5710 +#define TRC_SCHED_S_TIMER_FN (TRC_SCHED_VERBOSE + 11)
5711 +#define TRC_SCHED_T_TIMER_FN (TRC_SCHED_VERBOSE + 12)
5712 +#define TRC_SCHED_DOM_TIMER_FN (TRC_SCHED_VERBOSE + 13)
5713 +#define TRC_SCHED_SWITCH_INFPREV (TRC_SCHED_VERBOSE + 14)
5714 +#define TRC_SCHED_SWITCH_INFNEXT (TRC_SCHED_VERBOSE + 15)
5715 +
5716 +#define TRC_MEM_PAGE_GRANT_MAP (TRC_MEM + 1)
5717 +#define TRC_MEM_PAGE_GRANT_UNMAP (TRC_MEM + 2)
5718 +#define TRC_MEM_PAGE_GRANT_TRANSFER (TRC_MEM + 3)
5719 +
5720 +#define TRC_PV_HYPERCALL (TRC_PV + 1)
5721 +#define TRC_PV_TRAP (TRC_PV + 3)
5722 +#define TRC_PV_PAGE_FAULT (TRC_PV + 4)
5723 +#define TRC_PV_FORCED_INVALID_OP (TRC_PV + 5)
5724 +#define TRC_PV_EMULATE_PRIVOP (TRC_PV + 6)
5725 +#define TRC_PV_EMULATE_4GB (TRC_PV + 7)
5726 +#define TRC_PV_MATH_STATE_RESTORE (TRC_PV + 8)
5727 +#define TRC_PV_PAGING_FIXUP (TRC_PV + 9)
5728 +#define TRC_PV_GDT_LDT_MAPPING_FAULT (TRC_PV + 10)
5729 +#define TRC_PV_PTWR_EMULATION (TRC_PV + 11)
5730 +#define TRC_PV_PTWR_EMULATION_PAE (TRC_PV + 12)
5731 + /* Indicates that addresses in trace record are 64 bits */
5732 +#define TRC_64_FLAG (0x100)
5733 +
5734 +#define TRC_SHADOW_NOT_SHADOW (TRC_SHADOW + 1)
5735 +#define TRC_SHADOW_FAST_PROPAGATE (TRC_SHADOW + 2)
5736 +#define TRC_SHADOW_FAST_MMIO (TRC_SHADOW + 3)
5737 +#define TRC_SHADOW_FALSE_FAST_PATH (TRC_SHADOW + 4)
5738 +#define TRC_SHADOW_MMIO (TRC_SHADOW + 5)
5739 +#define TRC_SHADOW_FIXUP (TRC_SHADOW + 6)
5740 +#define TRC_SHADOW_DOMF_DYING (TRC_SHADOW + 7)
5741 +#define TRC_SHADOW_EMULATE (TRC_SHADOW + 8)
5742 +#define TRC_SHADOW_EMULATE_UNSHADOW_USER (TRC_SHADOW + 9)
5743 +#define TRC_SHADOW_EMULATE_UNSHADOW_EVTINJ (TRC_SHADOW + 10)
5744 +#define TRC_SHADOW_EMULATE_UNSHADOW_UNHANDLED (TRC_SHADOW + 11)
5745 +#define TRC_SHADOW_WRMAP_BF (TRC_SHADOW + 12)
5746 +#define TRC_SHADOW_PREALLOC_UNPIN (TRC_SHADOW + 13)
5747 +#define TRC_SHADOW_RESYNC_FULL (TRC_SHADOW + 14)
5748 +#define TRC_SHADOW_RESYNC_ONLY (TRC_SHADOW + 15)
5749 +
5750 +/* trace events per subclass */
5751 +#define TRC_HVM_VMENTRY (TRC_HVM_ENTRYEXIT + 0x01)
5752 +#define TRC_HVM_VMEXIT (TRC_HVM_ENTRYEXIT + 0x02)
5753 +#define TRC_HVM_VMEXIT64 (TRC_HVM_ENTRYEXIT + TRC_64_FLAG + 0x02)
5754 +#define TRC_HVM_PF_XEN (TRC_HVM_HANDLER + 0x01)
5755 +#define TRC_HVM_PF_XEN64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x01)
5756 +#define TRC_HVM_PF_INJECT (TRC_HVM_HANDLER + 0x02)
5757 +#define TRC_HVM_PF_INJECT64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x02)
5758 +#define TRC_HVM_INJ_EXC (TRC_HVM_HANDLER + 0x03)
5759 +#define TRC_HVM_INJ_VIRQ (TRC_HVM_HANDLER + 0x04)
5760 +#define TRC_HVM_REINJ_VIRQ (TRC_HVM_HANDLER + 0x05)
5761 +#define TRC_HVM_IO_READ (TRC_HVM_HANDLER + 0x06)
5762 +#define TRC_HVM_IO_WRITE (TRC_HVM_HANDLER + 0x07)
5763 +#define TRC_HVM_CR_READ (TRC_HVM_HANDLER + 0x08)
5764 +#define TRC_HVM_CR_READ64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x08)
5765 +#define TRC_HVM_CR_WRITE (TRC_HVM_HANDLER + 0x09)
5766 +#define TRC_HVM_CR_WRITE64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x09)
5767 +#define TRC_HVM_DR_READ (TRC_HVM_HANDLER + 0x0A)
5768 +#define TRC_HVM_DR_WRITE (TRC_HVM_HANDLER + 0x0B)
5769 +#define TRC_HVM_MSR_READ (TRC_HVM_HANDLER + 0x0C)
5770 +#define TRC_HVM_MSR_WRITE (TRC_HVM_HANDLER + 0x0D)
5771 +#define TRC_HVM_CPUID (TRC_HVM_HANDLER + 0x0E)
5772 +#define TRC_HVM_INTR (TRC_HVM_HANDLER + 0x0F)
5773 +#define TRC_HVM_NMI (TRC_HVM_HANDLER + 0x10)
5774 +#define TRC_HVM_SMI (TRC_HVM_HANDLER + 0x11)
5775 +#define TRC_HVM_VMMCALL (TRC_HVM_HANDLER + 0x12)
5776 +#define TRC_HVM_HLT (TRC_HVM_HANDLER + 0x13)
5777 +#define TRC_HVM_INVLPG (TRC_HVM_HANDLER + 0x14)
5778 +#define TRC_HVM_INVLPG64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x14)
5779 +#define TRC_HVM_MCE (TRC_HVM_HANDLER + 0x15)
5780 +#define TRC_HVM_IO_ASSIST (TRC_HVM_HANDLER + 0x16)
5781 +#define TRC_HVM_IO_ASSIST64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x16)
5782 +#define TRC_HVM_MMIO_ASSIST (TRC_HVM_HANDLER + 0x17)
5783 +#define TRC_HVM_MMIO_ASSIST64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x17)
5784 +#define TRC_HVM_CLTS (TRC_HVM_HANDLER + 0x18)
5785 +#define TRC_HVM_LMSW (TRC_HVM_HANDLER + 0x19)
5786 +#define TRC_HVM_LMSW64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x19)
5787 +
5788 +/* trace subclasses for power management */
5789 +#define TRC_PM_FREQ 0x00801000 /* xen cpu freq events */
5790 +#define TRC_PM_IDLE 0x00802000 /* xen cpu idle events */
5791 +
5792 +/* trace events for per class */
5793 +#define TRC_PM_FREQ_CHANGE (TRC_PM_FREQ + 0x01)
5794 +#define TRC_PM_IDLE_ENTRY (TRC_PM_IDLE + 0x01)
5795 +#define TRC_PM_IDLE_EXIT (TRC_PM_IDLE + 0x02)
5796 +
5797 +/* This structure represents a single trace buffer record. */
5798 +struct t_rec {
5799 + uint32_t event:28;
5800 + uint32_t extra_u32:3; /* # entries in trailing extra_u32[] array */
5801 + uint32_t cycles_included:1; /* u.cycles or u.no_cycles? */
5802 + union {
5803 + struct {
5804 + uint32_t cycles_lo, cycles_hi; /* cycle counter timestamp */
5805 + uint32_t extra_u32[7]; /* event data items */
5806 + } cycles;
5807 + struct {
5808 + uint32_t extra_u32[7]; /* event data items */
5809 + } nocycles;
5810 + } u;
5811 +};
5812 +
5813 +/*
5814 + * This structure contains the metadata for a single trace buffer. The head
5815 + * field, indexes into an array of struct t_rec's.
5816 + */
5817 +struct t_buf {
5818 + /* Assume the data buffer size is X. X is generally not a power of 2.
5819 + * CONS and PROD are incremented modulo (2*X):
5820 + * 0 <= cons < 2*X
5821 + * 0 <= prod < 2*X
5822 + * This is done because addition modulo X breaks at 2^32 when X is not a
5823 + * power of 2:
5824 + * (((2^32 - 1) % X) + 1) % X != (2^32) % X
5825 + */
5826 + uint32_t cons; /* Offset of next item to be consumed by control tools. */
5827 + uint32_t prod; /* Offset of next item to be produced by Xen. */
5828 + /* Records follow immediately after the meta-data header. */
5829 +};
5830 +
5831 +#endif /* __XEN_PUBLIC_TRACE_H__ */
5832 +
5833 +/*
5834 + * Local variables:
5835 + * mode: C
5836 + * c-set-style: "BSD"
5837 + * c-basic-offset: 4
5838 + * tab-width: 4
5839 + * indent-tabs-mode: nil
5840 + * End:
5841 + */
5842 Index: head-2008-11-25/include/xen/interface/xen-compat.h
5843 ===================================================================
5844 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
5845 +++ head-2008-11-25/include/xen/interface/xen-compat.h 2008-09-01 12:07:31.000000000 +0200
5846 @@ -0,0 +1,44 @@
5847 +/******************************************************************************
5848 + * xen-compat.h
5849 + *
5850 + * Guest OS interface to Xen. Compatibility layer.
5851 + *
5852 + * Permission is hereby granted, free of charge, to any person obtaining a copy
5853 + * of this software and associated documentation files (the "Software"), to
5854 + * deal in the Software without restriction, including without limitation the
5855 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
5856 + * sell copies of the Software, and to permit persons to whom the Software is
5857 + * furnished to do so, subject to the following conditions:
5858 + *
5859 + * The above copyright notice and this permission notice shall be included in
5860 + * all copies or substantial portions of the Software.
5861 + *
5862 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5863 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5864 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5865 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5866 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
5867 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
5868 + * DEALINGS IN THE SOFTWARE.
5869 + *
5870 + * Copyright (c) 2006, Christian Limpach
5871 + */
5872 +
5873 +#ifndef __XEN_PUBLIC_XEN_COMPAT_H__
5874 +#define __XEN_PUBLIC_XEN_COMPAT_H__
5875 +
5876 +#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030209
5877 +
5878 +#if defined(__XEN__) || defined(__XEN_TOOLS__)
5879 +/* Xen is built with matching headers and implements the latest interface. */
5880 +#define __XEN_INTERFACE_VERSION__ __XEN_LATEST_INTERFACE_VERSION__
5881 +#elif !defined(__XEN_INTERFACE_VERSION__)
5882 +/* Guests which do not specify a version get the legacy interface. */
5883 +#define __XEN_INTERFACE_VERSION__ 0x00000000
5884 +#endif
5885 +
5886 +#if __XEN_INTERFACE_VERSION__ > __XEN_LATEST_INTERFACE_VERSION__
5887 +#error "These header files do not support the requested interface version."
5888 +#endif
5889 +
5890 +#endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */
5891 Index: head-2008-11-25/include/xen/interface/xenoprof.h
5892 ===================================================================
5893 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
5894 +++ head-2008-11-25/include/xen/interface/xenoprof.h 2007-06-12 13:14:19.000000000 +0200
5895 @@ -0,0 +1,138 @@
5896 +/******************************************************************************
5897 + * xenoprof.h
5898 + *
5899 + * Interface for enabling system wide profiling based on hardware performance
5900 + * counters
5901 + *
5902 + * Permission is hereby granted, free of charge, to any person obtaining a copy
5903 + * of this software and associated documentation files (the "Software"), to
5904 + * deal in the Software without restriction, including without limitation the
5905 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
5906 + * sell copies of the Software, and to permit persons to whom the Software is
5907 + * furnished to do so, subject to the following conditions:
5908 + *
5909 + * The above copyright notice and this permission notice shall be included in
5910 + * all copies or substantial portions of the Software.
5911 + *
5912 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5913 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5914 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5915 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5916 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
5917 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
5918 + * DEALINGS IN THE SOFTWARE.
5919 + *
5920 + * Copyright (C) 2005 Hewlett-Packard Co.
5921 + * Written by Aravind Menon & Jose Renato Santos
5922 + */
5923 +
5924 +#ifndef __XEN_PUBLIC_XENOPROF_H__
5925 +#define __XEN_PUBLIC_XENOPROF_H__
5926 +
5927 +#include "xen.h"
5928 +
5929 +/*
5930 + * Commands to HYPERVISOR_xenoprof_op().
5931 + */
5932 +#define XENOPROF_init 0
5933 +#define XENOPROF_reset_active_list 1
5934 +#define XENOPROF_reset_passive_list 2
5935 +#define XENOPROF_set_active 3
5936 +#define XENOPROF_set_passive 4
5937 +#define XENOPROF_reserve_counters 5
5938 +#define XENOPROF_counter 6
5939 +#define XENOPROF_setup_events 7
5940 +#define XENOPROF_enable_virq 8
5941 +#define XENOPROF_start 9
5942 +#define XENOPROF_stop 10
5943 +#define XENOPROF_disable_virq 11
5944 +#define XENOPROF_release_counters 12
5945 +#define XENOPROF_shutdown 13
5946 +#define XENOPROF_get_buffer 14
5947 +#define XENOPROF_set_backtrace 15
5948 +#define XENOPROF_last_op 15
5949 +
5950 +#define MAX_OPROF_EVENTS 32
5951 +#define MAX_OPROF_DOMAINS 25
5952 +#define XENOPROF_CPU_TYPE_SIZE 64
5953 +
5954 +/* Xenoprof performance events (not Xen events) */
5955 +struct event_log {
5956 + uint64_t eip;
5957 + uint8_t mode;
5958 + uint8_t event;
5959 +};
5960 +
5961 +/* PC value that indicates a special code */
5962 +#define XENOPROF_ESCAPE_CODE ~0UL
5963 +/* Transient events for the xenoprof->oprofile cpu buf */
5964 +#define XENOPROF_TRACE_BEGIN 1
5965 +
5966 +/* Xenoprof buffer shared between Xen and domain - 1 per VCPU */
5967 +struct xenoprof_buf {
5968 + uint32_t event_head;
5969 + uint32_t event_tail;
5970 + uint32_t event_size;
5971 + uint32_t vcpu_id;
5972 + uint64_t xen_samples;
5973 + uint64_t kernel_samples;
5974 + uint64_t user_samples;
5975 + uint64_t lost_samples;
5976 + struct event_log event_log[1];
5977 +};
5978 +#ifndef __XEN__
5979 +typedef struct xenoprof_buf xenoprof_buf_t;
5980 +DEFINE_XEN_GUEST_HANDLE(xenoprof_buf_t);
5981 +#endif
5982 +
5983 +struct xenoprof_init {
5984 + int32_t num_events;
5985 + int32_t is_primary;
5986 + char cpu_type[XENOPROF_CPU_TYPE_SIZE];
5987 +};
5988 +typedef struct xenoprof_init xenoprof_init_t;
5989 +DEFINE_XEN_GUEST_HANDLE(xenoprof_init_t);
5990 +
5991 +struct xenoprof_get_buffer {
5992 + int32_t max_samples;
5993 + int32_t nbuf;
5994 + int32_t bufsize;
5995 + uint64_t buf_gmaddr;
5996 +};
5997 +typedef struct xenoprof_get_buffer xenoprof_get_buffer_t;
5998 +DEFINE_XEN_GUEST_HANDLE(xenoprof_get_buffer_t);
5999 +
6000 +struct xenoprof_counter {
6001 + uint32_t ind;
6002 + uint64_t count;
6003 + uint32_t enabled;
6004 + uint32_t event;
6005 + uint32_t hypervisor;
6006 + uint32_t kernel;
6007 + uint32_t user;
6008 + uint64_t unit_mask;
6009 +};
6010 +typedef struct xenoprof_counter xenoprof_counter_t;
6011 +DEFINE_XEN_GUEST_HANDLE(xenoprof_counter_t);
6012 +
6013 +typedef struct xenoprof_passive {
6014 + uint16_t domain_id;
6015 + int32_t max_samples;
6016 + int32_t nbuf;
6017 + int32_t bufsize;
6018 + uint64_t buf_gmaddr;
6019 +} xenoprof_passive_t;
6020 +DEFINE_XEN_GUEST_HANDLE(xenoprof_passive_t);
6021 +
6022 +
6023 +#endif /* __XEN_PUBLIC_XENOPROF_H__ */
6024 +
6025 +/*
6026 + * Local variables:
6027 + * mode: C
6028 + * c-set-style: "BSD"
6029 + * c-basic-offset: 4
6030 + * tab-width: 4
6031 + * indent-tabs-mode: nil
6032 + * End:
6033 + */
6034 Index: head-2008-11-25/include/xen/interface/xsm/acm.h
6035 ===================================================================
6036 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
6037 +++ head-2008-11-25/include/xen/interface/xsm/acm.h 2008-07-21 11:00:33.000000000 +0200
6038 @@ -0,0 +1,235 @@
6039 +/*
6040 + * acm.h: Xen access control module interface defintions
6041 + *
6042 + * Permission is hereby granted, free of charge, to any person obtaining a copy
6043 + * of this software and associated documentation files (the "Software"), to
6044 + * deal in the Software without restriction, including without limitation the
6045 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
6046 + * sell copies of the Software, and to permit persons to whom the Software is
6047 + * furnished to do so, subject to the following conditions:
6048 + *
6049 + * The above copyright notice and this permission notice shall be included in
6050 + * all copies or substantial portions of the Software.
6051 + *
6052 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6053 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6054 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
6055 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
6056 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
6057 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
6058 + * DEALINGS IN THE SOFTWARE.
6059 + *
6060 + * Reiner Sailer <sailer@watson.ibm.com>
6061 + * Copyright (c) 2005, International Business Machines Corporation.
6062 + */
6063 +
6064 +#ifndef _XEN_PUBLIC_ACM_H
6065 +#define _XEN_PUBLIC_ACM_H
6066 +
6067 +#include "../xen.h"
6068 +
6069 +/* if ACM_DEBUG defined, all hooks should
6070 + * print a short trace message (comment it out
6071 + * when not in testing mode )
6072 + */
6073 +/* #define ACM_DEBUG */
6074 +
6075 +#ifdef ACM_DEBUG
6076 +# define printkd(fmt, args...) printk(fmt,## args)
6077 +#else
6078 +# define printkd(fmt, args...)
6079 +#endif
6080 +
6081 +/* default ssid reference value if not supplied */
6082 +#define ACM_DEFAULT_SSID 0x0
6083 +#define ACM_DEFAULT_LOCAL_SSID 0x0
6084 +
6085 +/* Internal ACM ERROR types */
6086 +#define ACM_OK 0
6087 +#define ACM_UNDEF -1
6088 +#define ACM_INIT_SSID_ERROR -2
6089 +#define ACM_INIT_SOID_ERROR -3
6090 +#define ACM_ERROR -4
6091 +
6092 +/* External ACCESS DECISIONS */
6093 +#define ACM_ACCESS_PERMITTED 0
6094 +#define ACM_ACCESS_DENIED -111
6095 +#define ACM_NULL_POINTER_ERROR -200
6096 +
6097 +/*
6098 + Error codes reported in when trying to test for a new policy
6099 + These error codes are reported in an array of tuples where
6100 + each error code is followed by a parameter describing the error
6101 + more closely, such as a domain id.
6102 +*/
6103 +#define ACM_EVTCHN_SHARING_VIOLATION 0x100
6104 +#define ACM_GNTTAB_SHARING_VIOLATION 0x101
6105 +#define ACM_DOMAIN_LOOKUP 0x102
6106 +#define ACM_CHWALL_CONFLICT 0x103
6107 +#define ACM_SSIDREF_IN_USE 0x104
6108 +
6109 +
6110 +/* primary policy in lower 4 bits */
6111 +#define ACM_NULL_POLICY 0
6112 +#define ACM_CHINESE_WALL_POLICY 1
6113 +#define ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY 2
6114 +#define ACM_POLICY_UNDEFINED 15
6115 +
6116 +/* combinations have secondary policy component in higher 4bit */
6117 +#define ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY \
6118 + ((ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY << 4) | ACM_CHINESE_WALL_POLICY)
6119 +
6120 +/* policy: */
6121 +#define ACM_POLICY_NAME(X) \
6122 + ((X) == (ACM_NULL_POLICY)) ? "NULL" : \
6123 + ((X) == (ACM_CHINESE_WALL_POLICY)) ? "CHINESE WALL" : \
6124 + ((X) == (ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY)) ? "SIMPLE TYPE ENFORCEMENT" : \
6125 + ((X) == (ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY)) ? "CHINESE WALL AND SIMPLE TYPE ENFORCEMENT" : \
6126 + "UNDEFINED"
6127 +
6128 +/* the following policy versions must be increased
6129 + * whenever the interpretation of the related
6130 + * policy's data structure changes
6131 + */
6132 +#define ACM_POLICY_VERSION 4
6133 +#define ACM_CHWALL_VERSION 1
6134 +#define ACM_STE_VERSION 1
6135 +
6136 +/* defines a ssid reference used by xen */
6137 +typedef uint32_t ssidref_t;
6138 +
6139 +/* hooks that are known to domains */
6140 +#define ACMHOOK_none 0
6141 +#define ACMHOOK_sharing 1
6142 +#define ACMHOOK_authorization 2
6143 +#define ACMHOOK_conflictset 3
6144 +
6145 +/* -------security policy relevant type definitions-------- */
6146 +
6147 +/* type identifier; compares to "equal" or "not equal" */
6148 +typedef uint16_t domaintype_t;
6149 +
6150 +/* CHINESE WALL POLICY DATA STRUCTURES
6151 + *
6152 + * current accumulated conflict type set:
6153 + * When a domain is started and has a type that is in
6154 + * a conflict set, the conflicting types are incremented in
6155 + * the aggregate set. When a domain is destroyed, the
6156 + * conflicting types to its type are decremented.
6157 + * If a domain has multiple types, this procedure works over
6158 + * all those types.
6159 + *
6160 + * conflict_aggregate_set[i] holds the number of
6161 + * running domains that have a conflict with type i.
6162 + *
6163 + * running_types[i] holds the number of running domains
6164 + * that include type i in their ssidref-referenced type set
6165 + *
6166 + * conflict_sets[i][j] is "0" if type j has no conflict
6167 + * with type i and is "1" otherwise.
6168 + */
6169 +/* high-16 = version, low-16 = check magic */
6170 +#define ACM_MAGIC 0x0001debc
6171 +
6172 +/* size of the SHA1 hash identifying the XML policy from which the
6173 + binary policy was created */
6174 +#define ACM_SHA1_HASH_SIZE 20
6175 +
6176 +/* each offset in bytes from start of the struct they
6177 + * are part of */
6178 +
6179 +/* V3 of the policy buffer aded a version structure */
6180 +struct acm_policy_version
6181 +{
6182 + uint32_t major;
6183 + uint32_t minor;
6184 +};
6185 +
6186 +
6187 +/* each buffer consists of all policy information for
6188 + * the respective policy given in the policy code
6189 + *
6190 + * acm_policy_buffer, acm_chwall_policy_buffer,
6191 + * and acm_ste_policy_buffer need to stay 32-bit aligned
6192 + * because we create binary policies also with external
6193 + * tools that assume packed representations (e.g. the java tool)
6194 + */
6195 +struct acm_policy_buffer {
6196 + uint32_t magic;
6197 + uint32_t policy_version; /* ACM_POLICY_VERSION */
6198 + uint32_t len;
6199 + uint32_t policy_reference_offset;
6200 + uint32_t primary_policy_code;
6201 + uint32_t primary_buffer_offset;
6202 + uint32_t secondary_policy_code;
6203 + uint32_t secondary_buffer_offset;
6204 + struct acm_policy_version xml_pol_version; /* add in V3 */
6205 + uint8_t xml_policy_hash[ACM_SHA1_HASH_SIZE]; /* added in V4 */
6206 +};
6207 +
6208 +
6209 +struct acm_policy_reference_buffer {
6210 + uint32_t len;
6211 +};
6212 +
6213 +struct acm_chwall_policy_buffer {
6214 + uint32_t policy_version; /* ACM_CHWALL_VERSION */
6215 + uint32_t policy_code;
6216 + uint32_t chwall_max_types;
6217 + uint32_t chwall_max_ssidrefs;
6218 + uint32_t chwall_max_conflictsets;
6219 + uint32_t chwall_ssid_offset;
6220 + uint32_t chwall_conflict_sets_offset;
6221 + uint32_t chwall_running_types_offset;
6222 + uint32_t chwall_conflict_aggregate_offset;
6223 +};
6224 +
6225 +struct acm_ste_policy_buffer {
6226 + uint32_t policy_version; /* ACM_STE_VERSION */
6227 + uint32_t policy_code;
6228 + uint32_t ste_max_types;
6229 + uint32_t ste_max_ssidrefs;
6230 + uint32_t ste_ssid_offset;
6231 +};
6232 +
6233 +struct acm_stats_buffer {
6234 + uint32_t magic;
6235 + uint32_t len;
6236 + uint32_t primary_policy_code;
6237 + uint32_t primary_stats_offset;
6238 + uint32_t secondary_policy_code;
6239 + uint32_t secondary_stats_offset;
6240 +};
6241 +
6242 +struct acm_ste_stats_buffer {
6243 + uint32_t ec_eval_count;
6244 + uint32_t gt_eval_count;
6245 + uint32_t ec_denied_count;
6246 + uint32_t gt_denied_count;
6247 + uint32_t ec_cachehit_count;
6248 + uint32_t gt_cachehit_count;
6249 +};
6250 +
6251 +struct acm_ssid_buffer {
6252 + uint32_t len;
6253 + ssidref_t ssidref;
6254 + uint32_t policy_reference_offset;
6255 + uint32_t primary_policy_code;
6256 + uint32_t primary_max_types;
6257 + uint32_t primary_types_offset;
6258 + uint32_t secondary_policy_code;
6259 + uint32_t secondary_max_types;
6260 + uint32_t secondary_types_offset;
6261 +};
6262 +
6263 +#endif
6264 +
6265 +/*
6266 + * Local variables:
6267 + * mode: C
6268 + * c-set-style: "BSD"
6269 + * c-basic-offset: 4
6270 + * tab-width: 4
6271 + * indent-tabs-mode: nil
6272 + * End:
6273 + */
6274 Index: head-2008-11-25/include/xen/interface/xsm/acm_ops.h
6275 ===================================================================
6276 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
6277 +++ head-2008-11-25/include/xen/interface/xsm/acm_ops.h 2007-10-22 13:39:15.000000000 +0200
6278 @@ -0,0 +1,159 @@
6279 +/*
6280 + * acm_ops.h: Xen access control module hypervisor commands
6281 + *
6282 + * Permission is hereby granted, free of charge, to any person obtaining a copy
6283 + * of this software and associated documentation files (the "Software"), to
6284 + * deal in the Software without restriction, including without limitation the
6285 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
6286 + * sell copies of the Software, and to permit persons to whom the Software is
6287 + * furnished to do so, subject to the following conditions:
6288 + *
6289 + * The above copyright notice and this permission notice shall be included in
6290 + * all copies or substantial portions of the Software.
6291 + *
6292 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6293 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6294 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
6295 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
6296 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
6297 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
6298 + * DEALINGS IN THE SOFTWARE.
6299 + *
6300 + * Reiner Sailer <sailer@watson.ibm.com>
6301 + * Copyright (c) 2005,2006 International Business Machines Corporation.
6302 + */
6303 +
6304 +#ifndef __XEN_PUBLIC_ACM_OPS_H__
6305 +#define __XEN_PUBLIC_ACM_OPS_H__
6306 +
6307 +#include "../xen.h"
6308 +#include "acm.h"
6309 +
6310 +/*
6311 + * Make sure you increment the interface version whenever you modify this file!
6312 + * This makes sure that old versions of acm tools will stop working in a
6313 + * well-defined way (rather than crashing the machine, for instance).
6314 + */
6315 +#define ACM_INTERFACE_VERSION 0xAAAA000A
6316 +
6317 +/************************************************************************/
6318 +
6319 +/*
6320 + * Prototype for this hypercall is:
6321 + * int acm_op(int cmd, void *args)
6322 + * @cmd == ACMOP_??? (access control module operation).
6323 + * @args == Operation-specific extra arguments (NULL if none).
6324 + */
6325 +
6326 +
6327 +#define ACMOP_setpolicy 1
6328 +struct acm_setpolicy {
6329 + /* IN */
6330 + XEN_GUEST_HANDLE_64(void) pushcache;
6331 + uint32_t pushcache_size;
6332 +};
6333 +
6334 +
6335 +#define ACMOP_getpolicy 2
6336 +struct acm_getpolicy {
6337 + /* IN */
6338 + XEN_GUEST_HANDLE_64(void) pullcache;
6339 + uint32_t pullcache_size;
6340 +};
6341 +
6342 +
6343 +#define ACMOP_dumpstats 3
6344 +struct acm_dumpstats {
6345 + /* IN */
6346 + XEN_GUEST_HANDLE_64(void) pullcache;
6347 + uint32_t pullcache_size;
6348 +};
6349 +
6350 +
6351 +#define ACMOP_getssid 4
6352 +#define ACM_GETBY_ssidref 1
6353 +#define ACM_GETBY_domainid 2
6354 +struct acm_getssid {
6355 + /* IN */
6356 + uint32_t get_ssid_by; /* ACM_GETBY_* */
6357 + union {
6358 + domaintype_t domainid;
6359 + ssidref_t ssidref;
6360 + } id;
6361 + XEN_GUEST_HANDLE_64(void) ssidbuf;
6362 + uint32_t ssidbuf_size;
6363 +};
6364 +
6365 +#define ACMOP_getdecision 5
6366 +struct acm_getdecision {
6367 + /* IN */
6368 + uint32_t get_decision_by1; /* ACM_GETBY_* */
6369 + uint32_t get_decision_by2; /* ACM_GETBY_* */
6370 + union {
6371 + domaintype_t domainid;
6372 + ssidref_t ssidref;
6373 + } id1;
6374 + union {
6375 + domaintype_t domainid;
6376 + ssidref_t ssidref;
6377 + } id2;
6378 + uint32_t hook;
6379 + /* OUT */
6380 + uint32_t acm_decision;
6381 +};
6382 +
6383 +
6384 +#define ACMOP_chgpolicy 6
6385 +struct acm_change_policy {
6386 + /* IN */
6387 + XEN_GUEST_HANDLE_64(void) policy_pushcache;
6388 + uint32_t policy_pushcache_size;
6389 + XEN_GUEST_HANDLE_64(void) del_array;
6390 + uint32_t delarray_size;
6391 + XEN_GUEST_HANDLE_64(void) chg_array;
6392 + uint32_t chgarray_size;
6393 + /* OUT */
6394 + /* array with error code */
6395 + XEN_GUEST_HANDLE_64(void) err_array;
6396 + uint32_t errarray_size;
6397 +};
6398 +
6399 +#define ACMOP_relabeldoms 7
6400 +struct acm_relabel_doms {
6401 + /* IN */
6402 + XEN_GUEST_HANDLE_64(void) relabel_map;
6403 + uint32_t relabel_map_size;
6404 + /* OUT */
6405 + XEN_GUEST_HANDLE_64(void) err_array;
6406 + uint32_t errarray_size;
6407 +};
6408 +
6409 +/* future interface to Xen */
6410 +struct xen_acmctl {
6411 + uint32_t cmd;
6412 + uint32_t interface_version;
6413 + union {
6414 + struct acm_setpolicy setpolicy;
6415 + struct acm_getpolicy getpolicy;
6416 + struct acm_dumpstats dumpstats;
6417 + struct acm_getssid getssid;
6418 + struct acm_getdecision getdecision;
6419 + struct acm_change_policy change_policy;
6420 + struct acm_relabel_doms relabel_doms;
6421 + } u;
6422 +};
6423 +
6424 +typedef struct xen_acmctl xen_acmctl_t;
6425 +DEFINE_XEN_GUEST_HANDLE(xen_acmctl_t);
6426 +
6427 +#endif /* __XEN_PUBLIC_ACM_OPS_H__ */
6428 +
6429 +/*
6430 + * Local variables:
6431 + * mode: C
6432 + * c-set-style: "BSD"
6433 + * c-basic-offset: 4
6434 + * tab-width: 4
6435 + * indent-tabs-mode: nil
6436 + * End:
6437 + */
6438 Index: head-2008-11-25/include/xen/interface/xsm/flask_op.h
6439 ===================================================================
6440 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
6441 +++ head-2008-11-25/include/xen/interface/xsm/flask_op.h 2008-09-01 12:07:31.000000000 +0200
6442 @@ -0,0 +1,45 @@
6443 +/*
6444 + * This file contains the flask_op hypercall commands and definitions.
6445 + *
6446 + * Author: George Coker, <gscoker@alpha.ncsc.mil>
6447 + *
6448 + * This program is free software; you can redistribute it and/or modify
6449 + * it under the terms of the GNU General Public License version 2,
6450 + * as published by the Free Software Foundation.
6451 + */
6452 +
6453 +#ifndef __FLASK_OP_H__
6454 +#define __FLASK_OP_H__
6455 +
6456 +#define FLASK_LOAD 1
6457 +#define FLASK_GETENFORCE 2
6458 +#define FLASK_SETENFORCE 3
6459 +#define FLASK_CONTEXT_TO_SID 4
6460 +#define FLASK_SID_TO_CONTEXT 5
6461 +#define FLASK_ACCESS 6
6462 +#define FLASK_CREATE 7
6463 +#define FLASK_RELABEL 8
6464 +#define FLASK_USER 9
6465 +#define FLASK_POLICYVERS 10
6466 +#define FLASK_GETBOOL 11
6467 +#define FLASK_SETBOOL 12
6468 +#define FLASK_COMMITBOOLS 13
6469 +#define FLASK_MLS 14
6470 +#define FLASK_DISABLE 15
6471 +#define FLASK_GETAVC_THRESHOLD 16
6472 +#define FLASK_SETAVC_THRESHOLD 17
6473 +#define FLASK_AVC_HASHSTATS 18
6474 +#define FLASK_AVC_CACHESTATS 19
6475 +#define FLASK_MEMBER 20
6476 +
6477 +#define FLASK_LAST FLASK_MEMBER
6478 +
6479 +typedef struct flask_op {
6480 + uint32_t cmd;
6481 + uint32_t size;
6482 + char *buf;
6483 +} flask_op_t;
6484 +
6485 +DEFINE_XEN_GUEST_HANDLE(flask_op_t);
6486 +
6487 +#endif