ia64/xen-unstable

view xen/include/asm-x86/multicall.h @ 13301:c2a82e026497

Enable compatibility mode operation for HYPERVISOR_multicall.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Emmanuel Ackaouy <ack@xensource.com>
date Fri Jan 05 17:34:34 2007 +0000 (2007-01-05)
parents eee52c100996
children 96f167771979
line source
1 /******************************************************************************
2 * asm-x86/multicall.h
3 */
5 #ifndef __ASM_X86_MULTICALL_H__
6 #define __ASM_X86_MULTICALL_H__
8 #include <xen/errno.h>
9 #include <asm/asm_defns.h>
11 #ifdef __x86_64__
13 #define do_multicall_call(_call) \
14 do { \
15 __asm__ __volatile__ ( \
16 " movq "STR(MULTICALL_op)"(%0),%%rax; " \
17 " cmpq $("STR(NR_hypercalls)"),%%rax; " \
18 " jae 2f; " \
19 " leaq hypercall_table(%%rip),%%rdi; " \
20 " leaq (%%rdi,%%rax,8),%%rax; " \
21 " movq "STR(MULTICALL_arg0)"(%0),%%rdi; " \
22 " movq "STR(MULTICALL_arg1)"(%0),%%rsi; " \
23 " movq "STR(MULTICALL_arg2)"(%0),%%rdx; " \
24 " movq "STR(MULTICALL_arg3)"(%0),%%rcx; " \
25 " movq "STR(MULTICALL_arg4)"(%0),%%r8; " \
26 " callq *(%%rax); " \
27 "1: movq %%rax,"STR(MULTICALL_result)"(%0)\n" \
28 ".section .fixup,\"ax\"\n" \
29 "2: movq $-"STR(ENOSYS)",%%rax\n" \
30 " jmp 1b\n" \
31 ".previous\n" \
32 : : "b" (_call) \
33 /* all the caller-saves registers */ \
34 : "rax", "rcx", "rdx", "rsi", "rdi", \
35 "r8", "r9", "r10", "r11" ); \
36 } while ( 0 )
38 #define compat_multicall_call(_call) \
39 do { \
40 __asm__ __volatile__ ( \
41 " movl "STR(COMPAT_MULTICALL_op)"(%0),%%eax; " \
42 " leaq compat_hypercall_table(%%rip),%%rdi; " \
43 " cmpl $("STR(NR_hypercalls)"),%%eax; " \
44 " jae 2f; " \
45 " movq (%%rdi,%%rax,8),%%rax; " \
46 " movl "STR(COMPAT_MULTICALL_arg0)"(%0),%%edi; " \
47 " movl "STR(COMPAT_MULTICALL_arg1)"(%0),%%esi; " \
48 " movl "STR(COMPAT_MULTICALL_arg2)"(%0),%%edx; " \
49 " movl "STR(COMPAT_MULTICALL_arg3)"(%0),%%ecx; " \
50 " movl "STR(COMPAT_MULTICALL_arg4)"(%0),%%r8d; " \
51 " callq *%%rax; " \
52 "1: movl %%eax,"STR(COMPAT_MULTICALL_result)"(%0)\n"\
53 ".section .fixup,\"ax\"\n" \
54 "2: movl $-"STR(ENOSYS)",%%eax\n" \
55 " jmp 1b\n" \
56 ".previous\n" \
57 : : "b" (_call) \
58 /* all the caller-saves registers */ \
59 : "rax", "rcx", "rdx", "rsi", "rdi", \
60 "r8", "r9", "r10", "r11" ); \
61 } while ( 0 )
63 #else
65 #define do_multicall_call(_call) \
66 do { \
67 __asm__ __volatile__ ( \
68 " pushl "STR(MULTICALL_arg4)"(%0); " \
69 " pushl "STR(MULTICALL_arg3)"(%0); " \
70 " pushl "STR(MULTICALL_arg2)"(%0); " \
71 " pushl "STR(MULTICALL_arg1)"(%0); " \
72 " pushl "STR(MULTICALL_arg0)"(%0); " \
73 " movl "STR(MULTICALL_op)"(%0),%%eax; " \
74 " cmpl $("STR(NR_hypercalls)"),%%eax; " \
75 " jae 2f; " \
76 " call *hypercall_table(,%%eax,4); " \
77 "1: movl %%eax,"STR(MULTICALL_result)"(%0); " \
78 " addl $20,%%esp\n" \
79 ".section .fixup,\"ax\"\n" \
80 "2: movl $-"STR(ENOSYS)",%%eax\n" \
81 " jmp 1b\n" \
82 ".previous\n" \
83 : : "b" (_call) \
84 /* all the caller-saves registers */ \
85 : "eax", "ecx", "edx" ); \
86 } while ( 0 )
88 #endif
90 #endif /* __ASM_X86_MULTICALL_H__ */