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 output(2, "%s @ %p\n", name
, ptr
);
28 void init_shared_pages(void)
33 page_zeros
= __allocbuf("page_zeros");
34 memset(page_zeros
, 0, page_size
* 2);
37 page_0xff
= __allocbuf("page_0xff");
38 memset(page_0xff
, 0xff, page_size
* 2);
40 // a page of random crap (overwritten below)
41 page_rand
= __allocbuf("page_rand");
43 // page containing ptrs to mallocs.
44 page_allocs
= __allocbuf("page_allocs");
45 for (i
= 0; i
< (page_size
/ sizeof(unsigned long *)); i
++)
46 page_allocs
[i
] = (unsigned long) malloc(page_size
);
48 // a page of ptrs to mmaps (set up at child init time).
49 page_maps
= __allocbuf("page_maps");
51 // mmaps that get shared across children.
52 setup_shared_mappings();
54 // generate_random_page may end up using shared_mappings, so has to be last.
55 generate_random_page(page_rand
);