From: Ben Gras Date: Thu, 5 Apr 2012 01:37:17 +0000 (+0200) Subject: vm: full memory view X-Git-Tag: v3.2.1~610 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/expt.png?a=commitdiff_plain;h=b480472a761922ac3469c8f02031210d40686322;p=minix.git vm: full memory view for user-space processes, increase text segment so it reaches the full address space, so code can be executed anywhere. --- diff --git a/servers/vm/exec.c b/servers/vm/exec.c index 3cb186b81..69b53f839 100644 --- a/servers/vm/exec.c +++ b/servers/vm/exec.c @@ -211,7 +211,7 @@ SANITYCHECK(SCL_DETAIL); CLICK2ABS(gap_clicks), /* how big is gap, page-aligned */ 0,0, /* not preallocated */ VM_STACKTOP, /* regular stack top */ - 0, is_elf)) != OK) { + 0, is_elf, 1)) != OK) { SANITYCHECK(SCL_DETAIL); printf("VM: new_mem: failed\n"); if(ptok) { @@ -288,7 +288,8 @@ int proc_new(struct vmproc *vmp, phys_bytes data_start, /* data starts here, if preallocated, otherwise 0 */ phys_bytes stacktop, int prealloc_stack, - int is_elf + int is_elf, + int full_memview ) { int s; @@ -311,7 +312,12 @@ int proc_new(struct vmproc *vmp, map_text_addr = vstart + text_addr; vmp->vm_arch.vm_seg[T].mem_phys = ABS2CLICK(map_text_addr); vmp->vm_arch.vm_seg[T].mem_vir = ABS2CLICK(text_addr); - vmp->vm_arch.vm_seg[T].mem_len = ABS2CLICK(text_bytes); + if(full_memview) { + vmp->vm_arch.vm_seg[T].mem_len = ABS2CLICK(VM_DATATOP) - + vmp->vm_arch.vm_seg[T].mem_phys; + } else { + vmp->vm_arch.vm_seg[T].mem_len = ABS2CLICK(text_bytes); + } vmp->vm_offset = vstart; diff --git a/servers/vm/fork.c b/servers/vm/fork.c index 9a2033406..807fba710 100644 --- a/servers/vm/fork.c +++ b/servers/vm/fork.c @@ -154,7 +154,7 @@ int do_fork(message *msg) stack_bytes, child_gap_bytes, 0, 0, CLICK2ABS(vmc->vm_arch.vm_seg[S].mem_vir + vmc->vm_arch.vm_seg[S].mem_len), - 1, is_elf)) != OK) { + 1, is_elf, 0)) != OK) { printf("VM: fork: proc_new failed\n"); return r; } diff --git a/servers/vm/main.c b/servers/vm/main.c index a0e0bd511..3f86a8194 100644 --- a/servers/vm/main.c +++ b/servers/vm/main.c @@ -315,7 +315,7 @@ static int sef_cb_init_fresh(int type, sef_init_info_t *info) vmp->vm_arch.vm_seg[D].mem_vir) - BASICSTACK, CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys), CLICK2ABS(vmp->vm_arch.vm_seg[D].mem_phys), - VM_STACKTOP, 0, is_elf) != OK) { + VM_STACKTOP, 0, is_elf, 0) != OK) { panic("failed proc_new for boot process"); } } diff --git a/servers/vm/proto.h b/servers/vm/proto.h index 14dd12feb..3e1f9d445 100644 --- a/servers/vm/proto.h +++ b/servers/vm/proto.h @@ -62,7 +62,7 @@ int do_exec_newmem(message *msg); int proc_new(struct vmproc *vmp, phys_bytes start, phys_bytes text_addr, phys_bytes text_bytes, phys_bytes data_addr, phys_bytes data_bytes, phys_bytes stack, phys_bytes gap, phys_bytes text_here, phys_bytes - data_here, vir_bytes stacktop, int prealloc_stack, int is_elf); + data_here, vir_bytes stacktop, int prealloc_stack, int is_elf, int full); phys_bytes find_kernel_top(void); /* break.c */