Go to the documentation of this file.
25 #define FILE_NAME "huge/hugepagefile"
26 #define LENGTH (256UL*1024*1024)
27 #define PROTECTION (PROT_READ | PROT_WRITE)
31 #define ADDR (void *)(0x8000000000000000UL)
32 #define FLAGS (MAP_SHARED | MAP_FIXED)
34 #define ADDR (void *)(0x0UL)
35 #define FLAGS (MAP_SHARED)
40 printf(
"First hex is %x\n", *((
unsigned int *)addr));
43 static void write_bytes(
char *
addr)
47 for (i = 0; i <
LENGTH; i++)
48 *(addr + i) = (
char)i;
51 static int read_bytes(
char *addr)
56 for (i = 0; i <
LENGTH; i++)
57 if (*(addr + i) != (
char)i) {
58 printf(
"Mismatch at %lu\n", i);
71 perror(
"Open failed");
76 if (addr == MAP_FAILED) {
82 printf(
"Returned address is %p\n", addr);
85 ret = read_bytes(addr);