From: Ben Gras Date: Sat, 26 Jul 2014 11:53:45 +0000 (+0200) Subject: custom message type for VM_GETPHYS X-Git-Tag: v3.3.0~127 X-Git-Url: http://zhaoyanbai.com/repos/man.nsec3hash.html?a=commitdiff_plain;h=28b5360df74aea7454fb03fa7cfc37878ab725cd;p=minix.git custom message type for VM_GETPHYS --- diff --git a/include/minix/com.h b/include/minix/com.h index f3affaeed..e091a4d33 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -758,9 +758,6 @@ #define VM_SHM_UNMAP (VM_RQ_BASE+34) #define VM_GETPHYS (VM_RQ_BASE+35) -# define VMPHYS_ENDPT m2_i1 -# define VMPHYS_ADDR m2_l1 -# define VMPHYS_RETA m2_l2 #define VM_GETREF (VM_RQ_BASE+36) # define VMREFCNT_ENDPT m2_i1 diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 8c84765cb..7401eb53c 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -1718,6 +1718,14 @@ typedef struct { } mess_lc_vm_shm_unmap; _ASSERT_MSG_SIZE(mess_lc_vm_shm_unmap); +typedef struct { + endpoint_t endpt; + void *addr; + void *ret_addr; + uint8_t padding[44]; +} mess_lc_vm_getphys; +_ASSERT_MSG_SIZE(mess_lc_vm_getphys); + typedef struct { endpoint_t m_source; /* who sent the message */ int m_type; /* what kind of message is it */ @@ -1937,6 +1945,7 @@ typedef struct { mess_vfs_lc_lseek m_vfs_lc_lseek; mess_lsys_vm_vmremap m_lsys_vm_vmremap; + mess_lc_vm_getphys m_lc_vm_getphys; mess_lc_vm_shm_unmap m_lc_vm_shm_unmap; mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel; diff --git a/lib/libc/sys-minix/mmap.c b/lib/libc/sys-minix/mmap.c index ea073a063..334cc7782 100644 --- a/lib/libc/sys-minix/mmap.c +++ b/lib/libc/sys-minix/mmap.c @@ -146,13 +146,13 @@ unsigned long vm_getphys(endpoint_t endpt, void *addr) int r; memset(&m, 0, sizeof(m)); - m.VMPHYS_ENDPT = endpt; - m.VMPHYS_ADDR = (long) addr; + m.m_lc_vm_getphys.endpt = endpt; + m.m_lc_vm_getphys.addr = addr; r = _syscall(VM_PROC_NR, VM_GETPHYS, &m); if (r != OK) return 0; - return m.VMPHYS_RETA; + return (unsigned long) m.m_lc_vm_getphys.ret_addr; } u8_t vm_getrefcount(endpoint_t endpt, void *addr) diff --git a/servers/vm/mmap.c b/servers/vm/mmap.c index a3be376cc..d838df47f 100644 --- a/servers/vm/mmap.c +++ b/servers/vm/mmap.c @@ -446,8 +446,8 @@ int do_get_phys(message *m) phys_bytes ret; vir_bytes addr; - target = m->VMPHYS_ENDPT; - addr = m->VMPHYS_ADDR; + target = m->m_lc_vm_getphys.endpt; + addr = (vir_bytes) m->m_lc_vm_getphys.addr; if ((r = vm_isokendpt(target, &n)) != OK) return EINVAL; @@ -456,7 +456,7 @@ int do_get_phys(message *m) r = map_get_phys(vmp, addr, &ret); - m->VMPHYS_RETA = ret; + m->m_lc_vm_getphys.ret_addr = (void *) ret; return r; }