direct-io.hg

view extras/mini-os/include/hypercall-x86_32.h @ 10690:77fe42f6442b

[IA64] Fix the ia64 build.
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author kfraser@localhost.localdomain
date Fri Jul 14 10:49:05 2006 +0100 (2006-07-14)
parents 323d40eefbce
children
line source
1 /******************************************************************************
2 * hypercall-x86_32.h
3 *
4 * Copied from XenLinux.
5 *
6 * Copyright (c) 2002-2004, K A Fraser
7 *
8 * This file may be distributed separately from the Linux kernel, or
9 * incorporated into other software packages, subject to the following license:
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this source file (the "Software"), to deal in the Software without
13 * restriction, including without limitation the rights to use, copy, modify,
14 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
15 * and to permit persons to whom the Software is furnished to do so, subject to
16 * the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
27 * IN THE SOFTWARE.
28 */
30 #ifndef __HYPERCALL_X86_32_H__
31 #define __HYPERCALL_X86_32_H__
33 #include <xen/xen.h>
34 #include <xen/sched.h>
35 #include <xen/nmi.h>
36 #include <mm.h>
38 #define __STR(x) #x
39 #define STR(x) __STR(x)
41 extern char hypercall_page[PAGE_SIZE];
43 #define _hypercall0(type, name) \
44 ({ \
45 long __res; \
46 asm volatile ( \
47 "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
48 : "=a" (__res) \
49 : \
50 : "memory" ); \
51 (type)__res; \
52 })
54 #define _hypercall1(type, name, a1) \
55 ({ \
56 long __res, __ign1; \
57 asm volatile ( \
58 "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
59 : "=a" (__res), "=b" (__ign1) \
60 : "1" ((long)(a1)) \
61 : "memory" ); \
62 (type)__res; \
63 })
65 #define _hypercall2(type, name, a1, a2) \
66 ({ \
67 long __res, __ign1, __ign2; \
68 asm volatile ( \
69 "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
70 : "=a" (__res), "=b" (__ign1), "=c" (__ign2) \
71 : "1" ((long)(a1)), "2" ((long)(a2)) \
72 : "memory" ); \
73 (type)__res; \
74 })
76 #define _hypercall3(type, name, a1, a2, a3) \
77 ({ \
78 long __res, __ign1, __ign2, __ign3; \
79 asm volatile ( \
80 "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
81 : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
82 "=d" (__ign3) \
83 : "1" ((long)(a1)), "2" ((long)(a2)), \
84 "3" ((long)(a3)) \
85 : "memory" ); \
86 (type)__res; \
87 })
89 #define _hypercall4(type, name, a1, a2, a3, a4) \
90 ({ \
91 long __res, __ign1, __ign2, __ign3, __ign4; \
92 asm volatile ( \
93 "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
94 : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
95 "=d" (__ign3), "=S" (__ign4) \
96 : "1" ((long)(a1)), "2" ((long)(a2)), \
97 "3" ((long)(a3)), "4" ((long)(a4)) \
98 : "memory" ); \
99 (type)__res; \
100 })
102 #define _hypercall5(type, name, a1, a2, a3, a4, a5) \
103 ({ \
104 long __res, __ign1, __ign2, __ign3, __ign4, __ign5; \
105 asm volatile ( \
106 "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
107 : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
108 "=d" (__ign3), "=S" (__ign4), "=D" (__ign5) \
109 : "1" ((long)(a1)), "2" ((long)(a2)), \
110 "3" ((long)(a3)), "4" ((long)(a4)), \
111 "5" ((long)(a5)) \
112 : "memory" ); \
113 (type)__res; \
114 })
116 static inline int
117 HYPERVISOR_set_trap_table(
118 trap_info_t *table)
119 {
120 return _hypercall1(int, set_trap_table, table);
121 }
123 static inline int
124 HYPERVISOR_mmu_update(
125 mmu_update_t *req, int count, int *success_count, domid_t domid)
126 {
127 return _hypercall4(int, mmu_update, req, count, success_count, domid);
128 }
130 static inline int
131 HYPERVISOR_mmuext_op(
132 struct mmuext_op *op, int count, int *success_count, domid_t domid)
133 {
134 return _hypercall4(int, mmuext_op, op, count, success_count, domid);
135 }
137 static inline int
138 HYPERVISOR_set_gdt(
139 unsigned long *frame_list, int entries)
140 {
141 return _hypercall2(int, set_gdt, frame_list, entries);
142 }
144 static inline int
145 HYPERVISOR_stack_switch(
146 unsigned long ss, unsigned long esp)
147 {
148 return _hypercall2(int, stack_switch, ss, esp);
149 }
151 static inline int
152 HYPERVISOR_set_callbacks(
153 unsigned long event_selector, unsigned long event_address,
154 unsigned long failsafe_selector, unsigned long failsafe_address)
155 {
156 return _hypercall4(int, set_callbacks,
157 event_selector, event_address,
158 failsafe_selector, failsafe_address);
159 }
161 static inline int
162 HYPERVISOR_fpu_taskswitch(
163 int set)
164 {
165 return _hypercall1(int, fpu_taskswitch, set);
166 }
168 static inline int
169 HYPERVISOR_sched_op(
170 int cmd, unsigned long arg)
171 {
172 return _hypercall2(int, sched_op, cmd, arg);
173 }
175 static inline long
176 HYPERVISOR_set_timer_op(
177 u64 timeout)
178 {
179 unsigned long timeout_hi = (unsigned long)(timeout>>32);
180 unsigned long timeout_lo = (unsigned long)timeout;
181 return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
182 }
184 static inline int
185 HYPERVISOR_dom0_op(
186 dom0_op_t *dom0_op)
187 {
188 dom0_op->interface_version = DOM0_INTERFACE_VERSION;
189 return _hypercall1(int, dom0_op, dom0_op);
190 }
192 static inline int
193 HYPERVISOR_set_debugreg(
194 int reg, unsigned long value)
195 {
196 return _hypercall2(int, set_debugreg, reg, value);
197 }
199 static inline unsigned long
200 HYPERVISOR_get_debugreg(
201 int reg)
202 {
203 return _hypercall1(unsigned long, get_debugreg, reg);
204 }
206 static inline int
207 HYPERVISOR_update_descriptor(
208 u64 ma, u64 desc)
209 {
210 return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32);
211 }
213 static inline int
214 HYPERVISOR_memory_op(
215 unsigned int cmd, void *arg)
216 {
217 return _hypercall2(int, memory_op, cmd, arg);
218 }
220 static inline int
221 HYPERVISOR_multicall(
222 void *call_list, int nr_calls)
223 {
224 return _hypercall2(int, multicall, call_list, nr_calls);
225 }
227 static inline int
228 HYPERVISOR_update_va_mapping(
229 unsigned long va, pte_t new_val, unsigned long flags)
230 {
231 unsigned long pte_hi = 0;
232 #ifdef CONFIG_X86_PAE
233 pte_hi = new_val.pte_high;
234 #endif
235 return _hypercall4(int, update_va_mapping, va,
236 new_val.pte_low, pte_hi, flags);
237 }
239 static inline int
240 HYPERVISOR_event_channel_op(
241 void *op)
242 {
243 return _hypercall1(int, event_channel_op, op);
244 }
246 static inline int
247 HYPERVISOR_xen_version(
248 int cmd, void *arg)
249 {
250 return _hypercall2(int, xen_version, cmd, arg);
251 }
253 static inline int
254 HYPERVISOR_console_io(
255 int cmd, int count, char *str)
256 {
257 return _hypercall3(int, console_io, cmd, count, str);
258 }
260 static inline int
261 HYPERVISOR_physdev_op(
262 void *physdev_op)
263 {
264 return _hypercall1(int, physdev_op, physdev_op);
265 }
267 static inline int
268 HYPERVISOR_grant_table_op(
269 unsigned int cmd, void *uop, unsigned int count)
270 {
271 return _hypercall3(int, grant_table_op, cmd, uop, count);
272 }
274 static inline int
275 HYPERVISOR_update_va_mapping_otherdomain(
276 unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
277 {
278 unsigned long pte_hi = 0;
279 #ifdef CONFIG_X86_PAE
280 pte_hi = new_val.pte_high;
281 #endif
282 return _hypercall5(int, update_va_mapping_otherdomain, va,
283 new_val.pte_low, pte_hi, flags, domid);
284 }
286 static inline int
287 HYPERVISOR_vm_assist(
288 unsigned int cmd, unsigned int type)
289 {
290 return _hypercall2(int, vm_assist, cmd, type);
291 }
293 static inline int
294 HYPERVISOR_vcpu_op(
295 int cmd, int vcpuid, void *extra_args)
296 {
297 return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
298 }
300 static inline int
301 HYPERVISOR_suspend(
302 unsigned long srec)
303 {
304 return _hypercall3(int, sched_op, SCHEDOP_shutdown,
305 SHUTDOWN_suspend, srec);
306 }
308 static inline int
309 HYPERVISOR_nmi_op(
310 unsigned long op,
311 unsigned long arg)
312 {
313 return _hypercall2(int, nmi_op, op, arg);
314 }
316 #endif /* __HYPERCALL_X86_32_H__ */
318 /*
319 * Local variables:
320 * c-file-style: "linux"
321 * indent-tabs-mode: t
322 * c-indent-level: 8
323 * c-basic-offset: 8
324 * tab-width: 8
325 * End:
326 */