repository: /home/avi/kvm
branch: master
commit f633638dcf71f5fbc1c1c2d9949b1a3274773b5e
Author: Avi Kivity <[EMAIL PROTECTED]>
Date:   Sun Dec 2 16:28:28 2007 +0200

    kvm: testsuite: add hypercall test

diff --git a/user/config-x86-common.mak b/user/config-x86-common.mak
index 825507e..b09f9bf 100644
--- a/user/config-x86-common.mak
+++ b/user/config-x86-common.mak
@@ -21,6 +21,8 @@ $(TEST_DIR)/irq.flat: $(TEST_DIR)/print.o
  
 $(TEST_DIR)/access.flat: $(cstart.o) $(TEST_DIR)/access.o $(TEST_DIR)/print.o
  
+$(TEST_DIR)/hypercall.flat: $(cstart.o) $(TEST_DIR)/hypercall.o 
$(TEST_DIR)/print.o
+ 
 $(TEST_DIR)/sieve.flat: $(cstart.o) $(TEST_DIR)/sieve.o \
                $(TEST_DIR)/print.o $(TEST_DIR)/vm.o
  
diff --git a/user/config-x86_64.mak b/user/config-x86_64.mak
index bbe8ecb..9f37e6f 100644
--- a/user/config-x86_64.mak
+++ b/user/config-x86_64.mak
@@ -8,6 +8,7 @@ CFLAGS += -I $(KERNELDIR)/include
 
 tests = $(TEST_DIR)/access.flat $(TEST_DIR)/irq.flat $(TEST_DIR)/sieve.flat \
       $(TEST_DIR)/simple.flat $(TEST_DIR)/stringio.flat \
-      $(TEST_DIR)/memtest1.flat $(TEST_DIR)/emulator.flat
+      $(TEST_DIR)/memtest1.flat $(TEST_DIR)/emulator.flat \
+      $(TEST_DIR)/hypercall.flat
 
 include config-x86-common.mak
diff --git a/user/test/x86/hypercall.c b/user/test/x86/hypercall.c
new file mode 100644
index 0000000..1a51b6d
--- /dev/null
+++ b/user/test/x86/hypercall.c
@@ -0,0 +1,19 @@
+#include "printf.h"
+
+#define KVM_HYPERCALL ".byte 0x0f,0x01,0xc1"
+
+static inline long kvm_hypercall0(unsigned int nr)
+{
+       long ret;
+       asm volatile(KVM_HYPERCALL
+                    : "=a"(ret)
+                    : "a"(nr));
+       return ret;
+}
+
+int main(int ac, char **av)
+{
+       kvm_hypercall0(-1u);
+       printf("Hypercall: OK\n");
+       return 0;
+}

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
kvm-commits mailing list
kvm-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-commits

Reply via email to