blob: 1e38e1e2dea1a68f6ad8052b260b60b06004e402 (
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
27
28
29
30
|
#include "cachepc/uapi.h"
#include <sys/ioctl.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <stdint.h>
#include <err.h>
#include <fcntl.h>
#include <unistd.h>
int
main(int argc, const char **argv)
{
uint32_t arg;
int fd, ret;
size_t i;
fd = open("/proc/cachepc", O_RDONLY);
if (fd < 0) err(1, "open");
for (i = 0; i < 50; i++) {
arg = 48; /* target set */
ret = ioctl(fd, CACHEPC_IOCTL_TEST_ACCESS, &arg);
if (ret == -1) err(1, "ioctl fail");
printf("%i\n", arg);
}
close(fd);
}
|