direct-io.hg

view extras/mini-os/include/hypercall-x86_64.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_64.h
3 *
4 * Copied from XenLinux.
5 *
6 * Copyright (c) 2002-2004, K A Fraser
7 *
8 * 64-bit updates:
9 * Benjamin Liu <benjamin.liu@intel.com>
10 * Jun Nakajima <jun.nakajima@intel.com>
11 *
12 * This file may be distributed separately from the Linux kernel, or
13 * incorporated into other software packages, subject to the following license:
14 *
15 * Permission is hereby granted, free of charge, to any person obtaining a copy
16 * of this source file (the "Software"), to deal in the Software without
17 * restriction, including without limitation the rights to use, copy, modify,
18 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
19 * and to permit persons to whom the Software is furnished to do so, subject to
20 * the following conditions:
21 *
22 * The above copyright notice and this permission notice shall be included in
23 * all copies or substantial portions of the Software.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
31 * IN THE SOFTWARE.
32 */
34 #ifndef __HYPERCALL_X86_64_H__
35 #define __HYPERCALL_X86_64_H__
37 #include <xen/xen.h>
38 #include <xen/sched.h>
39 #include <mm.h>
41 #define __STR(x) #x
42 #define STR(x) __STR(x)
44 extern char hypercall_page[PAGE_SIZE];
46 #define _hypercall0(type, name) \
47 ({ \
48 long __res; \
49 asm volatile ( \
50 "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
51 : "=a" (__res) \
52 : \
53 : "memory" ); \
54 (type)__res; \
55 })
57 #define _hypercall1(type, name, a1) \
58 ({ \
59 long __res, __ign1; \
60 asm volatile ( \
61 "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
62 : "=a" (__res), "=D" (__ign1) \
63 : "1" ((long)(a1)) \
64 : "memory" ); \
65 (type)__res; \
66 })
68 #define _hypercall2(type, name, a1, a2) \
69 ({ \
70 long __res, __ign1, __ign2; \
71 asm volatile ( \
72 "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
73 : "=a" (__res), "=D" (__ign1), "=S" (__ign2) \
74 : "1" ((long)(a1)), "2" ((long)(a2)) \
75 : "memory" ); \
76 (type)__res; \
77 })
79 #define _hypercall3(type, name, a1, a2, a3) \
80 ({ \
81 long __res, __ign1, __ign2, __ign3; \
82 asm volatile ( \
83 "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
84 : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \
85 "=d" (__ign3) \
86 : "1" ((long)(a1)), "2" ((long)(a2)), \
87 "3" ((long)(a3)) \
88 : "memory" ); \
89 (type)__res; \
90 })
92 #define _hypercall4(type, name, a1, a2, a3, a4) \
93 ({ \
94 long __res, __ign1, __ign2, __ign3; \
95 asm volatile ( \
96 "movq %7,%%r10; " \
97 "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
98 : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \
99 "=d" (__ign3) \
100 : "1" ((long)(a1)), "2" ((long)(a2)), \
101 "3" ((long)(a3)), "g" ((long)(a4)) \
102 : "memory", "r10" ); \
103 (type)__res; \
104 })
106 #define _hypercall5(type, name, a1, a2, a3, a4, a5) \
107 ({ \
108 long __res, __ign1, __ign2, __ign3; \
109 asm volatile ( \
110 "movq %7,%%r10; movq %8,%%r8; " \
111 "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
112 : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \
113 "=d" (__ign3) \
114 : "1" ((long)(a1)), "2" ((long)(a2)), \
115 "3" ((long)(a3)), "g" ((long)(a4)), \
116 "g" ((long)(a5)) \
117 : "memory", "r10", "r8" ); \
118 (type)__res; \
119 })
121 static inline int
122 HYPERVISOR_set_trap_table(
123 trap_info_t *table)
124 {
125 return _hypercall1(int, set_trap_table, table);
126 }
128 static inline int
129 HYPERVISOR_mmu_update(
130 mmu_update_t *req, int count, int *success_count, domid_t domid)
131 {
132 return _hypercall4(int, mmu_update, req, count, success_count, domid);
133 }
135 static inline int
136 HYPERVISOR_mmuext_op(
137 struct mmuext_op *op, int count, int *success_count, domid_t domid)
138 {
139 return _hypercall4(int, mmuext_op, op, count, success_count, domid);
140 }
142 static inline int
143 HYPERVISOR_set_gdt(
144 unsigned long *frame_list, int entries)
145 {
146 return _hypercall2(int, set_gdt, frame_list, entries);
147 }
149 static inline int
150 HYPERVISOR_stack_switch(
151 unsigned long ss, unsigned long esp)
152 {
153 return _hypercall2(int, stack_switch, ss, esp);
154 }
156 static inline int
157 HYPERVISOR_set_callbacks(
158 unsigned long event_address, unsigned long failsafe_address,
159 unsigned long syscall_address)
160 {
161 return _hypercall3(int, set_callbacks,
162 event_address, failsafe_address, syscall_address);
163 }
165 static inline int
166 HYPERVISOR_fpu_taskswitch(
167 int set)
168 {
169 return _hypercall1(int, fpu_taskswitch, set);
170 }
172 static inline int
173 HYPERVISOR_sched_op(
174 int cmd, unsigned long arg)
175 {
176 return _hypercall2(int, sched_op, cmd, arg);
177 }
179 static inline long
180 HYPERVISOR_set_timer_op(
181 u64 timeout)
182 {
183 return _hypercall1(long, set_timer_op, timeout);
184 }
186 static inline int
187 HYPERVISOR_dom0_op(
188 dom0_op_t *dom0_op)
189 {
190 dom0_op->interface_version = DOM0_INTERFACE_VERSION;
191 return _hypercall1(int, dom0_op, dom0_op);
192 }
194 static inline int
195 HYPERVISOR_set_debugreg(
196 int reg, unsigned long value)
197 {
198 return _hypercall2(int, set_debugreg, reg, value);
199 }
201 static inline unsigned long
202 HYPERVISOR_get_debugreg(
203 int reg)
204 {
205 return _hypercall1(unsigned long, get_debugreg, reg);
206 }
208 static inline int
209 HYPERVISOR_update_descriptor(
210 unsigned long ma, unsigned long word)
211 {
212 return _hypercall2(int, update_descriptor, ma, word);
213 }
215 static inline int
216 HYPERVISOR_memory_op(
217 unsigned int cmd, void *arg)
218 {
219 return _hypercall2(int, memory_op, cmd, arg);
220 }
222 static inline int
223 HYPERVISOR_multicall(
224 void *call_list, int nr_calls)
225 {
226 return _hypercall2(int, multicall, call_list, nr_calls);
227 }
229 static inline int
230 HYPERVISOR_update_va_mapping(
231 unsigned long va, pte_t new_val, unsigned long flags)
232 {
233 return _hypercall3(int, update_va_mapping, va, new_val.pte, flags);
234 }
236 static inline int
237 HYPERVISOR_event_channel_op(
238 void *op)
239 {
240 return _hypercall1(int, event_channel_op, op);
241 }
243 static inline int
244 HYPERVISOR_xen_version(
245 int cmd, void *arg)
246 {
247 return _hypercall2(int, xen_version, cmd, arg);
248 }
250 static inline int
251 HYPERVISOR_console_io(
252 int cmd, int count, char *str)
253 {
254 return _hypercall3(int, console_io, cmd, count, str);
255 }
257 static inline int
258 HYPERVISOR_physdev_op(
259 void *physdev_op)
260 {
261 return _hypercall1(int, physdev_op, physdev_op);
262 }
264 static inline int
265 HYPERVISOR_grant_table_op(
266 unsigned int cmd, void *uop, unsigned int count)
267 {
268 return _hypercall3(int, grant_table_op, cmd, uop, count);
269 }
271 static inline int
272 HYPERVISOR_update_va_mapping_otherdomain(
273 unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
274 {
275 return _hypercall4(int, update_va_mapping_otherdomain, va,
276 new_val.pte, flags, domid);
277 }
279 static inline int
280 HYPERVISOR_vm_assist(
281 unsigned int cmd, unsigned int type)
282 {
283 return _hypercall2(int, vm_assist, cmd, type);
284 }
286 static inline int
287 HYPERVISOR_vcpu_op(
288 int cmd, int vcpuid, void *extra_args)
289 {
290 return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
291 }
293 static inline int
294 HYPERVISOR_set_segment_base(
295 int reg, unsigned long value)
296 {
297 return _hypercall2(int, set_segment_base, reg, value);
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_64_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 */