From 6af75e66601b01a41936e3399c0a718c27fb682a Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Sat, 26 Jul 2014 13:53:58 +0200 Subject: [PATCH] custom message type for vm_map_phys --- include/minix/com.h | 4 ---- include/minix/ipc.h | 10 ++++++++++ lib/libsys/vm_map_phys.c | 8 ++++---- servers/vm/mmap.c | 8 ++++---- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/include/minix/com.h b/include/minix/com.h index e0edf54e8..d1c1ee3fc 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -700,10 +700,6 @@ # define VMGD_SIZEP m2_l2 #define VM_MAP_PHYS (VM_RQ_BASE+15) -# define VMMP_EP m1_i1 -# define VMMP_PHADDR m1_p2 -# define VMMP_LEN m1_i2 -# define VMMP_VADDR_REPLY m1_p3 #define VM_UNMAP_PHYS (VM_RQ_BASE+16) # define VMUP_EP m1_i1 diff --git a/include/minix/ipc.h b/include/minix/ipc.h index c1fcc78e8..15bc6203a 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -1847,6 +1847,15 @@ typedef struct { } mess_lc_ipc_semop; _ASSERT_MSG_SIZE(mess_lc_ipc_semop); +typedef struct { + endpoint_t ep; + phys_bytes phaddr; + size_t len; + void *reply; + uint8_t padding[40]; +} mess_lsys_vm_map_phys; +_ASSERT_MSG_SIZE(mess_lsys_vm_map_phys); + typedef struct { endpoint_t m_source; /* who sent the message */ int m_type; /* what kind of message is it */ @@ -2083,6 +2092,7 @@ typedef struct { mess_lc_ipc_semctl m_lc_ipc_semctl; mess_lc_ipc_semop m_lc_ipc_semop; mess_lc_vm_brk m_lc_vm_brk; + mess_lsys_vm_map_phys m_lsys_vm_map_phys; mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel; mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose; diff --git a/lib/libsys/vm_map_phys.c b/lib/libsys/vm_map_phys.c index 135608197..bd1e183e1 100644 --- a/lib/libsys/vm_map_phys.c +++ b/lib/libsys/vm_map_phys.c @@ -12,15 +12,15 @@ vm_map_phys(endpoint_t who, void *phaddr, size_t len) int r; memset(&m, 0, sizeof(m)); - m.VMMP_EP = who; - m.VMMP_PHADDR = phaddr; - m.VMMP_LEN = len; + m.m_lsys_vm_map_phys.ep = who; + m.m_lsys_vm_map_phys.phaddr = phaddr; + m.m_lsys_vm_map_phys.len = len; r = _taskcall(VM_PROC_NR, VM_MAP_PHYS, &m); if (r != OK) return MAP_FAILED; - return (void *) m.VMMP_VADDR_REPLY; + return m.m_lsys_vm_map_phys.reply; } int diff --git a/servers/vm/mmap.c b/servers/vm/mmap.c index a60208bf0..dcdbf44b2 100644 --- a/servers/vm/mmap.c +++ b/servers/vm/mmap.c @@ -320,8 +320,8 @@ int do_map_phys(message *m) phys_bytes startaddr; size_t offset; - target = m->VMMP_EP; - len = m->VMMP_LEN; + target = m->m_lsys_vm_map_phys.ep; + len = m->m_lsys_vm_map_phys.len; if (len <= 0) return EINVAL; @@ -331,7 +331,7 @@ int do_map_phys(message *m) if((r=vm_isokendpt(target, &n)) != OK) return EINVAL; - startaddr = (vir_bytes)m->VMMP_PHADDR; + startaddr = (vir_bytes)m->m_lsys_vm_map_phys.phaddr; /* First check permission, then round range down/up. Caller can't * help it if we can't map in lower than page granularity. @@ -358,7 +358,7 @@ int do_map_phys(message *m) phys_setphys(vr, startaddr); - m->VMMP_VADDR_REPLY = (void *) (vr->vaddr + offset); + m->m_lsys_vm_map_phys.reply = (void *) (vr->vaddr + offset); return OK; }