From: Dirk Vogt Date: Mon, 19 Jan 2015 14:20:30 +0000 (+0100) Subject: VM: live update - check for regions above stack X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/already%20found%20%2A/doxygen.log?a=commitdiff_plain;h=a6db4d0a62b94c81dc4e7edb0740d03b7750a70a;p=minix.git VM: live update - check for regions above stack If the stack is not mapped at the VM_DATATOP (e.g. booted with ac_layout = 1), there might be some more regions hiding above the stack. We also have to transfer those. Change-Id: Idf3b94a36fcec8a10ace2f6dffe816faf0a88f60 --- diff --git a/minix/servers/vm/utility.c b/minix/servers/vm/utility.c index 8d265d8d7..baab31ef6 100644 --- a/minix/servers/vm/utility.c +++ b/minix/servers/vm/utility.c @@ -242,6 +242,12 @@ int swap_proc_dyn_data(struct vmproc *src_vmp, struct vmproc *dst_vmp, printf("swap_proc_dyn_data: pt_map_in_range failed\n"); return r; } + r = pt_map_in_range(src_vmp, dst_vmp, VM_STACKTOP, VM_DATATOP); + if(r != OK) { + printf("swap_proc_dyn_data: pt_map_in_range failed\n"); + return r; + } + } #if LU_DEBUG @@ -280,6 +286,28 @@ int swap_proc_dyn_data(struct vmproc *src_vmp, struct vmproc *dst_vmp, } } + /* If the stack is not mapped at the VM_DATATOP, there might be some + * more regions hiding above the stack. We also have to transfer + * those. + */ + if (VM_STACKTOP == VM_DATATOP) + return OK; + + start_vr = region_search(&dst_vmp->vm_regions_avl, VM_STACKTOP, AVL_GREATER_EQUAL); + end_vr = region_search(&dst_vmp->vm_regions_avl, VM_DATATOP, AVL_LESS); + + if(start_vr) { +#if LU_DEBUG + printf("VM: swap_proc_dyn_data: tranferring memory mapped regions from %d to %d\n", + dst_vmp->vm_endpoint, src_vmp->vm_endpoint); +#endif + assert(end_vr); + r = map_proc_copy_range(src_vmp, dst_vmp, start_vr, end_vr); + if(r != OK) { + return r; + } + } + return OK; }