mirror of
https://github.com/drasko/codezero.git
synced 2026-01-24 08:43:15 +01:00
Fixed various errors with ipc message passing.
Previously we had changed the method of setting the ipc tag from l4_ipc() call argument to being passed as a message register. - This change was not reflected in l4_ipc() signature as it still had a 3rd argument, even though ignored. - l4_set_sender and _set_tag had their arguments wrong way around. - Previously 5 mrs were passed onto utcb instead of 6, relying on the fact that l4_ipc tag argument was being passed in r3 directly, this wasnt true anymore with new convention, but wasn't catered for. TODO: - MM0 shouldn't really allocate tids itself, but use ones supplied by C0. - Sender tid shouldn't really passed by the sender task, but rather by C0. Otherwise security can be easily breached by user tasks pretending to be other tasks. This would also save us a message register.
This commit is contained in:
@@ -30,9 +30,9 @@ typedef int (*__l4_getid_t)(struct task_ids *ids);
|
||||
extern __l4_getid_t __l4_getpid;
|
||||
int l4_getid(struct task_ids *ids);
|
||||
|
||||
typedef int (*__l4_ipc_t)(l4id_t to, l4id_t from, u32 tag);
|
||||
typedef int (*__l4_ipc_t)(l4id_t to, l4id_t from);
|
||||
extern __l4_ipc_t __l4_ipc;
|
||||
int l4_ipc(l4id_t to, l4id_t from, u32 tag);
|
||||
int l4_ipc(l4id_t to, l4id_t from);
|
||||
|
||||
typedef int (*__l4_kread_t)(u32 rd, void *addr);
|
||||
extern __l4_kread_t __l4_kread;
|
||||
|
||||
@@ -39,7 +39,7 @@ static inline l4id_t l4_get_sender(void)
|
||||
|
||||
static inline void l4_set_sender(l4id_t id)
|
||||
{
|
||||
write_mr(MR_SENDER, (unsigned int)id);
|
||||
write_mr((unsigned int)id, MR_SENDER);
|
||||
}
|
||||
|
||||
static inline unsigned int l4_get_tag(void)
|
||||
@@ -49,7 +49,7 @@ static inline unsigned int l4_get_tag(void)
|
||||
|
||||
static inline void l4_set_tag(unsigned int tag)
|
||||
{
|
||||
write_mr(MR_TAG, tag);
|
||||
write_mr(tag, MR_TAG);
|
||||
}
|
||||
|
||||
static inline l4id_t self_tid(void)
|
||||
@@ -64,7 +64,8 @@ static inline int l4_send(l4id_t to, unsigned int tag)
|
||||
{
|
||||
l4_set_tag(tag);
|
||||
l4_set_sender(self_tid());
|
||||
return l4_ipc(to, L4_NILTHREAD, 0);
|
||||
|
||||
return l4_ipc(to, L4_NILTHREAD);
|
||||
}
|
||||
|
||||
static inline int l4_sendrecv(l4id_t to, l4id_t from, unsigned int tag)
|
||||
@@ -72,12 +73,12 @@ static inline int l4_sendrecv(l4id_t to, l4id_t from, unsigned int tag)
|
||||
BUG_ON(to == L4_NILTHREAD || from == L4_NILTHREAD);
|
||||
l4_set_tag(tag);
|
||||
l4_set_sender(self_tid());
|
||||
return l4_ipc(to, from, 0);
|
||||
return l4_ipc(to, from);
|
||||
}
|
||||
|
||||
static inline int l4_receive(l4id_t from)
|
||||
{
|
||||
return l4_ipc(L4_NILTHREAD, from, 0);
|
||||
return l4_ipc(L4_NILTHREAD, from);
|
||||
}
|
||||
|
||||
/* Servers:
|
||||
|
||||
Reference in New Issue
Block a user