Magellan Linux

Annotation of /trunk/kernel26-xen/patches-2.6.25-r1/1009-2.6.25-xen-auto-include-xen-interface.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 609 - (hide annotations) (download)
Fri May 23 17:35:37 2008 UTC (16 years ago) by niro
File size: 222409 byte(s)
-using opensuse xen patchset, updated kernel configs

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