summaryrefslogtreecommitdiff
path: root/mach-defpager
diff options
context:
space:
mode:
authorMaksym Planeta <mcsim.planeta@gmail.com>2012-04-07 17:57:44 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2012-04-08 22:06:09 +0200
commit254f7ca7e25aa91b28c49695de552042a880d18b (patch)
tree4be2dae4c284c2ee3113d7aaeff9fdba768ea29a /mach-defpager
parent615b470e8afb140ac45afcb01c402391c2b3b013 (diff)
Add support for empty memory objects.
* mach-defpager/default_pager.c (pager_extend): When old_size is 0, use 1 to compute power of two above it. (pager_truncate): Do not avoid new_size being 0.
Diffstat (limited to 'mach-defpager')
-rw-r--r--mach-defpager/default_pager.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c
index 5a83f437..5780322e 100644
--- a/mach-defpager/default_pager.c
+++ b/mach-defpager/default_pager.c
@@ -894,7 +894,8 @@ pager_extend(pager, new_size)
old_size = pager->size;
if (new_size <= atop(max_doubled_size)) {
- i = old_size;
+ /* New size cannot be less than 1 */
+ i = old_size ? old_size : 1;
while (i < new_size)
i <<= 1;
new_size = i;
@@ -1115,9 +1116,6 @@ pager_truncate(dpager_t pager, vm_size_t new_size) /* in pages */
}
}
- if (new_size == 0)
- new_size = 1;
-
if (! INDIRECT_PAGEMAP(old_size))
{
/* First deallocate pages in the truncated region. */