mirror of
https://github.com/drasko/codezero.git
synced 2026-11-30 20:54:21 +01:00
Managed to pass utcb information to tasks via an ipc() call.
Removed setting of tag during ipc_return(). So it does not overwrite return value anymore. Next stage is for the tasks to map their utcb via shmget/shmat before accessing.
This commit is contained in:
@@ -65,10 +65,14 @@ static inline int l4_send(l4id_t to, unsigned int tag)
|
|||||||
|
|
||||||
static inline int l4_sendrecv(l4id_t to, l4id_t from, unsigned int tag)
|
static inline int l4_sendrecv(l4id_t to, l4id_t from, unsigned int tag)
|
||||||
{
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
BUG_ON(to == L4_NILTHREAD || from == L4_NILTHREAD);
|
BUG_ON(to == L4_NILTHREAD || from == L4_NILTHREAD);
|
||||||
l4_set_tag(tag);
|
l4_set_tag(tag);
|
||||||
|
|
||||||
return l4_ipc(to, from);
|
err = l4_ipc(to, from);
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int l4_receive(l4id_t from)
|
static inline int l4_receive(l4id_t from)
|
||||||
@@ -93,16 +97,25 @@ static inline int l4_get_retval(void)
|
|||||||
return read_mr(MR_RETURN);
|
return read_mr(MR_RETURN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void l4_print_mrs()
|
||||||
|
{
|
||||||
|
printf("Message registers: 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n",
|
||||||
|
read_mr(0), read_mr(1), read_mr(2), read_mr(3),
|
||||||
|
read_mr(4), read_mr(5));
|
||||||
|
}
|
||||||
|
|
||||||
/* Servers:
|
/* Servers:
|
||||||
* Return the ipc result back to requesting task.
|
* Return the ipc result back to requesting task.
|
||||||
*/
|
*/
|
||||||
static inline int l4_ipc_return(int retval)
|
static inline int l4_ipc_return(int retval)
|
||||||
{
|
{
|
||||||
unsigned int tag = l4_get_tag();
|
// unsigned int tag = l4_get_tag();
|
||||||
l4id_t sender = l4_get_sender();
|
l4id_t sender = l4_get_sender();
|
||||||
|
|
||||||
l4_set_retval(retval);
|
l4_set_retval(retval);
|
||||||
return l4_send(sender, tag);
|
|
||||||
|
/* Setting the tag may overwrite retval so we l4_send without tagging */
|
||||||
|
return l4_ipc(sender, L4_NILTHREAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A helper that translates and maps a physical address to virtual */
|
/* A helper that translates and maps a physical address to virtual */
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ END_PROC(l4_kread)
|
|||||||
BEGIN_PROC(l4_ipc)
|
BEGIN_PROC(l4_ipc)
|
||||||
stmfd sp!, {r4-r8,lr} @ Save context.
|
stmfd sp!, {r4-r8,lr} @ Save context.
|
||||||
utcb_address r12 @ Get utcb address.
|
utcb_address r12 @ Get utcb address.
|
||||||
ldmia r12!, {r3-r8} @ Load 6 Message registers from utcb. MR1-MR5
|
ldmia r12!, {r3-r8} @ Load 6 Message registers from utcb. MR0-MR5
|
||||||
ldr r12, =__l4_ipc
|
ldr r12, =__l4_ipc
|
||||||
mov lr, pc
|
mov lr, pc
|
||||||
ldr pc, [r12]
|
ldr pc, [r12]
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ int task_send_utcb_address(l4id_t sender, l4id_t taskid)
|
|||||||
task->utcb_address = (unsigned long)utcb_vaddr_new();
|
task->utcb_address = (unsigned long)utcb_vaddr_new();
|
||||||
|
|
||||||
/* Return it to requester */
|
/* Return it to requester */
|
||||||
printf("%s: Returning 0x%x\n", __FUNCTION__, task->utcb_address);
|
|
||||||
return l4_ipc_return(task->utcb_address);
|
return l4_ipc_return(task->utcb_address);
|
||||||
|
|
||||||
/* A task is asking for someone else's utcb */
|
/* A task is asking for someone else's utcb */
|
||||||
@@ -64,8 +63,6 @@ int task_send_utcb_address(l4id_t sender, l4id_t taskid)
|
|||||||
* none allocated so far, requester gets 0. We don't
|
* none allocated so far, requester gets 0. We don't
|
||||||
* allocate one here.
|
* allocate one here.
|
||||||
*/
|
*/
|
||||||
printf("%s: Returning 0x%x\n", __FUNCTION__,
|
|
||||||
task->utcb_address);
|
|
||||||
return l4_ipc_return(task->utcb_address);
|
return l4_ipc_return(task->utcb_address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user