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
41
test/large_page/arm64/504_4K.c
Normal file
41
test/large_page/arm64/504_4K.c
Normal file
@ -0,0 +1,41 @@
|
||||
#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 30
|
||||
#define TARGET_PAGE_SIZE (1UL << TARGET_PAGE_SHIFT)
|
||||
|
||||
/* .data */
|
||||
char addr_data[TARGET_PAGE_SIZE] = { 1 };
|
||||
|
||||
/* .bss */
|
||||
char addr_bss[TARGET_PAGE_SIZE];
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int trial_num = 0;
|
||||
|
||||
/* .data */
|
||||
addr_data[0] = 'z';
|
||||
NG(__atomic_load_n(addr_data, __ATOMIC_SEQ_CST) == 'z',
|
||||
"memory access failed\n");
|
||||
printf("large page request, trial#: %03d, addr: %016lx, size: %ld\n",
|
||||
trial_num++, (unsigned long)addr_data, TARGET_PAGE_SIZE);
|
||||
|
||||
/* .bss */
|
||||
addr_bss[0] = 'z';
|
||||
NG(__atomic_load_n(addr_bss, __ATOMIC_SEQ_CST) == 'z',
|
||||
"memory access failed\n");
|
||||
printf("large page request, trial#: %03d, addr: %016lx, size: %ld\n",
|
||||
trial_num++, (unsigned long)addr_bss, TARGET_PAGE_SIZE);
|
||||
|
||||
return 0;
|
||||
fn_fail:
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user