custom message type for VM_GETPHYS

This commit is contained in:
Ben Gras 2014-07-26 13:53:45 +02:00 committed by Lionel Sambuc
parent 324fc1f604
commit 28b5360df7
4 changed files with 15 additions and 9 deletions

View file

@ -758,9 +758,6 @@
#define VM_SHM_UNMAP (VM_RQ_BASE+34) #define VM_SHM_UNMAP (VM_RQ_BASE+34)
#define VM_GETPHYS (VM_RQ_BASE+35) #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 VM_GETREF (VM_RQ_BASE+36)
# define VMREFCNT_ENDPT m2_i1 # define VMREFCNT_ENDPT m2_i1

View file

@ -1718,6 +1718,14 @@ typedef struct {
} mess_lc_vm_shm_unmap; } mess_lc_vm_shm_unmap;
_ASSERT_MSG_SIZE(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 { 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 */
@ -1937,6 +1945,7 @@ 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_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_lc_vm_shm_unmap m_lc_vm_shm_unmap;
mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel; mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel;

View file

@ -146,13 +146,13 @@ unsigned long vm_getphys(endpoint_t endpt, void *addr)
int r; int r;
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.VMPHYS_ENDPT = endpt; m.m_lc_vm_getphys.endpt = endpt;
m.VMPHYS_ADDR = (long) addr; m.m_lc_vm_getphys.addr = addr;
r = _syscall(VM_PROC_NR, VM_GETPHYS, &m); r = _syscall(VM_PROC_NR, VM_GETPHYS, &m);
if (r != OK) if (r != OK)
return 0; 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) u8_t vm_getrefcount(endpoint_t endpt, void *addr)

View file

@ -446,8 +446,8 @@ int do_get_phys(message *m)
phys_bytes ret; phys_bytes ret;
vir_bytes addr; vir_bytes addr;
target = m->VMPHYS_ENDPT; target = m->m_lc_vm_getphys.endpt;
addr = m->VMPHYS_ADDR; addr = (vir_bytes) m->m_lc_vm_getphys.addr;
if ((r = vm_isokendpt(target, &n)) != OK) if ((r = vm_isokendpt(target, &n)) != OK)
return EINVAL; return EINVAL;
@ -456,7 +456,7 @@ int do_get_phys(message *m)
r = map_get_phys(vmp, addr, &ret); r = map_get_phys(vmp, addr, &ret);
m->VMPHYS_RETA = ret; m->m_lc_vm_getphys.ret_addr = (void *) ret;
return r; return r;
} }