aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-12-02 16:28:28 +0200
committerAvi Kivity <avi@qumranet.com>2007-12-02 16:28:28 +0200
commitb3ca91bbac6654402786f332daad7026d5073865 (patch)
tree67fea8431d0d7aa7bfba8b2a7632dccdda55e277
parent1b4250cc4cc54afd7a9425cf9ded146880fe6488 (diff)
kvm: testsuite: add hypercall test
-rw-r--r--kvm/user/config-x86-common.mak2
-rw-r--r--kvm/user/config-x86_64.mak3
-rw-r--r--kvm/user/test/x86/hypercall.c19
3 files changed, 23 insertions, 1 deletions
diff --git a/kvm/user/config-x86-common.mak b/kvm/user/config-x86-common.mak
index 825507e19..b09f9bfa5 100644
--- a/kvm/user/config-x86-common.mak
+++ b/kvm/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/kvm/user/config-x86_64.mak b/kvm/user/config-x86_64.mak
index bbe8ecbcd..9f37e6f41 100644
--- a/kvm/user/config-x86_64.mak
+++ b/kvm/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/kvm/user/test/x86/hypercall.c b/kvm/user/test/x86/hypercall.c
new file mode 100644
index 000000000..1a51b6daa
--- /dev/null
+++ b/kvm/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;
+}