14 unsigned long *page_allocs
;
15 unsigned long *page_maps
;
17 static void * __allocbuf(const char *name
)
21 ptr
= memalign(page_size
, page_size
* 2);
24 memset(ptr
, 0, page_size
* 2);
25 output(2, "%s @ %p\n", name
, ptr
);
29 void init_shared_pages(void)
34 page_zeros
= __allocbuf("page_zeros");
37 page_0xff
= __allocbuf("page_0xff");
39 // a page of random crap (overwritten below)
40 page_rand
= __allocbuf("page_rand");
42 // page containing ptrs to mallocs.
43 page_allocs
= __allocbuf("page_allocs");
44 for (i
= 0; i
< (page_size
/ sizeof(unsigned long *)); i
++)
45 page_allocs
[i
] = (unsigned long) malloc(page_size
);
47 // a page of ptrs to mmaps (set up at child init time).
48 page_maps
= __allocbuf("page_maps");
50 // mmaps that get shared across children.
51 setup_shared_mappings();
53 // generate_random_page may end up using shared_mappings, so has to be last.
54 generate_random_page(page_rand
);