diff --git a/src/api/ipc.c b/src/api/ipc.c index ab211b5..81a9ffd 100644 --- a/src/api/ipc.c +++ b/src/api/ipc.c @@ -196,6 +196,20 @@ static inline int __sys_ipc(l4id_t to, l4id_t from, unsigned int ipc_type) return ret; } +void printk_sysregs(struct syscall_args *regs) +{ + printk("System call registers for tid: %d\n", current->tid); + printk("R0: %x\n", regs->r0); + printk("R1: %x\n", regs->r1); + printk("R2: %x\n", regs->r2); + printk("R3: %x\n", regs->r3); + printk("R4: %x\n", regs->r4); + printk("R5: %x\n", regs->r5); + printk("R6: %x\n", regs->r6); + printk("R7: %x\n", regs->r7); + printk("R8: %x\n", regs->r8); +} + /* * sys_ipc has multiple functions. In a nutshell: * - Copies message registers from one thread to another. diff --git a/tasks/fs0/main.c b/tasks/fs0/main.c index 02e90da..b3d0987 100644 --- a/tasks/fs0/main.c +++ b/tasks/fs0/main.c @@ -71,7 +71,7 @@ void handle_fs_requests(void) void main(void) { - printf("\n\n%s: Started.\n", __TASKNAME__); + printf("\n\n%s: Started with tid: %d\n", __TASKNAME__, self_tid()); initialise(); diff --git a/tasks/libl4/include/l4lib/arch-arm/syscalls.h b/tasks/libl4/include/l4lib/arch-arm/syscalls.h index f118cd8..fccfce6 100644 --- a/tasks/libl4/include/l4lib/arch-arm/syscalls.h +++ b/tasks/libl4/include/l4lib/arch-arm/syscalls.h @@ -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; diff --git a/tasks/libl4/include/l4lib/arch-arm/syslib.h b/tasks/libl4/include/l4lib/arch-arm/syslib.h index 7825156..aa68300 100644 --- a/tasks/libl4/include/l4lib/arch-arm/syslib.h +++ b/tasks/libl4/include/l4lib/arch-arm/syslib.h @@ -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: diff --git a/tasks/libl4/src/arm/syscalls.S b/tasks/libl4/src/arm/syscalls.S index d9c01b6..c4f39cb 100644 --- a/tasks/libl4/src/arm/syscalls.S +++ b/tasks/libl4/src/arm/syscalls.S @@ -43,12 +43,12 @@ END_PROC(l4_kread) /* * Inter-process communication. Loads message registers as arguments before the call, - * and stores them as results after the call. @r0 = to, @r1 = from, @r2 = tag. + * and stores them as results after the call. @r0 = to, @r1 = from. */ BEGIN_PROC(l4_ipc) stmfd sp!, {r4-r8,lr} @ Save context. utcb_address r12 @ Get utcb address. - ldmib r12!, {r3-r8} @ Load 5 Message registers from utcb. MR1-MR5 + ldmia r12!, {r3-r8} @ Load 6 Message registers from utcb. MR1-MR5 ldr r12, =__l4_ipc mov lr, pc ldr pc, [r12] diff --git a/tasks/mm0/main.c b/tasks/mm0/main.c index 9f6d225..8b0c60e 100644 --- a/tasks/mm0/main.c +++ b/tasks/mm0/main.c @@ -105,7 +105,11 @@ void handle_requests(void) } default: printf("%s: Unrecognised ipc tag (%d) " - "received. Ignoring.\n", __TASKNAME__, tag); + "received from (%d). Full mr reading: " + "%u, %u, %u, %u, %u, %u. Ignoring.\n", + __TASKNAME__, tag, sender, read_mr(0), + read_mr(1), read_mr(2), read_mr(3), read_mr(4), + read_mr(5)); } } diff --git a/tasks/test0/main.c b/tasks/test0/main.c index 576110b..6ed7223 100644 --- a/tasks/test0/main.c +++ b/tasks/test0/main.c @@ -17,13 +17,15 @@ void wait_pager(l4id_t partner) { printf("%s: Syncing with pager.\n", __TASKNAME__); + for (int i = 0; i < 6; i++) + write_mr(i, i); l4_send(partner, L4_IPC_TAG_WAIT); printf("Pager synced with us.\n"); } void main(void) { - printf("\n%s: Started.\n", __TASKNAME__); + printf("\n%s: Started with tid %d.\n", __TASKNAME__, self_tid()); /* Sync with pager */ while (1) wait_pager(0);