1
2
3
4
5
6#include <stdio.h>
7#include <stdlib.h>
8#include <string.h>
9#include <sys/mman.h>
10#include <unistd.h>
11
12#include <asm/cputable.h>
13
14#include "utils.h"
15
16#define SIZE (64 * 1024)
17
18int test_prot_sao(void)
19{
20 char *p;
21
22
23
24
25
26 SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06) ||
27 have_hwcap2(PPC_FEATURE2_ARCH_3_1) ||
28 access("/proc/device-tree/rtas/ibm,hypertas-functions", F_OK) == 0);
29
30
31
32
33
34
35 p = mmap(NULL, SIZE, PROT_READ | PROT_WRITE | PROT_SAO,
36 MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
37 FAIL_IF(p == MAP_FAILED);
38
39
40 memset(p, 0xaa, SIZE);
41
42 return 0;
43}
44
45int main(void)
46{
47 return test_harness(test_prot_sao, "prot-sao");
48}
49