summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-06-25 00:08:13 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-06-25 00:08:13 +0000
commit7c2d6a781cb806fdb99837015c773398f582caf1 (patch)
tree0a27bd6d2d93822794d9e77553d151463b25555e
parentf1510b2cc3529b1bf26107c3d3890a4efb793afe (diff)
downloadqemu-7c2d6a781cb806fdb99837015c773398f582caf1.tar.gz
faster task switch
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@270 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--exec.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/exec.c b/exec.c
index f7fdc03592..636fe25b80 100644
--- a/exec.c
+++ b/exec.c
@@ -585,22 +585,32 @@ void page_unmap(void)
{
PageDesc *p, *pmap;
unsigned long addr;
- int i, j, ret;
+ int i, j, ret, j1;
for(i = 0; i < L1_SIZE; i++) {
pmap = l1_map[i];
if (pmap) {
p = pmap;
- for(j = 0;j < L2_SIZE; j++) {
+ for(j = 0;j < L2_SIZE;) {
if (p->flags & PAGE_VALID) {
addr = (i << (32 - L1_BITS)) | (j << TARGET_PAGE_BITS);
- ret = munmap((void *)addr, TARGET_PAGE_SIZE);
+ /* we try to find a range to make less syscalls */
+ j1 = j;
+ p++;
+ j++;
+ while (j < L2_SIZE && (p->flags & PAGE_VALID)) {
+ p++;
+ j++;
+ }
+ ret = munmap((void *)addr, (j - j1) << TARGET_PAGE_BITS);
if (ret != 0) {
fprintf(stderr, "Could not unmap page 0x%08lx\n", addr);
exit(1);
}
+ } else {
+ p++;
+ j++;
}
- p++;
}
free(pmap);
l1_map[i] = NULL;