Merge branch 'qemu-cvs'
[kvm-userspace.git] / user / test / x86 / hypercall.c
blob95120a23bc5b983587cb0940502d371883683cd4
1 #include "libcflat.h"
3 #define KVM_HYPERCALL_INTEL ".byte 0x0f,0x01,0xc1"
4 #define KVM_HYPERCALL_AMD ".byte 0x0f,0x01,0xd9"
6 static inline long kvm_hypercall0_intel(unsigned int nr)
8 long ret;
9 asm volatile(KVM_HYPERCALL_INTEL
10 : "=a"(ret)
11 : "a"(nr));
12 return ret;
15 static inline long kvm_hypercall0_amd(unsigned int nr)
17 long ret;
18 asm volatile(KVM_HYPERCALL_AMD
19 : "=a"(ret)
20 : "a"(nr));
21 return ret;
24 int main(int ac, char **av)
26 kvm_hypercall0_intel(-1u);
27 printf("Hypercall via VMCALL: OK\n");
28 kvm_hypercall0_amd(-1u);
29 printf("Hypercall via VMMCALL: OK\n");
30 return 0;