ia64/xen-unstable

view linux-2.6-xen-sparse/include/asm-xen/asm-ia64/hypercall.h @ 8440:903fb46f240e

Small bug fixes
author djm@kirby.fc.hp.com
date Tue Jan 03 08:59:00 2006 -0600 (2006-01-03)
parents a08aef9f1c8e
children
line source
1 /******************************************************************************
2 * hypercall.h
3 *
4 * Linux-specific hypervisor handling.
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_H__
31 #define __HYPERCALL_H__
33 #include <asm-xen/xen-public/xen.h>
34 #include <asm-xen/xen-public/sched.h>
36 /* FIXME: temp place to hold these page related macros */
37 #include <asm/page.h>
38 #define virt_to_machine(v) __pa(v)
39 #define machine_to_virt(m) __va(m)
40 //#define virt_to_mfn(v) (__pa(v) >> 14)
41 //#define mfn_to_virt(m) (__va(m << 14))
42 #define virt_to_mfn(v) ((__pa(v)) >> PAGE_SHIFT)
43 #define mfn_to_virt(m) (__va((m) << PAGE_SHIFT))
45 /*
46 * Assembler stubs for hyper-calls.
47 */
49 #if 0
50 static inline int
51 HYPERVISOR_set_trap_table(
52 trap_info_t *table)
53 {
54 #if 0
55 int ret;
56 unsigned long ignore;
58 __asm__ __volatile__ (
59 TRAP_INSTR
60 : "=a" (ret), "=b" (ignore)
61 : "0" (__HYPERVISOR_set_trap_table), "1" (table)
62 : "memory" );
64 return ret;
65 #endif
66 return 1;
67 }
69 static inline int
70 HYPERVISOR_mmu_update(
71 mmu_update_t *req, int count, int *success_count, domid_t domid)
72 {
73 #if 0
74 int ret;
75 unsigned long ign1, ign2, ign3, ign4;
77 __asm__ __volatile__ (
78 TRAP_INSTR
79 : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
80 : "0" (__HYPERVISOR_mmu_update), "1" (req), "2" (count),
81 "3" (success_count), "4" (domid)
82 : "memory" );
84 return ret;
85 #endif
86 return 1;
87 }
89 static inline int
90 HYPERVISOR_mmuext_op(
91 struct mmuext_op *op, int count, int *success_count, domid_t domid)
92 {
93 #if 0
94 int ret;
95 unsigned long ign1, ign2, ign3, ign4;
97 __asm__ __volatile__ (
98 TRAP_INSTR
99 : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
100 : "0" (__HYPERVISOR_mmuext_op), "1" (op), "2" (count),
101 "3" (success_count), "4" (domid)
102 : "memory" );
104 return ret;
105 #endif
106 return 1;
107 }
109 static inline int
110 HYPERVISOR_set_gdt(
111 unsigned long *frame_list, int entries)
112 {
113 #if 0
114 int ret;
115 unsigned long ign1, ign2;
117 __asm__ __volatile__ (
118 TRAP_INSTR
119 : "=a" (ret), "=b" (ign1), "=c" (ign2)
120 : "0" (__HYPERVISOR_set_gdt), "1" (frame_list), "2" (entries)
121 : "memory" );
124 return ret;
125 #endif
126 return 1;
127 }
129 static inline int
130 HYPERVISOR_stack_switch(
131 unsigned long ss, unsigned long esp)
132 {
133 #if 0
134 int ret;
135 unsigned long ign1, ign2;
137 __asm__ __volatile__ (
138 TRAP_INSTR
139 : "=a" (ret), "=b" (ign1), "=c" (ign2)
140 : "0" (__HYPERVISOR_stack_switch), "1" (ss), "2" (esp)
141 : "memory" );
143 return ret;
144 #endif
145 return 1;
146 }
148 static inline int
149 HYPERVISOR_set_callbacks(
150 unsigned long event_selector, unsigned long event_address,
151 unsigned long failsafe_selector, unsigned long failsafe_address)
152 {
153 #if 0
154 int ret;
155 unsigned long ign1, ign2, ign3, ign4;
157 __asm__ __volatile__ (
158 TRAP_INSTR
159 : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
160 : "0" (__HYPERVISOR_set_callbacks), "1" (event_selector),
161 "2" (event_address), "3" (failsafe_selector), "4" (failsafe_address)
162 : "memory" );
164 return ret;
165 #endif
166 return 1;
167 }
169 static inline int
170 HYPERVISOR_fpu_taskswitch(
171 int set)
172 {
173 #if 0
174 int ret;
175 unsigned long ign;
177 __asm__ __volatile__ (
178 TRAP_INSTR
179 : "=a" (ret), "=b" (ign)
180 : "0" (__HYPERVISOR_fpu_taskswitch), "1" (set)
181 : "memory" );
183 return ret;
184 #endif
185 return 1;
186 }
188 static inline int
189 HYPERVISOR_sched_op(
190 int cmd, unsigned long arg)
191 {
192 return 1;
193 }
195 static inline int
196 HYPERVISOR_suspend(
197 unsigned long srec)
198 {
199 return 1;
200 }
202 static inline long
203 HYPERVISOR_set_timer_op(
204 u64 timeout)
205 {
206 #if 0
207 int ret;
208 unsigned long timeout_hi = (unsigned long)(timeout>>32);
209 unsigned long timeout_lo = (unsigned long)timeout;
210 unsigned long ign1, ign2;
212 __asm__ __volatile__ (
213 TRAP_INSTR
214 : "=a" (ret), "=b" (ign1), "=c" (ign2)
215 : "0" (__HYPERVISOR_set_timer_op), "b" (timeout_lo), "c" (timeout_hi)
216 : "memory");
218 return ret;
219 #endif
220 return 1;
221 }
223 static inline int
224 HYPERVISOR_dom0_op(
225 dom0_op_t *dom0_op)
226 {
227 #if 0
228 int ret;
229 unsigned long ign1;
231 dom0_op->interface_version = DOM0_INTERFACE_VERSION;
232 __asm__ __volatile__ (
233 TRAP_INSTR
234 : "=a" (ret), "=b" (ign1)
235 : "0" (__HYPERVISOR_dom0_op), "1" (dom0_op)
236 : "memory");
238 return ret;
239 #endif
240 return 1;
241 }
243 static inline int
244 HYPERVISOR_set_debugreg(
245 int reg, unsigned long value)
246 {
247 #if 0
248 int ret;
249 unsigned long ign1, ign2;
250 __asm__ __volatile__ (
251 TRAP_INSTR
252 : "=a" (ret), "=b" (ign1), "=c" (ign2)
253 : "0" (__HYPERVISOR_set_debugreg), "1" (reg), "2" (value)
254 : "memory" );
256 return ret;
257 #endif
258 return 1;
259 }
261 static inline unsigned long
262 HYPERVISOR_get_debugreg(
263 int reg)
264 {
265 #if 0
266 unsigned long ret;
267 unsigned long ign;
268 __asm__ __volatile__ (
269 TRAP_INSTR
270 : "=a" (ret), "=b" (ign)
271 : "0" (__HYPERVISOR_get_debugreg), "1" (reg)
272 : "memory" );
274 return ret;
275 #endif
276 return 1;
277 }
279 static inline int
280 HYPERVISOR_update_descriptor(
281 unsigned long ma, unsigned long word1, unsigned long word2)
282 {
283 #if 0
284 int ret;
285 unsigned long ign1, ign2, ign3;
287 __asm__ __volatile__ (
288 TRAP_INSTR
289 : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
290 : "0" (__HYPERVISOR_update_descriptor), "1" (ma), "2" (word1),
291 "3" (word2)
292 : "memory" );
294 return ret;
295 #endif
296 return 1;
297 }
299 static inline int
300 HYPERVISOR_set_fast_trap(
301 int idx)
302 {
303 #if 0
304 int ret;
305 unsigned long ign;
307 __asm__ __volatile__ (
308 TRAP_INSTR
309 : "=a" (ret), "=b" (ign)
310 : "0" (__HYPERVISOR_set_fast_trap), "1" (idx)
311 : "memory" );
313 return ret;
314 #endif
315 return 1;
316 }
318 static inline int
319 HYPERVISOR_dom_mem_op(
320 unsigned int op, unsigned long *extent_list,
321 unsigned long nr_extents, unsigned int extent_order)
322 {
323 #if 0
324 int ret;
325 unsigned long ign1, ign2, ign3, ign4, ign5;
327 __asm__ __volatile__ (
328 TRAP_INSTR
329 : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4),
330 "=D" (ign5)
331 : "0" (__HYPERVISOR_dom_mem_op), "1" (op), "2" (extent_list),
332 "3" (nr_extents), "4" (extent_order), "5" (DOMID_SELF)
333 : "memory" );
335 return ret;
336 #endif
337 return 1;
338 }
340 static inline int
341 HYPERVISOR_multicall(
342 void *call_list, int nr_calls)
343 {
344 #if 0
345 int ret;
346 unsigned long ign1, ign2;
348 __asm__ __volatile__ (
349 TRAP_INSTR
350 : "=a" (ret), "=b" (ign1), "=c" (ign2)
351 : "0" (__HYPERVISOR_multicall), "1" (call_list), "2" (nr_calls)
352 : "memory" );
354 return ret;
355 #endif
356 return 1;
357 }
358 #endif
360 static inline int
361 HYPERVISOR_update_va_mapping(
362 unsigned long va, pte_t new_val, unsigned long flags)
363 {
364 /* no-op */
365 return 1;
366 }
368 static inline int
369 HYPERVISOR_memory_op(
370 unsigned int cmd, void *arg)
371 {
372 int ret;
373 __asm__ __volatile__ ( ";; mov r14=%2 ; mov r15=%3 ; mov r2=%1 ; break 0x1000 ;; mov %0=r8 ;;"
374 : "=r" (ret)
375 : "i" (__HYPERVISOR_memory_op), "r"(cmd), "r"(arg)
376 : "r14","r15","r2","r8","memory" );
377 return ret;
378 }
380 static inline int
381 HYPERVISOR_event_channel_op(
382 void *op)
383 {
384 int ret;
385 __asm__ __volatile__ ( ";; mov r14=%2 ; mov r2=%1 ; break 0x1000 ;; mov %0=r8 ;;"
386 : "=r" (ret)
387 : "i" (__HYPERVISOR_event_channel_op), "r"(op)
388 : "r14","r2","r8","memory" );
389 return ret;
390 }
392 #if 0
393 static inline int
394 HYPERVISOR_xen_version(
395 int cmd)
396 {
397 #if 0
398 int ret;
399 unsigned long ignore;
401 __asm__ __volatile__ (
402 TRAP_INSTR
403 : "=a" (ret), "=b" (ignore)
404 : "0" (__HYPERVISOR_xen_version), "1" (cmd)
405 : "memory" );
407 return ret;
408 #endif
409 return 1;
410 }
411 #endif
413 static inline int
414 HYPERVISOR_console_io(
415 int cmd, int count, char *str)
416 {
417 int ret;
418 __asm__ __volatile__ ( ";; mov r14=%2 ; mov r15=%3 ; mov r16=%4 ; mov r2=%1 ; break 0x1000 ;; mov %0=r8 ;;"
419 : "=r" (ret)
420 : "i" (__HYPERVISOR_console_io), "r"(cmd), "r"(count), "r"(str)
421 : "r14","r15","r16","r2","r8","memory" );
422 return ret;
423 }
425 #if 0
426 static inline int
427 HYPERVISOR_physdev_op(
428 void *physdev_op)
429 {
430 #if 0
431 int ret;
432 unsigned long ign;
434 __asm__ __volatile__ (
435 TRAP_INSTR
436 : "=a" (ret), "=b" (ign)
437 : "0" (__HYPERVISOR_physdev_op), "1" (physdev_op)
438 : "memory" );
440 return ret;
441 #endif
442 return 1;
443 }
444 #endif
446 static inline int
447 HYPERVISOR_grant_table_op(
448 unsigned int cmd, void *uop, unsigned int count)
449 {
450 int ret;
451 __asm__ __volatile__ ( ";; mov r14=%2 ; mov r15=%3 ; mov r16=%4 ; mov r2=%1 ; break 0x1000 ;; mov %0=r8 ;;"
452 : "=r" (ret)
453 : "i" (__HYPERVISOR_grant_table_op), "r"(cmd), "r"(uop), "r"(count)
454 : "r14","r15","r16","r2","r8","memory" );
455 return ret;
456 }
458 #if 0
459 static inline int
460 HYPERVISOR_update_va_mapping_otherdomain(
461 unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
462 {
463 #if 0
464 int ret;
465 unsigned long ign1, ign2, ign3, ign4;
467 __asm__ __volatile__ (
468 TRAP_INSTR
469 : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
470 : "0" (__HYPERVISOR_update_va_mapping_otherdomain),
471 "1" (va), "2" ((new_val).pte_low), "3" (flags), "4" (domid) :
472 "memory" );
474 return ret;
475 #endif
476 return 1;
477 }
479 static inline int
480 HYPERVISOR_vm_assist(
481 unsigned int cmd, unsigned int type)
482 {
483 #if 0
484 int ret;
485 unsigned long ign1, ign2;
487 __asm__ __volatile__ (
488 TRAP_INSTR
489 : "=a" (ret), "=b" (ign1), "=c" (ign2)
490 : "0" (__HYPERVISOR_vm_assist), "1" (cmd), "2" (type)
491 : "memory" );
493 return ret;
494 #endif
495 return 1;
496 }
498 #endif
500 #endif /* __HYPERCALL_H__ */