Add test programs for lage page

Tests arm64 specific, contiguous bit based large pages as well.

Change-Id: I09edad8cfde6c23a259f1f32cfc97974d9cb63c3
This commit is contained in:
Masamichi Takagi
2018-12-07 19:28:51 +09:00
committed by Dominique Martinet
parent 100754f556
commit 9f7425c152
86 changed files with 5024 additions and 0 deletions

View File

@ -0,0 +1,35 @@
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/wait.h>
#include <sys/mman.h>
#include <sys/shm.h>
#include "../util.h"
#define TARGET_PAGE_SHIFT 29
#define TARGET_PAGE_SIZE (1UL << TARGET_PAGE_SHIFT)
int main(int argc, char **argv)
{
char *addr_brk;
int trial_num = 0;
/* Assuming heap size starts from zero and
* incremented by the amount specified with mcexec -h
*/
addr_brk = sbrk(TARGET_PAGE_SIZE);
NG(addr_brk != (void *)-1, "sbrk failed\n");
addr_brk[0] = 'z';
NG(__atomic_load_n(addr_brk, __ATOMIC_SEQ_CST) == 'z',
"memory access failed\n");
printf("large page request, trial#: %03d, addr: %016lx, size: %ld\n",
trial_num++, (unsigned long)addr_brk, TARGET_PAGE_SIZE);
return 0;
fn_fail:
return 1;
}