summaryrefslogtreecommitdiffstats
path: root/test/readsvme.c
blob: 4386e8973bd14f86136c11aaf012365d449e780f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
}