custom message type for VM_REMAP, VM_REMAP_RO

This commit is contained in:
Ben Gras 2014-07-26 13:53:43 +02:00 committed by Lionel Sambuc
parent edb410ffe2
commit e3a0e6c3c3
5 changed files with 32 additions and 26 deletions

View file

@ -754,13 +754,6 @@
# define VMV_SIZE_PAGES m10_l3 # define VMV_SIZE_PAGES m10_l3
#define VM_REMAP (VM_RQ_BASE+33) #define VM_REMAP (VM_RQ_BASE+33)
# define VMRE_D m1_i1
# define VMRE_S m1_i2
# define VMRE_DA m1_p1
# define VMRE_SA m1_p2
# define VMRE_RETA m1_p3
# define VMRE_SIZE m1_i3
# define VMRE_FLAGS m1_i3
#define VM_SHM_UNMAP (VM_RQ_BASE+34) #define VM_SHM_UNMAP (VM_RQ_BASE+34)
# define VMUN_ENDPT m_mmap.forwhom # define VMUN_ENDPT m_mmap.forwhom

View file

@ -1700,6 +1700,17 @@ typedef struct {
} mess_vmmcp_reply; } mess_vmmcp_reply;
_ASSERT_MSG_SIZE(mess_vmmcp_reply); _ASSERT_MSG_SIZE(mess_vmmcp_reply);
typedef struct {
endpoint_t destination;
endpoint_t source;
void *dest_addr;
void *src_addr;
size_t size;
void *ret_addr;
uint8_t padding[32];
} mess_lsys_vm_vmremap;
_ASSERT_MSG_SIZE(mess_lsys_vm_vmremap);
typedef struct { typedef struct {
endpoint_t m_source; /* who sent the message */ endpoint_t m_source; /* who sent the message */
int m_type; /* what kind of message is it */ int m_type; /* what kind of message is it */
@ -1918,6 +1929,8 @@ typedef struct {
mess_vfs_lc_lseek m_vfs_lc_lseek; mess_vfs_lc_lseek m_vfs_lc_lseek;
mess_lsys_vm_vmremap m_lsys_vm_vmremap;
mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel; mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel;
mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose; mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose;
mess_vfs_lchardriver_readwrite m_vfs_lchardriver_readwrite; mess_vfs_lchardriver_readwrite m_vfs_lchardriver_readwrite;

View file

@ -95,16 +95,16 @@ void *vm_remap(endpoint_t d,
int r; int r;
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.VMRE_D = d; m.m_lsys_vm_vmremap.destination = d;
m.VMRE_S = s; m.m_lsys_vm_vmremap.source = s;
m.VMRE_DA = (char *) da; m.m_lsys_vm_vmremap.dest_addr = da;
m.VMRE_SA = (char *) sa; m.m_lsys_vm_vmremap.src_addr = sa;
m.VMRE_SIZE = size; m.m_lsys_vm_vmremap.size = size;
r = _syscall(VM_PROC_NR, VM_REMAP, &m); r = _syscall(VM_PROC_NR, VM_REMAP, &m);
if (r != OK) if (r != OK)
return MAP_FAILED; return MAP_FAILED;
return (void *) m.VMRE_RETA; return m.m_lsys_vm_vmremap.ret_addr;
} }
void *vm_remap_ro(endpoint_t d, void *vm_remap_ro(endpoint_t d,
@ -117,16 +117,16 @@ void *vm_remap_ro(endpoint_t d,
int r; int r;
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.VMRE_D = d; m.m_lsys_vm_vmremap.destination = d;
m.VMRE_S = s; m.m_lsys_vm_vmremap.source = s;
m.VMRE_DA = (char *) da; m.m_lsys_vm_vmremap.dest_addr = da;
m.VMRE_SA = (char *) sa; m.m_lsys_vm_vmremap.src_addr = sa;
m.VMRE_SIZE = size; m.m_lsys_vm_vmremap.size = size;
r = _syscall(VM_PROC_NR, VM_REMAP_RO, &m); r = _syscall(VM_PROC_NR, VM_REMAP_RO, &m);
if (r != OK) if (r != OK)
return MAP_FAILED; return MAP_FAILED;
return (void *) m.VMRE_RETA; return m.m_lsys_vm_vmremap.ret_addr;
} }
int vm_unmap(endpoint_t endpt, void *addr) int vm_unmap(endpoint_t endpt, void *addr)

View file

@ -191,5 +191,5 @@ then
echo "CD image at `pwd`/${IMG}" echo "CD image at `pwd`/${IMG}"
else else
echo "To boot this image on kvm:" echo "To boot this image on kvm:"
echo "cd ${MODDIR} && kvm -serial stdio -kernel kernel -append \"console=tty00 rootdevname=c0d0p1\" -initrd \"${mods}\" -hda `pwd`/${IMG}" echo "cd ${MODDIR} && kvm -display none -serial stdio -kernel kernel -append \"console=tty00 rootdevname=c0d0p1\" -initrd \"${mods}\" -hda `pwd`/${IMG}"
fi fi

View file

@ -383,15 +383,15 @@ int do_remap(message *m)
readonly = 1; readonly = 1;
else panic("do_remap: can't be"); else panic("do_remap: can't be");
da = (vir_bytes) m->VMRE_DA; da = (vir_bytes) m->m_lsys_vm_vmremap.dest_addr;
sa = (vir_bytes) m->VMRE_SA; sa = (vir_bytes) m->m_lsys_vm_vmremap.src_addr;
size = m->VMRE_SIZE; size = m->m_lsys_vm_vmremap.size;
if (size <= 0) return EINVAL; if (size <= 0) return EINVAL;
if ((r = vm_isokendpt((endpoint_t) m->VMRE_D, &dn)) != OK) if ((r = vm_isokendpt((endpoint_t) m->m_lsys_vm_vmremap.destination, &dn)) != OK)
return EINVAL; return EINVAL;
if ((r = vm_isokendpt((endpoint_t) m->VMRE_S, &sn)) != OK) if ((r = vm_isokendpt((endpoint_t) m->m_lsys_vm_vmremap.source, &sn)) != OK)
return EINVAL; return EINVAL;
dvmp = &vmproc[dn]; dvmp = &vmproc[dn];
@ -431,7 +431,7 @@ int do_remap(message *m)
shared_setsource(vr, svmp->vm_endpoint, src_region); shared_setsource(vr, svmp->vm_endpoint, src_region);
m->VMRE_RETA = (char *) vr->vaddr; m->m_lsys_vm_vmremap.ret_addr = (void *) vr->vaddr;
return OK; return OK;
} }