Add test programs for lage page
Tests arm64 specific, contiguous bit based large pages as well. Change-Id: I09edad8cfde6c23a259f1f32cfc97974d9cb63c3
This commit is contained in:
committed by
Dominique Martinet
parent
100754f556
commit
9f7425c152
35
test/large_page/arm64/402_64K.c
Normal file
35
test/large_page/arm64/402_64K.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user