summaryrefslogtreecommitdiffstats
path: root/test/readsvme.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/readsvme.c')
-rw-r--r--test/readsvme.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/readsvme.c b/test/readsvme.c
new file mode 100644
index 0000000..4386e89
--- /dev/null
+++ b/test/readsvme.c
@@ -0,0 +1,26 @@
+#include "cachepc/uapi.h"
+
+#include <sys/ioctl.h>
+#include <err.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(int argc, const char **argv)
+{
+ uint32_t svme;
+ int kvm_fd;
+
+ kvm_fd = open("/dev/kvm", O_RDWR);
+ if (kvm_fd < 0) err(1, "open /dev/kvm");
+
+ if (ioctl(kvm_fd, KVM_CPC_SVME_READ, &svme))
+ err(1, "ioctl SVME_READ");
+
+ printf("%u\n", svme);
+
+ close(kvm_fd);
+}