/* Shared Memory */
#define IPC_SHMGET (IPC_BASE+1)
#define IPC_SHMAT (IPC_BASE+2)
-# define SHMAT_ID m2_i1
-# define SHMAT_ADDR m2_l1
-# define SHMAT_FLAG m2_i2
-# define SHMAT_RETADDR m2_l2
#define IPC_SHMDT (IPC_BASE+3)
-# define SHMDT_ADDR m2_l1
#define IPC_SHMCTL (IPC_BASE+4)
# define SHMCTL_ID m2_i1
# define SHMCTL_CMD m2_i2
} mess_lc_ipc_shmget;
_ASSERT_MSG_SIZE(mess_lc_ipc_shmget);
+typedef struct {
+ int id;
+ const void *addr;
+ int flag;
+ void *retaddr;
+ uint8_t padding[40];
+} mess_lc_ipc_shmat;
+_ASSERT_MSG_SIZE(mess_lc_ipc_shmat);
+
+typedef struct {
+ const void *addr;
+ uint8_t padding[52];
+} mess_lc_ipc_shmdt;
+_ASSERT_MSG_SIZE(mess_lc_ipc_shmdt);
+
typedef struct {
endpoint_t m_source; /* who sent the message */
int m_type; /* what kind of message is it */
mess_lsys_vm_update m_lsys_vm_update;
mess_lsys_vm_watch_exit m_lsys_vm_watch_exit;
mess_lc_ipc_shmget m_lc_ipc_shmget;
+ mess_lc_ipc_shmat m_lc_ipc_shmat;
+ mess_lc_ipc_shmdt m_lc_ipc_shmdt;
mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel;
mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose;
}
memset(&m, 0, sizeof(m));
- m.SHMAT_ID = shmid;
- m.SHMAT_ADDR = (long) shmaddr;
- m.SHMAT_FLAG = shmflg;
+ m.m_lc_ipc_shmat.id = shmid;
+ m.m_lc_ipc_shmat.addr = shmaddr;
+ m.m_lc_ipc_shmat.flag = shmflg;
r = _syscall(ipc_pt, IPC_SHMAT, &m);
if (r != OK)
return (void *) -1;
- return (void *) m.SHMAT_RETADDR;
+ return m.m_lc_ipc_shmat.retaddr;
}
/* Deattach shared memory segment. */
}
memset(&m, 0, sizeof(m));
- m.SHMDT_ADDR = (long) shmaddr;
+ m.m_lc_ipc_shmdt.addr = shmaddr;
return _syscall(ipc_pt, IPC_SHMDT, &m);
}
void *ret;
struct shm_struct *shm;
- id = m->SHMAT_ID;
- addr = (vir_bytes) m->SHMAT_ADDR;
- flag = m->SHMAT_FLAG;
+ id = m->m_lc_ipc_shmat.id;
+ addr = (vir_bytes) m->m_lc_ipc_shmat.addr;
+ flag = m->m_lc_ipc_shmat.flag;
if (addr && (addr % PAGE_SIZE)) {
if (flag & SHM_RND)
shm->shmid_ds.shm_lpid = getnpid(who_e);
/* nattach is updated lazily */
- m->SHMAT_RETADDR = (long) ret;
+ m->m_lc_ipc_shmat.retaddr = ret;
return OK;
}
phys_bytes vm_id;
int i;
- addr = m->SHMDT_ADDR;
+ addr = (vir_bytes) m->m_lc_ipc_shmdt.addr;
if ((vm_id = vm_getphys(who_e, (void *) addr)) == 0)
return EINVAL;