/*===========================================================================* * do_rs_memctl * *===========================================================================*/ int do_rs_memctl(message *m_ptr) { endpoint_t ep; int req, r, proc_nr; struct vmproc *vmp; ep = m_ptr->VM_RS_CTL_ENDPT; req = m_ptr->VM_RS_CTL_REQ; /* Lookup endpoint. */ if ((r = vm_isokendpt(ep, &proc_nr)) != OK) { printf("do_rs_memctl: bad endpoint %d\n", ep); return EINVAL; } vmp = &vmproc[proc_nr]; /* Process request. */ switch(req) { case VM_RS_MEM_PIN: /* Only actually pin RS memory if VM can recover from crashes (saves memory). */ if (num_vm_instances <= 1) return OK; r = map_pin_memory(vmp); return r; case VM_RS_MEM_MAKE_VM: r = rs_memctl_make_vm_instance(vmp); return r; case VM_RS_MEM_HEAP_PREALLOC: r = rs_memctl_heap_prealloc(vmp, (vir_bytes*) &m_ptr->VM_RS_CTL_ADDR, (size_t*) &m_ptr->VM_RS_CTL_LEN); return r; case VM_RS_MEM_MAP_PREALLOC: r = rs_memctl_map_prealloc(vmp, (vir_bytes*) &m_ptr->VM_RS_CTL_ADDR, (size_t*) &m_ptr->VM_RS_CTL_LEN); return r; case VM_RS_MEM_GET_PREALLOC_MAP: r = rs_memctl_get_prealloc_map(vmp, (vir_bytes*) &m_ptr->VM_RS_CTL_ADDR, (size_t*) &m_ptr->VM_RS_CTL_LEN); return r; default: printf("do_rs_memctl: bad request %d\n", req); return EINVAL; } }
/*===========================================================================* * do_rs_memctl * *===========================================================================*/ int do_rs_memctl(message *m_ptr) { endpoint_t ep; int req, r, proc_nr; struct vmproc *vmp; ep = m_ptr->VM_RS_CTL_ENDPT; req = m_ptr->VM_RS_CTL_REQ; /* Lookup endpoint. */ if ((r = vm_isokendpt(ep, &proc_nr)) != OK) { printf("do_rs_memctl: bad endpoint %d\n", ep); return EINVAL; } vmp = &vmproc[proc_nr]; /* Process request. */ switch(req) { case VM_RS_MEM_PIN: /* Do not perform VM_RS_MEM_PIN yet - it costs the full * size of the RS stack (64MB by default) in memory, * and it's needed for functionality that isn't complete / * merged in current Minix (surviving VM crashes). */ #if 0 r = map_pin_memory(vmp); return r; #else return OK; #endif case VM_RS_MEM_MAKE_VM: r = rs_memctl_make_vm_instance(vmp); return r; default: printf("do_rs_memctl: bad request %d\n", req); return EINVAL; } }