custom message type for vm_map_phys
This commit is contained in:
parent
8c2ac80abd
commit
6af75e6660
4 changed files with 18 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue