From e3a0e6c3c3598d06d37d3337e3e2254c4038e94c Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Sat, 26 Jul 2014 13:53:43 +0200 Subject: [PATCH] custom message type for VM_REMAP, VM_REMAP_RO --- include/minix/com.h | 7 ------- include/minix/ipc.h | 13 +++++++++++++ lib/libc/sys-minix/mmap.c | 24 ++++++++++++------------ releasetools/x86_hdimage.sh | 2 +- servers/vm/mmap.c | 12 ++++++------ 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/include/minix/com.h b/include/minix/com.h index 82fc9daf1..45dc520d8 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -754,13 +754,6 @@ # define VMV_SIZE_PAGES m10_l3 #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 VMUN_ENDPT m_mmap.forwhom diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 7962f7476..a2e79cdbe 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -1700,6 +1700,17 @@ typedef struct { } 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 { endpoint_t m_source; /* who sent the message */ int m_type; /* what kind of message is it */ @@ -1918,6 +1929,8 @@ typedef struct { 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_openclose m_vfs_lchardriver_openclose; mess_vfs_lchardriver_readwrite m_vfs_lchardriver_readwrite; diff --git a/lib/libc/sys-minix/mmap.c b/lib/libc/sys-minix/mmap.c index 64b0b5ff0..3dec2a4a8 100644 --- a/lib/libc/sys-minix/mmap.c +++ b/lib/libc/sys-minix/mmap.c @@ -95,16 +95,16 @@ void *vm_remap(endpoint_t d, int r; memset(&m, 0, sizeof(m)); - m.VMRE_D = d; - m.VMRE_S = s; - m.VMRE_DA = (char *) da; - m.VMRE_SA = (char *) sa; - m.VMRE_SIZE = size; + m.m_lsys_vm_vmremap.destination = d; + m.m_lsys_vm_vmremap.source = s; + m.m_lsys_vm_vmremap.dest_addr = da; + m.m_lsys_vm_vmremap.src_addr = sa; + m.m_lsys_vm_vmremap.size = size; r = _syscall(VM_PROC_NR, VM_REMAP, &m); if (r != OK) return MAP_FAILED; - return (void *) m.VMRE_RETA; + return m.m_lsys_vm_vmremap.ret_addr; } void *vm_remap_ro(endpoint_t d, @@ -117,16 +117,16 @@ void *vm_remap_ro(endpoint_t d, int r; memset(&m, 0, sizeof(m)); - m.VMRE_D = d; - m.VMRE_S = s; - m.VMRE_DA = (char *) da; - m.VMRE_SA = (char *) sa; - m.VMRE_SIZE = size; + m.m_lsys_vm_vmremap.destination = d; + m.m_lsys_vm_vmremap.source = s; + m.m_lsys_vm_vmremap.dest_addr = da; + m.m_lsys_vm_vmremap.src_addr = sa; + m.m_lsys_vm_vmremap.size = size; r = _syscall(VM_PROC_NR, VM_REMAP_RO, &m); if (r != OK) return MAP_FAILED; - return (void *) m.VMRE_RETA; + return m.m_lsys_vm_vmremap.ret_addr; } int vm_unmap(endpoint_t endpt, void *addr) diff --git a/releasetools/x86_hdimage.sh b/releasetools/x86_hdimage.sh index 6b7a436d6..84759eee8 100755 --- a/releasetools/x86_hdimage.sh +++ b/releasetools/x86_hdimage.sh @@ -191,5 +191,5 @@ then echo "CD image at `pwd`/${IMG}" else 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 diff --git a/servers/vm/mmap.c b/servers/vm/mmap.c index 405e5fc79..0526394d2 100644 --- a/servers/vm/mmap.c +++ b/servers/vm/mmap.c @@ -383,15 +383,15 @@ int do_remap(message *m) readonly = 1; else panic("do_remap: can't be"); - da = (vir_bytes) m->VMRE_DA; - sa = (vir_bytes) m->VMRE_SA; - size = m->VMRE_SIZE; + da = (vir_bytes) m->m_lsys_vm_vmremap.dest_addr; + sa = (vir_bytes) m->m_lsys_vm_vmremap.src_addr; + size = m->m_lsys_vm_vmremap.size; 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; - 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; dvmp = &vmproc[dn]; @@ -431,7 +431,7 @@ int do_remap(message *m) 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; }