diff options
Diffstat (limited to 'test')
| -rw-r--r--[-rwxr-xr-x] | test/access.c | 2 | ||||
| -rw-r--r--[-rwxr-xr-x] | test/eviction.c | 2 | ||||
| -rw-r--r--[-rwxr-xr-x] | test/kvm.c | 3 | ||||
| -rw-r--r--[-rwxr-xr-x] | test/sev-es.c | 3 | ||||
| -rw-r--r--[-rwxr-xr-x] | test/sev.c | 3 | ||||
| -rw-r--r-- | test/sevstep.c | 32 |
6 files changed, 37 insertions, 8 deletions
diff --git a/test/access.c b/test/access.c index 22e2fb8..1e38e1e 100755..100644 --- a/test/access.c +++ b/test/access.c @@ -1,4 +1,4 @@ -#include "cachepc_user.h" +#include "cachepc/uapi.h" #include <sys/ioctl.h> #include <stdlib.h> diff --git a/test/eviction.c b/test/eviction.c index e68132b..9fb57b5 100755..100644 --- a/test/eviction.c +++ b/test/eviction.c @@ -1,4 +1,4 @@ -#include "cachepc_user.h" +#include "cachepc/uapi.h" #include <sys/ioctl.h> #include <fcntl.h> diff --git a/test/kvm.c b/test/kvm.c index 42d7f5a..cd0dd4d 100755..100644 --- a/test/kvm.c +++ b/test/kvm.c @@ -1,7 +1,6 @@ -/* for CPU_ZERO macros.. */ #define _GNU_SOURCE -#include "cachepc_user.h" +#include "cachepc/uapi.h" #include <linux/kvm.h> #include <sys/syscall.h> diff --git a/test/sev-es.c b/test/sev-es.c index 17cb72c..f2a6f5c 100755..100644 --- a/test/sev-es.c +++ b/test/sev-es.c @@ -1,7 +1,6 @@ -/* for CPU_ZERO macros.. */ #define _GNU_SOURCE -#include "cachepc_user.h" +#include "cachepc/uapi.h" #include <linux/psp-sev.h> #include <linux/kvm.h> diff --git a/test/sev.c b/test/sev.c index e6da94c..73bb91f 100755..100644 --- a/test/sev.c +++ b/test/sev.c @@ -1,7 +1,6 @@ -/* for CPU_ZERO macros.. */ #define _GNU_SOURCE -#include "cachepc_user.h" +#include "cachepc/uapi.h" #include <linux/psp-sev.h> #include <linux/kvm.h> diff --git a/test/sevstep.c b/test/sevstep.c new file mode 100644 index 0000000..3ca7f03 --- /dev/null +++ b/test/sevstep.c @@ -0,0 +1,32 @@ +#include "sevstep/uapi.h" + +#include <linux/kvm.h> +#include <sys/ioctl.h> + +#include <err.h> +#include <stdlib.h> +#include <stdio.h> + +int +main(int argc, const char **argv) +{ + track_all_pages_t tracking; + int ret, fd; + + fd = open("/proc/cachepc"); + if (!fd) err(1, "open"); + + tracking.track_mode = KVM_PAGE_TRACK_ACCESS; + ret = ioctl(fd, KVM_USPT_TRACK_ALL, &tracking); + if (ret == -1) err(1, "ioctl TRACK_ALL ACCESS"); + + + tracking.track_mode = KVM_PAGE_TRACK_RESET_ACCESSED; + ret = ioctl(fd, KVM_USPT_TRACK_ALL, &tracking); + if (ret == -1) err(1, "ioctl TRACK_ALL RESET_ACCESSED"); + + ret = ioctl(fd, KVM_USPT_UNTRACK_ALL, &tracking); + if (ret == -1) err(1, "ioctl UNTRACK_ALL"); + + close(fd); +} |
