Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / include / asm-i386 / mach-xen / asm / hypercall.h
index 7de1013..2e6d1fa 100644 (file)
 #define __STR(x) #x
 #define STR(x) __STR(x)
 
+#ifdef CONFIG_XEN
+#define HYPERCALL_STR(name)                                    \
+       "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"
+#else
+#define HYPERCALL_STR(name)                                    \
+       "mov hypercall_stubs,%%eax; "                           \
+       "add $("STR(__HYPERVISOR_##name)" * 32),%%eax; "        \
+       "call *%%eax"
+#endif
+
 #define _hypercall0(type, name)                        \
 ({                                             \
        long __res;                             \
        asm volatile (                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)             \
                : "=a" (__res)                  \
                :                               \
                : "memory" );                   \
@@ -57,7 +67,7 @@
 ({                                                             \
        long __res, __ign1;                                     \
        asm volatile (                                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1)                   \
                : "1" ((long)(a1))                              \
                : "memory" );                                   \
@@ -68,7 +78,7 @@
 ({                                                             \
        long __res, __ign1, __ign2;                             \
        asm volatile (                                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1), "=c" (__ign2)    \
                : "1" ((long)(a1)), "2" ((long)(a2))            \
                : "memory" );                                   \
@@ -79,7 +89,7 @@
 ({                                                             \
        long __res, __ign1, __ign2, __ign3;                     \
        asm volatile (                                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1), "=c" (__ign2),   \
                "=d" (__ign3)                                   \
                : "1" ((long)(a1)), "2" ((long)(a2)),           \
 ({                                                             \
        long __res, __ign1, __ign2, __ign3, __ign4;             \
        asm volatile (                                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1), "=c" (__ign2),   \
                "=d" (__ign3), "=S" (__ign4)                    \
                : "1" ((long)(a1)), "2" ((long)(a2)),           \
 ({                                                             \
        long __res, __ign1, __ign2, __ign3, __ign4, __ign5;     \
        asm volatile (                                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1), "=c" (__ign2),   \
                "=d" (__ign3), "=S" (__ign4), "=D" (__ign5)     \
                : "1" ((long)(a1)), "2" ((long)(a2)),           \
@@ -354,6 +364,13 @@ HYPERVISOR_nmi_op(
        return _hypercall2(int, nmi_op, op, arg);
 }
 
+static inline unsigned long
+HYPERVISOR_hvm_op(
+    int op, void *arg)
+{
+    return _hypercall2(unsigned long, hvm_op, op, arg);
+}
+
 static inline int
 HYPERVISOR_callback_op(
        int cmd, void *arg)