From 254f7ca7e25aa91b28c49695de552042a880d18b Mon Sep 17 00:00:00 2001 From: Maksym Planeta Date: Sat, 7 Apr 2012 17:57:44 +0300 Subject: 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. --- mach-defpager/default_pager.c | 6 ++---- 1 file 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. */ -- cgit v1.2.3