]> Zhao Yanbai Git Server - minix.git/commitdiff
vm: full memory view
authorBen Gras <ben@minix3.org>
Thu, 5 Apr 2012 01:37:17 +0000 (03:37 +0200)
committerBen Gras <ben@minix3.org>
Thu, 12 Apr 2012 00:58:39 +0000 (02:58 +0200)
for user-space processes, increase text segment so it reaches the full
address space, so code can be executed anywhere.

servers/vm/exec.c
servers/vm/fork.c
servers/vm/main.c
servers/vm/proto.h

index 3cb186b8136831babc39f6e982610be6605bdf68..69b53f83926a8fad2ce2abca62d4f72f3b339b04 100644 (file)
@@ -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;
 
index 9a20334060afe037e3e70432caee0813c0830253..807fba710d3e158cee18c048507774abcfc0a6ed 100644 (file)
@@ -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;
        }
index a0e0bd511607070e2803dc50f5d81e140353ee98..3f86a8194162e491a23778e5f1ebb7830d14154d 100644 (file)
@@ -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");
                }
        }
index 14dd12febb73062d0d91338c5514f34ed8901b2e..3e1f9d4451cfa441edbe0f034581a104ed84dd68 100644 (file)
@@ -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 */