diff options
| author | Louis Burda <quent.burda@gmail.com> | 2022-11-22 15:34:51 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2022-11-22 15:34:51 +0100 |
| commit | d16af2b7f9b0026e2776237dd0ea673d88531e7d (patch) | |
| tree | 88798e8f50da95ffb0673b4b351d706816b93ecc /test | |
| parent | 82d56ef77c114ac0b375fef04cea3a50f10f1843 (diff) | |
| download | cachepc-d16af2b7f9b0026e2776237dd0ea673d88531e7d.tar.gz cachepc-d16af2b7f9b0026e2776237dd0ea673d88531e7d.zip | |
Add program to verify SVME bit is set during VMRUN
Diffstat (limited to 'test')
| -rwxr-xr-x | test/.gitignore | 1 | ||||
| -rw-r--r-- | test/readsvme.c | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/test/.gitignore b/test/.gitignore index f54caf0..cf12911 100755 --- a/test/.gitignore +++ b/test/.gitignore @@ -9,3 +9,4 @@ aes-detect_guest aes-detect_host access-detect_guest access-detect_host +readsvme 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); +} |
