0001
0002
0003
0004
0005
0006 #include <stdio.h>
0007 #include <stdlib.h>
0008 #include <string.h>
0009 #include <sys/mman.h>
0010 #include <unistd.h>
0011
0012 #include <asm/cputable.h>
0013
0014 #include "utils.h"
0015
0016 #define SIZE (64 * 1024)
0017
0018 int test_prot_sao(void)
0019 {
0020 char *p;
0021
0022
0023
0024
0025
0026 SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06) ||
0027 have_hwcap2(PPC_FEATURE2_ARCH_3_1) ||
0028 access("/proc/device-tree/rtas/ibm,hypertas-functions", F_OK) == 0);
0029
0030
0031
0032
0033
0034
0035 p = mmap(NULL, SIZE, PROT_READ | PROT_WRITE | PROT_SAO,
0036 MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
0037 FAIL_IF(p == MAP_FAILED);
0038
0039
0040 memset(p, 0xaa, SIZE);
0041
0042 return 0;
0043 }
0044
0045 int main(void)
0046 {
0047 return test_harness(test_prot_sao, "prot-sao");
0048 }