diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-11-10 00:11:32 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-11-10 00:11:32 +0100 |
commit | b11e2e666ce3e1a8ad167c82bfc1fc9b820f97f3 (patch) | |
tree | 52d273bc15c4d38badce0275e29dc24fd55e1806 | |
parent | 84172a2e26fd81c1c39b6301b003cc89b97ee75c (diff) |
Avoid hitting VM_MAX_ADDRESS
* libpager/pager-memcpy.c (pager_memcpy): Reset address passed to vm_map
on each loop, to avoid potentially monotonically increasing up to
VM_MAX_ADDRESS.
-rw-r--r-- | libpager/pager-memcpy.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libpager/pager-memcpy.c b/libpager/pager-memcpy.c index 479c06f0..7bdc248b 100644 --- a/libpager/pager-memcpy.c +++ b/libpager/pager-memcpy.c @@ -45,7 +45,7 @@ pager_memcpy (struct pager *pager, memory_object_t memobj, #define VMCOPY_WINDOW_DEFAULT_SIZE (32 * vm_page_size) #define MEMCPY_WINDOW_DEFAULT_SIZE (32 * vm_page_size) - vm_address_t window = 0; + vm_address_t window; vm_size_t window_size; error_t do_vm_copy (void) @@ -64,6 +64,7 @@ pager_memcpy (struct pager *pager, memory_object_t memobj, assert (window_size >= VMCOPY_BETTER_THAN_MEMCPY); assert ((window_size & (vm_page_size - 1)) == 0); + window = 0; err = vm_map (mach_task_self (), &window, window_size, 0, 1, memobj, offset, 0, prot, prot, VM_INHERIT_NONE); if (err) @@ -110,6 +111,7 @@ pager_memcpy (struct pager *pager, memory_object_t memobj, window_size = round_page (pageoff + to_copy); } + window = 0; err = vm_map (mach_task_self (), &window, window_size, 0, 1, memobj, offset - pageoff, 0, prot, prot, VM_INHERIT_NONE); |