3 * \brief Test program for large page code
7 * Copyright (c) 2014, HP Labs.
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group.
15 #include <barrelfish/barrelfish.h>
16 #include <barrelfish/sys_debug.h>
20 #define BUFSIZE (128UL*1024*1024)
25 for (int k = 0; k < RUNS; k++) {
26 // touch every 4k page in region
27 bufs[k] = malloc(BUFSIZE);
29 debug_printf("malloc %d FAILED\n", k);
32 uint8_t *buf = bufs[k];
33 for (int i = 0; i < BUFSIZE / BASE_PAGE_SIZE; i++) {
34 buf[i*BASE_PAGE_SIZE] = i % 256;
37 sys_debug_flush_cache();
39 for (int i = 0; i < BUFSIZE / BASE_PAGE_SIZE; i++) {
40 if (buf[i*BASE_PAGE_SIZE] != i % 256) {
41 debug_printf("mismatch in page %d: expected %d, was %d\n",
42 i, i % 256, buf[i*BASE_PAGE_SIZE]);
46 debug_printf("test %s\n", errors ? "FAILED" : "PASSED");
48 debug_printf(" %d errors\n", errors);
51 for (int k = 0; k < RUNS; k++) {
52 debug_printf("bufs[%d] = %p\n", k, bufs[k]);
54 debug_dump_hw_ptables();
55 for (int k = 0; k < RUNS; k++) {