Go to the documentation of this file.
18 #define LENGTH (256UL*1024*1024)
19 #define PROTECTION (PROT_READ | PROT_WRITE)
22 #define MAP_HUGETLB 0x40000
27 #define ADDR (void *)(0x8000000000000000UL)
28 #define FLAGS (MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_FIXED)
30 #define ADDR (void *)(0x0UL)
31 #define FLAGS (MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB)
36 printf(
"First hex is %x\n", *((
unsigned int *)addr));
39 static void write_bytes(
char *
addr)
43 for (i = 0; i <
LENGTH; i++)
44 *(addr + i) = (
char)i;
47 static int read_bytes(
char *addr)
52 for (i = 0; i <
LENGTH; i++)
53 if (*(addr + i) != (
char)i) {
54 printf(
"Mismatch at %lu\n", i);
66 if (addr == MAP_FAILED) {
71 printf(
"Returned address is %p\n", addr);
74 ret = read_bytes(addr);