summaryrefslogtreecommitdiffstats
path: root/test/access-detect_guest.c
blob: 442c88cf0c882395eedbc82b1352edeebb214046 (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 <err.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>

int
main(int argc, const char **argv)
{
	void *buf;

	buf = NULL;
	if (posix_memalign(&buf, L1_LINESIZE * L1_SETS, L1_LINESIZE * L1_SETS))
		err(1, "memalign");
	memset(buf, 0, L1_LINESIZE * L1_SETS);

	while (1) {
		CPC_CPUID_SIGNAL(CPC_CPUID_START_TRACK, 0);
		
		*(uint8_t *)(buf + L1_LINESIZE * 5) += 1;

		CPC_CPUID_SIGNAL(CPC_CPUID_START_TRACK, 0);
	}
}