win-pvdrivers

view common/include/public/arch-x86/xen-x86_32.h @ 62:edd4a2ad5b44

Removed old inf files
author James Harper <james.harper@bendigoit.com.au>
date Wed Dec 19 10:22:50 2007 +1100 (2007-12-19)
parents 5712dede5a1b
children b474e898b409
line source
1 /******************************************************************************
2 * xen-x86_32.h
3 *
4 * Guest OS interface to x86 32-bit Xen.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Copyright (c) 2004-2007, K A Fraser
25 */
27 #ifndef __XEN_PUBLIC_ARCH_X86_XEN_X86_32_H__
28 #define __XEN_PUBLIC_ARCH_X86_XEN_X86_32_H__
30 /*
31 * Hypercall interface:
32 * Input: %ebx, %ecx, %edx, %esi, %edi (arguments 1-5)
33 * Output: %eax
34 * Access is via hypercall page (set up by guest loader or via a Xen MSR):
35 * call hypercall_page + hypercall-number * 32
36 * Clobbered: Argument registers (e.g., 2-arg hypercall clobbers %ebx,%ecx)
37 */
39 #if __XEN_INTERFACE_VERSION__ < 0x00030203
40 /*
41 * Legacy hypercall interface:
42 * As above, except the entry sequence to the hypervisor is:
43 * mov $hypercall-number*32,%eax ; int $0x82
44 */
45 #define TRAP_INSTR "int $0x82"
46 #endif
48 /*
49 * These flat segments are in the Xen-private section of every GDT. Since these
50 * are also present in the initial GDT, many OSes will be able to avoid
51 * installing their own GDT.
52 */
53 #define FLAT_RING1_CS 0xe019 /* GDT index 259 */
54 #define FLAT_RING1_DS 0xe021 /* GDT index 260 */
55 #define FLAT_RING1_SS 0xe021 /* GDT index 260 */
56 #define FLAT_RING3_CS 0xe02b /* GDT index 261 */
57 #define FLAT_RING3_DS 0xe033 /* GDT index 262 */
58 #define FLAT_RING3_SS 0xe033 /* GDT index 262 */
60 #define FLAT_KERNEL_CS FLAT_RING1_CS
61 #define FLAT_KERNEL_DS FLAT_RING1_DS
62 #define FLAT_KERNEL_SS FLAT_RING1_SS
63 #define FLAT_USER_CS FLAT_RING3_CS
64 #define FLAT_USER_DS FLAT_RING3_DS
65 #define FLAT_USER_SS FLAT_RING3_SS
67 #define __HYPERVISOR_VIRT_START_PAE 0xF5800000
68 #define __MACH2PHYS_VIRT_START_PAE 0xF5800000
69 #define __MACH2PHYS_VIRT_END_PAE 0xF6800000
70 #define HYPERVISOR_VIRT_START_PAE \
71 mk_unsigned_long(__HYPERVISOR_VIRT_START_PAE)
72 #define MACH2PHYS_VIRT_START_PAE \
73 mk_unsigned_long(__MACH2PHYS_VIRT_START_PAE)
74 #define MACH2PHYS_VIRT_END_PAE \
75 mk_unsigned_long(__MACH2PHYS_VIRT_END_PAE)
77 #define __HYPERVISOR_VIRT_START_NONPAE 0xFC000000
78 #define __MACH2PHYS_VIRT_START_NONPAE 0xFC000000
79 #define __MACH2PHYS_VIRT_END_NONPAE 0xFC400000
80 #define HYPERVISOR_VIRT_START_NONPAE \
81 mk_unsigned_long(__HYPERVISOR_VIRT_START_NONPAE)
82 #define MACH2PHYS_VIRT_START_NONPAE \
83 mk_unsigned_long(__MACH2PHYS_VIRT_START_NONPAE)
84 #define MACH2PHYS_VIRT_END_NONPAE \
85 mk_unsigned_long(__MACH2PHYS_VIRT_END_NONPAE)
87 #ifdef CONFIG_X86_PAE
88 #define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_PAE
89 #define __MACH2PHYS_VIRT_START __MACH2PHYS_VIRT_START_PAE
90 #define __MACH2PHYS_VIRT_END __MACH2PHYS_VIRT_END_PAE
91 #else
92 #define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_NONPAE
93 #define __MACH2PHYS_VIRT_START __MACH2PHYS_VIRT_START_NONPAE
94 #define __MACH2PHYS_VIRT_END __MACH2PHYS_VIRT_END_NONPAE
95 #endif
97 #ifndef HYPERVISOR_VIRT_START
98 #define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
99 #endif
101 #define MACH2PHYS_VIRT_START mk_unsigned_long(__MACH2PHYS_VIRT_START)
102 #define MACH2PHYS_VIRT_END mk_unsigned_long(__MACH2PHYS_VIRT_END)
103 #define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>2)
104 #ifndef machine_to_phys_mapping
105 #define machine_to_phys_mapping ((unsigned long *)MACH2PHYS_VIRT_START)
106 #endif
108 /* 32-/64-bit invariability for control interfaces (domctl/sysctl). */
109 #if defined(__XEN__) || defined(__XEN_TOOLS__)
110 #undef __DEFINE_XEN_GUEST_HANDLE
111 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
112 typedef struct { type *p; } \
113 __guest_handle_ ## name; \
114 typedef struct { union { type *p; uint64_aligned_t q; }; } \
115 __guest_handle_64_ ## name
116 #undef set_xen_guest_handle
117 #define set_xen_guest_handle(hnd, val) \
118 do { if ( sizeof(hnd) == 8 ) *(uint64_t *)&(hnd) = 0; \
119 (hnd).p = val; \
120 } while ( 0 )
121 #define uint64_aligned_t uint64_t __attribute__((aligned(8)))
122 #define XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name
123 #endif
125 #ifndef __ASSEMBLY__
127 struct cpu_user_regs {
128 uint32_t ebx;
129 uint32_t ecx;
130 uint32_t edx;
131 uint32_t esi;
132 uint32_t edi;
133 uint32_t ebp;
134 uint32_t eax;
135 uint16_t error_code; /* private */
136 uint16_t entry_vector; /* private */
137 uint32_t eip;
138 uint16_t cs;
139 uint8_t saved_upcall_mask;
140 uint8_t _pad0;
141 uint32_t eflags; /* eflags.IF == !saved_upcall_mask */
142 uint32_t esp;
143 uint16_t ss, _pad1;
144 uint16_t es, _pad2;
145 uint16_t ds, _pad3;
146 uint16_t fs, _pad4;
147 uint16_t gs, _pad5;
148 };
149 typedef struct cpu_user_regs cpu_user_regs_t;
150 DEFINE_XEN_GUEST_HANDLE(cpu_user_regs_t);
152 /*
153 * Page-directory addresses above 4GB do not fit into architectural %cr3.
154 * When accessing %cr3, or equivalent field in vcpu_guest_context, guests
155 * must use the following accessor macros to pack/unpack valid MFNs.
156 */
157 #define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20))
158 #define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20))
160 struct arch_vcpu_info {
161 unsigned long cr2;
162 unsigned long pad[5]; /* sizeof(vcpu_info_t) == 64 */
163 };
164 typedef struct arch_vcpu_info arch_vcpu_info_t;
166 struct xen_callback {
167 unsigned long cs;
168 unsigned long eip;
169 };
170 typedef struct xen_callback xen_callback_t;
172 #endif /* !__ASSEMBLY__ */
174 #endif /* __XEN_PUBLIC_ARCH_X86_XEN_X86_32_H__ */
176 /*
177 * Local variables:
178 * mode: C
179 * c-set-style: "BSD"
180 * c-basic-offset: 4
181 * tab-width: 4
182 * indent-tabs-mode: nil
183 * End:
184 */