585 |
{ |
{ |
586 |
PageDesc *p, *pmap; |
PageDesc *p, *pmap; |
587 |
unsigned long addr; |
unsigned long addr; |
588 |
int i, j, ret; |
int i, j, ret, j1; |
589 |
|
|
590 |
for(i = 0; i < L1_SIZE; i++) { |
for(i = 0; i < L1_SIZE; i++) { |
591 |
pmap = l1_map[i]; |
pmap = l1_map[i]; |
592 |
if (pmap) { |
if (pmap) { |
593 |
p = pmap; |
p = pmap; |
594 |
for(j = 0;j < L2_SIZE; j++) { |
for(j = 0;j < L2_SIZE;) { |
595 |
if (p->flags & PAGE_VALID) { |
if (p->flags & PAGE_VALID) { |
596 |
addr = (i << (32 - L1_BITS)) | (j << TARGET_PAGE_BITS); |
addr = (i << (32 - L1_BITS)) | (j << TARGET_PAGE_BITS); |
597 |
ret = munmap((void *)addr, TARGET_PAGE_SIZE); |
/* we try to find a range to make less syscalls */ |
598 |
|
j1 = j; |
599 |
|
p++; |
600 |
|
j++; |
601 |
|
while (j < L2_SIZE && (p->flags & PAGE_VALID)) { |
602 |
|
p++; |
603 |
|
j++; |
604 |
|
} |
605 |
|
ret = munmap((void *)addr, (j - j1) << TARGET_PAGE_BITS); |
606 |
if (ret != 0) { |
if (ret != 0) { |
607 |
fprintf(stderr, "Could not unmap page 0x%08lx\n", addr); |
fprintf(stderr, "Could not unmap page 0x%08lx\n", addr); |
608 |
exit(1); |
exit(1); |
609 |
} |
} |
610 |
|
} else { |
611 |
|
p++; |
612 |
|
j++; |
613 |
} |
} |
|
p++; |
|
614 |
} |
} |
615 |
free(pmap); |
free(pmap); |
616 |
l1_map[i] = NULL; |
l1_map[i] = NULL; |