11 static void segfault(
int sig)
16 static int page_ok(
unsigned long page)
18 unsigned long *
address = (
unsigned long *) (page << UM_KERN_PAGE_SHIFT);
19 unsigned long n = ~0
UL;
34 mapped = mmap(address, UM_KERN_PAGE_SIZE,
37 if (mapped == MAP_FAILED)
39 if (mapped != address)
52 }
else if (mprotect(address, UM_KERN_PAGE_SIZE,
63 munmap(mapped, UM_KERN_PAGE_SIZE);
79 unsigned long top = 0xffffd000 >> UM_KERN_PAGE_SHIFT;
80 unsigned long test, original;
82 printf(
"Locating the bottom of the address space ... ");
89 sa.sa_handler = segfault;
90 sigemptyset(&
sa.sa_mask);
93 perror(
"os_get_top_address");
100 for (bottom = 0; bottom <
top; bottom++) {
107 fprintf(stderr,
"Unable to determine bottom of address "
112 printf(
"0x%x\n", bottom << UM_KERN_PAGE_SHIFT);
113 printf(
"Locating the top of the address space ... ");
123 test = bottom + (top -
bottom) / 2;
128 }
while (top - bottom > 1);
133 perror(
"os_get_top_address");
136 top <<= UM_KERN_PAGE_SHIFT;