diff options
| author | Louis Burda <quent.burda@gmail.com> | 2023-01-10 01:37:23 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2023-01-10 01:38:43 +0100 |
| commit | 252b11a01e061fd17821e53a41c8451a1d2c27bd (patch) | |
| tree | e887ead2faddc8691fc13da426655a0062351cdc /util/svme.c | |
| parent | 864f5fa9d539734d823b3d0613dbf1a43beec334 (diff) | |
| download | cachepc-252b11a01e061fd17821e53a41c8451a1d2c27bd.tar.gz cachepc-252b11a01e061fd17821e53a41c8451a1d2c27bd.zip | |
Begin ioctl and test-case overhaul
Diffstat (limited to 'util/svme.c')
| -rw-r--r-- | util/svme.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/util/svme.c b/util/svme.c new file mode 100644 index 0000000..4876ac4 --- /dev/null +++ b/util/svme.c @@ -0,0 +1,25 @@ +#include "cachepc/uapi.h" + +#include <sys/ioctl.h> +#include <err.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdint.h> +#include <stdio.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 KVM_CPC_SVME_READ"); + + printf("%u\n", svme); + + close(kvm_fd); +} |
