vm: full memory view

for user-space processes, increase text segment so it reaches the full
address space, so code can be executed anywhere.
This commit is contained in:
Ben Gras 2012-04-05 03:37:17 +02:00
parent 660e15b2d1
commit b480472a76
4 changed files with 12 additions and 6 deletions

View 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);
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;

View 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;
}

View 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");
}
}

View 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 */