Rev 2071 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2071 | Rev 2089 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (c) 2006 Martin Decky |
2 | * Copyright (c) 2006 Martin Decky |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
13 | * documentation and/or other materials provided with the distribution. |
14 | * - The name of the author may not be used to endorse or promote products |
14 | * - The name of the author may not be used to endorse or promote products |
15 | * derived from this software without specific prior written permission. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | #ifndef KERN_ia32xen_HYPERCALL_H_ |
29 | #ifndef KERN_ia32xen_HYPERCALL_H_ |
30 | #define KERN_ia32xen_HYPERCALL_H_ |
30 | #define KERN_ia32xen_HYPERCALL_H_ |
31 | 31 | ||
- | 32 | #ifndef __ASM__ |
|
32 | #include <arch/types.h> |
33 | # include <arch/types.h> |
33 | #include <macros.h> |
34 | # include <macros.h> |
- | 35 | #endif |
|
- | 36 | ||
- | 37 | #define GUEST_CMDLINE 1024 |
|
- | 38 | #define VIRT_CPUS 32 |
|
- | 39 | #define START_INFO_SIZE 1104 |
|
- | 40 | ||
- | 41 | #define BOOT_OFFSET 0x0000 |
|
- | 42 | #define TEMP_STACK_SIZE 0x1000 |
|
- | 43 | ||
- | 44 | #define XEN_VIRT_START 0xFC000000 |
|
- | 45 | #define XEN_CS 0xe019 |
|
- | 46 | ||
- | 47 | #define XEN_ELFNOTE_INFO 0 |
|
- | 48 | #define XEN_ELFNOTE_ENTRY 1 |
|
- | 49 | #define XEN_ELFNOTE_HYPERCALL_PAGE 2 |
|
- | 50 | #define XEN_ELFNOTE_VIRT_BASE 3 |
|
- | 51 | #define XEN_ELFNOTE_PADDR_OFFSET 4 |
|
- | 52 | #define XEN_ELFNOTE_XEN_VERSION 5 |
|
- | 53 | #define XEN_ELFNOTE_GUEST_OS 6 |
|
- | 54 | #define XEN_ELFNOTE_GUEST_VERSION 7 |
|
- | 55 | #define XEN_ELFNOTE_LOADER 8 |
|
- | 56 | #define XEN_ELFNOTE_PAE_MODE 9 |
|
- | 57 | #define XEN_ELFNOTE_FEATURES 10 |
|
- | 58 | #define XEN_ELFNOTE_BSD_SYMTAB 11 |
|
34 | 59 | ||
35 | typedef uint16_t domid_t; |
- | |
36 | - | ||
37 | typedef struct { |
- | |
38 | uint8_t vector; /**< Exception vector */ |
- | |
39 | uint8_t flags; /**< 0-3: privilege level; 4: clear event enable */ |
- | |
40 | uint16_t cs; /**< Code selector */ |
- | |
41 | void *address; /**< Code offset */ |
60 | #define mp_map ((pfn_t *) XEN_VIRT_START) |
42 | } trap_info_t; |
- | |
43 | 61 | ||
- | 62 | #define SIF_PRIVILEGED (1 << 0) /**< Privileged domain */ |
|
- | 63 | #define SIF_INITDOMAIN (1 << 1) /**< Iinitial control domain */ |
|
44 | 64 | ||
45 | typedef struct { |
- | |
46 | evtchn_t port; |
- | |
47 | } evtchn_send_t; |
65 | #define XEN_CONSOLE_VGA 0x03 |
48 | - | ||
49 | typedef struct { |
- | |
50 | uint32_t cmd; |
- | |
51 | union { |
- | |
52 | evtchn_send_t send; |
66 | #define XEN_CONSOLE_VESA 0x23 |
53 | }; |
- | |
54 | } evtchn_op_t; |
- | |
55 | - | ||
56 | 67 | ||
57 | #define XEN_SET_TRAP_TABLE 0 |
68 | #define XEN_SET_TRAP_TABLE 0 |
58 | #define XEN_MMU_UPDATE 1 |
69 | #define XEN_MMU_UPDATE 1 |
59 | #define XEN_SET_CALLBACKS 4 |
70 | #define XEN_SET_CALLBACKS 4 |
60 | #define XEN_UPDATE_VA_MAPPING 14 |
71 | #define XEN_UPDATE_VA_MAPPING 14 |
61 | #define XEN_EVENT_CHANNEL_OP 16 |
72 | #define XEN_EVENT_CHANNEL_OP 16 |
62 | #define XEN_VERSION 17 |
73 | #define XEN_VERSION 17 |
63 | #define XEN_CONSOLE_IO 18 |
74 | #define XEN_CONSOLE_IO 18 |
64 | #define XEN_MMUEXT_OP 26 |
75 | #define XEN_MMUEXT_OP 26 |
65 | 76 | ||
66 | 77 | ||
67 | /* |
78 | /* |
68 | * Commands for XEN_CONSOLE_IO |
79 | * Commands for XEN_CONSOLE_IO |
69 | */ |
80 | */ |
70 | #define CONSOLE_IO_WRITE 0 |
81 | #define CONSOLE_IO_WRITE 0 |
71 | #define CONSOLE_IO_READ 1 |
82 | #define CONSOLE_IO_READ 1 |
72 | 83 | ||
73 | 84 | ||
74 | #define MMUEXT_PIN_L1_TABLE 0 |
85 | #define MMUEXT_PIN_L1_TABLE 0 |
75 | #define MMUEXT_PIN_L2_TABLE 1 |
86 | #define MMUEXT_PIN_L2_TABLE 1 |
76 | #define MMUEXT_PIN_L3_TABLE 2 |
87 | #define MMUEXT_PIN_L3_TABLE 2 |
77 | #define MMUEXT_PIN_L4_TABLE 3 |
88 | #define MMUEXT_PIN_L4_TABLE 3 |
78 | #define MMUEXT_UNPIN_TABLE 4 |
89 | #define MMUEXT_UNPIN_TABLE 4 |
79 | #define MMUEXT_NEW_BASEPTR 5 |
90 | #define MMUEXT_NEW_BASEPTR 5 |
80 | #define MMUEXT_TLB_FLUSH_LOCAL 6 |
91 | #define MMUEXT_TLB_FLUSH_LOCAL 6 |
81 | #define MMUEXT_INVLPG_LOCAL 7 |
92 | #define MMUEXT_INVLPG_LOCAL 7 |
82 | #define MMUEXT_TLB_FLUSH_MULTI 8 |
93 | #define MMUEXT_TLB_FLUSH_MULTI 8 |
83 | #define MMUEXT_INVLPG_MULTI 9 |
94 | #define MMUEXT_INVLPG_MULTI 9 |
84 | #define MMUEXT_TLB_FLUSH_ALL 10 |
95 | #define MMUEXT_TLB_FLUSH_ALL 10 |
85 | #define MMUEXT_INVLPG_ALL 11 |
96 | #define MMUEXT_INVLPG_ALL 11 |
86 | #define MMUEXT_FLUSH_CACHE 12 |
97 | #define MMUEXT_FLUSH_CACHE 12 |
87 | #define MMUEXT_SET_LDT 13 |
98 | #define MMUEXT_SET_LDT 13 |
88 | #define MMUEXT_NEW_USER_BASEPTR 15 |
99 | #define MMUEXT_NEW_USER_BASEPTR 15 |
89 | 100 | ||
90 | 101 | ||
91 | #define EVTCHNOP_SEND 4 |
102 | #define EVTCHNOP_SEND 4 |
92 | 103 | ||
93 | 104 | ||
94 | #define UVMF_NONE 0 /**< No flushing at all */ |
105 | #define UVMF_NONE 0 /**< No flushing at all */ |
95 | #define UVMF_TLB_FLUSH 1 /**< Flush entire TLB(s) */ |
106 | #define UVMF_TLB_FLUSH 1 /**< Flush entire TLB(s) */ |
96 | #define UVMF_INVLPG 2 /**< Flush only one entry */ |
107 | #define UVMF_INVLPG 2 /**< Flush only one entry */ |
97 | #define UVMF_FLUSHTYPE_MASK 3 |
108 | #define UVMF_FLUSHTYPE_MASK 3 |
98 | #define UVMF_MULTI 0 /**< Flush subset of TLBs */ |
109 | #define UVMF_MULTI 0 /**< Flush subset of TLBs */ |
99 | #define UVMF_LOCAL 0 /**< Flush local TLB */ |
110 | #define UVMF_LOCAL 0 /**< Flush local TLB */ |
100 | #define UVMF_ALL (1 << 2) /**< Flush all TLBs */ |
111 | #define UVMF_ALL (1 << 2) /**< Flush all TLBs */ |
101 | 112 | ||
102 | 113 | ||
103 | #define DOMID_SELF (0x7FF0U) |
114 | #define DOMID_SELF (0x7FF0U) |
104 | #define DOMID_IO (0x7FF1U) |
115 | #define DOMID_IO (0x7FF1U) |
105 | 116 | ||
- | 117 | #ifndef __ASM__ |
|
- | 118 | ||
- | 119 | typedef uint16_t domid_t; |
|
- | 120 | typedef uint32_t evtchn_t; |
|
- | 121 | ||
- | 122 | typedef struct { |
|
- | 123 | uint32_t version; |
|
- | 124 | uint32_t pad0; |
|
- | 125 | uint64_t tsc_timestamp; /**< TSC at last update of time vals */ |
|
- | 126 | uint64_t system_time; /**< Time, in nanosecs, since boot */ |
|
- | 127 | uint32_t tsc_to_system_mul; |
|
- | 128 | int8_t tsc_shift; |
|
- | 129 | int8_t pad1[3]; |
|
- | 130 | } vcpu_time_info_t; |
|
- | 131 | ||
- | 132 | typedef struct { |
|
- | 133 | uint32_t cr2; |
|
- | 134 | uint32_t pad[5]; |
|
- | 135 | } arch_vcpu_info_t; |
|
- | 136 | ||
- | 137 | typedef struct arch_shared_info { |
|
- | 138 | pfn_t max_pfn; /**< max pfn that appears in table */ |
|
- | 139 | uint32_t pfn_to_mfn_frame_list_list; |
|
- | 140 | uint32_t nmi_reason; |
|
- | 141 | } arch_shared_info_t; |
|
- | 142 | ||
- | 143 | typedef struct { |
|
- | 144 | uint8_t evtchn_upcall_pending; |
|
- | 145 | ipl_t evtchn_upcall_mask; |
|
- | 146 | evtchn_t evtchn_pending_sel; |
|
- | 147 | arch_vcpu_info_t arch; |
|
- | 148 | vcpu_time_info_t time; |
|
- | 149 | } vcpu_info_t; |
|
- | 150 | ||
- | 151 | typedef struct { |
|
- | 152 | vcpu_info_t vcpu_info[VIRT_CPUS]; |
|
- | 153 | evtchn_t evtchn_pending[32]; |
|
- | 154 | evtchn_t evtchn_mask[32]; |
|
- | 155 | ||
- | 156 | uint32_t wc_version; /**< Version counter */ |
|
- | 157 | uint32_t wc_sec; /**< Secs 00:00:00 UTC, Jan 1, 1970 */ |
|
- | 158 | uint32_t wc_nsec; /**< Nsecs 00:00:00 UTC, Jan 1, 1970 */ |
|
- | 159 | ||
- | 160 | arch_shared_info_t arch; |
|
- | 161 | } shared_info_t; |
|
- | 162 | ||
- | 163 | typedef struct { |
|
- | 164 | int8_t magic[32]; /**< "xen-<version>-<platform>" */ |
|
- | 165 | uint32_t frames; /**< Available frames */ |
|
- | 166 | shared_info_t *shared_info; /**< Shared info structure (machine address) */ |
|
- | 167 | uint32_t flags; /**< SIF_xxx flags */ |
|
- | 168 | pfn_t store_mfn; /**< Shared page (machine page) */ |
|
- | 169 | evtchn_t store_evtchn; /**< Event channel for store communication */ |
|
- | 170 | ||
- | 171 | union { |
|
- | 172 | struct { |
|
- | 173 | pfn_t mfn; /**< Console page (machine page) */ |
|
- | 174 | evtchn_t evtchn; /**< Event channel for console messages */ |
|
- | 175 | } domU; |
|
- | 176 | ||
- | 177 | struct { |
|
- | 178 | uint32_t info_off; /**< Offset of console_info struct */ |
|
- | 179 | uint32_t info_size; /**< Size of console_info struct from start */ |
|
- | 180 | } dom0; |
|
- | 181 | } console; |
|
- | 182 | ||
- | 183 | pte_t *ptl0; /**< Boot PTL0 (kernel address) */ |
|
- | 184 | uint32_t pt_frames; /**< Number of bootstrap page table frames */ |
|
- | 185 | pfn_t *pm_map; /**< Physical->machine frame map (kernel address) */ |
|
- | 186 | void *mod_start; /**< Modules start (kernel address) */ |
|
- | 187 | uint32_t mod_len; /**< Modules size (bytes) */ |
|
- | 188 | int8_t cmd_line[GUEST_CMDLINE]; |
|
- | 189 | } start_info_t; |
|
- | 190 | ||
- | 191 | typedef struct { |
|
- | 192 | uint8_t video_type; |
|
- | 193 | ||
- | 194 | union { |
|
- | 195 | struct { |
|
- | 196 | uint16_t font_height; |
|
- | 197 | uint16_t cursor_x; |
|
- | 198 | uint16_t cursor_y; |
|
- | 199 | uint16_t rows; |
|
- | 200 | uint16_t columns; |
|
- | 201 | } vga; |
|
- | 202 | ||
- | 203 | struct { |
|
- | 204 | uint16_t width; |
|
- | 205 | uint16_t height; |
|
- | 206 | uint16_t bytes_per_line; |
|
- | 207 | uint16_t bits_per_pixel; |
|
- | 208 | uint32_t lfb_base; |
|
- | 209 | uint32_t lfb_size; |
|
- | 210 | uint8_t red_pos; |
|
- | 211 | uint8_t red_size; |
|
- | 212 | uint8_t green_pos; |
|
- | 213 | uint8_t green_size; |
|
- | 214 | uint8_t blue_pos; |
|
- | 215 | uint8_t blue_size; |
|
- | 216 | uint8_t rsvd_pos; |
|
- | 217 | uint8_t rsvd_size; |
|
- | 218 | } vesa_lfb; |
|
- | 219 | } info; |
|
- | 220 | } console_info_t; |
|
- | 221 | ||
- | 222 | typedef struct { |
|
- | 223 | pfn_t start; |
|
- | 224 | pfn_t size; |
|
- | 225 | pfn_t reserved; |
|
- | 226 | } memzone_t; |
|
- | 227 | ||
- | 228 | extern start_info_t start_info; |
|
- | 229 | extern shared_info_t shared_info; |
|
- | 230 | extern memzone_t meminfo; |
|
- | 231 | ||
- | 232 | typedef struct { |
|
- | 233 | uint8_t vector; /**< Exception vector */ |
|
- | 234 | uint8_t flags; /**< 0-3: privilege level; 4: clear event enable */ |
|
- | 235 | uint16_t cs; /**< Code selector */ |
|
- | 236 | void *address; /**< Code offset */ |
|
- | 237 | } trap_info_t; |
|
- | 238 | ||
- | 239 | typedef struct { |
|
- | 240 | evtchn_t port; |
|
- | 241 | } evtchn_send_t; |
|
- | 242 | ||
- | 243 | typedef struct { |
|
- | 244 | uint32_t cmd; |
|
- | 245 | union { |
|
- | 246 | evtchn_send_t send; |
|
- | 247 | }; |
|
- | 248 | } evtchn_op_t; |
|
106 | 249 | ||
107 | #define force_evtchn_callback() ((void) xen_version(0, 0)) |
250 | #define force_evtchn_callback() ((void) xen_version(0, 0)) |
108 | 251 | ||
109 | #define hypercall0(id) \ |
252 | #define hypercall0(id) \ |
110 | ({ \ |
253 | ({ \ |
111 | unative_t ret; \ |
254 | unative_t ret; \ |
112 | asm volatile ( \ |
255 | asm volatile ( \ |
113 | "call hypercall_page + (" STRING(id) " * 32)\n" \ |
256 | "call hypercall_page + (" STRING(id) " * 32)\n" \ |
114 | : "=a" (ret) \ |
257 | : "=a" (ret) \ |
115 | : \ |
258 | : \ |
116 | : "memory" \ |
259 | : "memory" \ |
117 | ); \ |
260 | ); \ |
118 | ret; \ |
261 | ret; \ |
119 | }) |
262 | }) |
120 | 263 | ||
121 | #define hypercall1(id, p1) \ |
264 | #define hypercall1(id, p1) \ |
122 | ({ \ |
265 | ({ \ |
123 | unative_t ret, __ign1; \ |
266 | unative_t ret, __ign1; \ |
124 | asm volatile ( \ |
267 | asm volatile ( \ |
125 | "call hypercall_page + (" STRING(id) " * 32)\n" \ |
268 | "call hypercall_page + (" STRING(id) " * 32)\n" \ |
126 | : "=a" (ret), \ |
269 | : "=a" (ret), \ |
127 | "=b" (__ign1) \ |
270 | "=b" (__ign1) \ |
128 | : "1" (p1) \ |
271 | : "1" (p1) \ |
129 | : "memory" \ |
272 | : "memory" \ |
130 | ); \ |
273 | ); \ |
131 | ret; \ |
274 | ret; \ |
132 | }) |
275 | }) |
133 | 276 | ||
134 | #define hypercall2(id, p1, p2) \ |
277 | #define hypercall2(id, p1, p2) \ |
135 | ({ \ |
278 | ({ \ |
136 | unative_t ret, __ign1, __ign2; \ |
279 | unative_t ret, __ign1, __ign2; \ |
137 | asm volatile ( \ |
280 | asm volatile ( \ |
138 | "call hypercall_page + (" STRING(id) " * 32)\n" \ |
281 | "call hypercall_page + (" STRING(id) " * 32)\n" \ |
139 | : "=a" (ret), \ |
282 | : "=a" (ret), \ |
140 | "=b" (__ign1), \ |
283 | "=b" (__ign1), \ |
141 | "=c" (__ign2) \ |
284 | "=c" (__ign2) \ |
142 | : "1" (p1), \ |
285 | : "1" (p1), \ |
143 | "2" (p2) \ |
286 | "2" (p2) \ |
144 | : "memory" \ |
287 | : "memory" \ |
145 | ); \ |
288 | ); \ |
146 | ret; \ |
289 | ret; \ |
147 | }) |
290 | }) |
148 | 291 | ||
149 | #define hypercall3(id, p1, p2, p3) \ |
292 | #define hypercall3(id, p1, p2, p3) \ |
150 | ({ \ |
293 | ({ \ |
151 | unative_t ret, __ign1, __ign2, __ign3; \ |
294 | unative_t ret, __ign1, __ign2, __ign3; \ |
152 | asm volatile ( \ |
295 | asm volatile ( \ |
153 | "call hypercall_page + (" STRING(id) " * 32)\n" \ |
296 | "call hypercall_page + (" STRING(id) " * 32)\n" \ |
154 | : "=a" (ret), \ |
297 | : "=a" (ret), \ |
155 | "=b" (__ign1), \ |
298 | "=b" (__ign1), \ |
156 | "=c" (__ign2), \ |
299 | "=c" (__ign2), \ |
157 | "=d" (__ign3) \ |
300 | "=d" (__ign3) \ |
158 | : "1" (p1), \ |
301 | : "1" (p1), \ |
159 | "2" (p2), \ |
302 | "2" (p2), \ |
160 | "3" (p3) \ |
303 | "3" (p3) \ |
161 | : "memory" \ |
304 | : "memory" \ |
162 | ); \ |
305 | ); \ |
163 | ret; \ |
306 | ret; \ |
164 | }) |
307 | }) |
165 | 308 | ||
166 | #define hypercall4(id, p1, p2, p3, p4) \ |
309 | #define hypercall4(id, p1, p2, p3, p4) \ |
167 | ({ \ |
310 | ({ \ |
168 | unative_t ret, __ign1, __ign2, __ign3, __ign4; \ |
311 | unative_t ret, __ign1, __ign2, __ign3, __ign4; \ |
169 | asm volatile ( \ |
312 | asm volatile ( \ |
170 | "call hypercall_page + (" STRING(id) " * 32)\n" \ |
313 | "call hypercall_page + (" STRING(id) " * 32)\n" \ |
171 | : "=a" (ret), \ |
314 | : "=a" (ret), \ |
172 | "=b" (__ign1), \ |
315 | "=b" (__ign1), \ |
173 | "=c" (__ign2), \ |
316 | "=c" (__ign2), \ |
174 | "=d" (__ign3), \ |
317 | "=d" (__ign3), \ |
175 | "=S" (__ign4) \ |
318 | "=S" (__ign4) \ |
176 | : "1" (p1), \ |
319 | : "1" (p1), \ |
177 | "2" (p2), \ |
320 | "2" (p2), \ |
178 | "3" (p3), \ |
321 | "3" (p3), \ |
179 | "4" (p4) \ |
322 | "4" (p4) \ |
180 | : "memory" \ |
323 | : "memory" \ |
181 | ); \ |
324 | ); \ |
182 | ret; \ |
325 | ret; \ |
183 | }) |
326 | }) |
184 | 327 | ||
185 | #define hypercall5(id, p1, p2, p3, p4, p5) \ |
328 | #define hypercall5(id, p1, p2, p3, p4, p5) \ |
186 | ({ \ |
329 | ({ \ |
187 | unative_t ret, __ign1, __ign2, __ign3, __ign4, __ign5; \ |
330 | unative_t ret, __ign1, __ign2, __ign3, __ign4, __ign5; \ |
188 | asm volatile ( \ |
331 | asm volatile ( \ |
189 | "call hypercall_page + (" STRING(id) " * 32)\n" \ |
332 | "call hypercall_page + (" STRING(id) " * 32)\n" \ |
190 | : "=a" (ret), \ |
333 | : "=a" (ret), \ |
191 | "=b" (__ign1), \ |
334 | "=b" (__ign1), \ |
192 | "=c" (__ign2), \ |
335 | "=c" (__ign2), \ |
193 | "=d" (__ign3), \ |
336 | "=d" (__ign3), \ |
194 | "=S" (__ign4), \ |
337 | "=S" (__ign4), \ |
195 | "=D" (__ign5) \ |
338 | "=D" (__ign5) \ |
196 | : "1" (p1), \ |
339 | : "1" (p1), \ |
197 | "2" (p2), \ |
340 | "2" (p2), \ |
198 | "3" (p3), \ |
341 | "3" (p3), \ |
199 | "4" (p4), \ |
342 | "4" (p4), \ |
200 | "5" (p5) \ |
343 | "5" (p5) \ |
201 | : "memory" \ |
344 | : "memory" \ |
202 | ); \ |
345 | ); \ |
203 | ret; \ |
346 | ret; \ |
204 | }) |
347 | }) |
205 | 348 | ||
206 | 349 | ||
207 | static inline int xen_console_io(const unsigned int cmd, const unsigned int count, const char *str) |
350 | static inline int xen_console_io(const unsigned int cmd, const unsigned int count, const char *str) |
208 | { |
351 | { |
209 | return hypercall3(XEN_CONSOLE_IO, cmd, count, str); |
352 | return hypercall3(XEN_CONSOLE_IO, cmd, count, str); |
210 | } |
353 | } |
211 | 354 | ||
212 | static inline int xen_set_callbacks(const unsigned int event_selector, const void *event_address, const unsigned int failsafe_selector, void *failsafe_address) |
355 | static inline int xen_set_callbacks(const unsigned int event_selector, const void *event_address, const unsigned int failsafe_selector, void *failsafe_address) |
213 | { |
356 | { |
214 | return hypercall4(XEN_SET_CALLBACKS, event_selector, event_address, failsafe_selector, failsafe_address); |
357 | return hypercall4(XEN_SET_CALLBACKS, event_selector, event_address, failsafe_selector, failsafe_address); |
215 | } |
358 | } |
216 | 359 | ||
217 | static inline int xen_set_trap_table(const trap_info_t *table) |
360 | static inline int xen_set_trap_table(const trap_info_t *table) |
218 | { |
361 | { |
219 | return hypercall1(XEN_SET_TRAP_TABLE, table); |
362 | return hypercall1(XEN_SET_TRAP_TABLE, table); |
220 | } |
363 | } |
221 | 364 | ||
222 | static inline int xen_version(const unsigned int cmd, const void *arg) |
365 | static inline int xen_version(const unsigned int cmd, const void *arg) |
223 | { |
366 | { |
224 | return hypercall2(XEN_VERSION, cmd, arg); |
367 | return hypercall2(XEN_VERSION, cmd, arg); |
225 | } |
368 | } |
226 | 369 | ||
227 | static inline int xen_notify_remote(evtchn_t channel) |
370 | static inline int xen_notify_remote(evtchn_t channel) |
228 | { |
371 | { |
229 | evtchn_op_t op; |
372 | evtchn_op_t op; |
230 | 373 | ||
231 | op.cmd = EVTCHNOP_SEND; |
374 | op.cmd = EVTCHNOP_SEND; |
232 | op.send.port = channel; |
375 | op.send.port = channel; |
233 | return hypercall1(XEN_EVENT_CHANNEL_OP, &op); |
376 | return hypercall1(XEN_EVENT_CHANNEL_OP, &op); |
234 | } |
377 | } |
235 | 378 | ||
- | 379 | #endif |
|
- | 380 | ||
236 | #endif |
381 | #endif |
237 | 382 |