From 30de876a6c004b953ffe6beba02faf79f7283bc9 Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Mon, 15 Sep 2008 18:27:41 +0300 Subject: [PATCH] Added MR #define place holders so that these are used instead of real register names --- include/l4/glue/arm/message.h | 4 ++++ include/l4/glue/arm/syscall.h | 3 ++- tasks/libl4/src/arm/exregs.c | 4 ++-- tasks/libl4/src/arm/syscalls.S | 9 ++++----- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/l4/glue/arm/message.h b/include/l4/glue/arm/message.h index 5ceb86e..de3e1e4 100644 --- a/include/l4/glue/arm/message.h +++ b/include/l4/glue/arm/message.h @@ -16,4 +16,8 @@ #define MR_UNUSED_TOTAL (MR_TOTAL - MR_UNUSED_START) #define MR_USABLE_TOTAL MR_UNUSED_TOTAL +/* These are defined so that we don't hard-code register names */ +#define MR0_REGISTER r3 +#define MR_RETURN_REGISTER r3 + #endif /* __GLUE_ARM_MESSAGE_H__ */ diff --git a/include/l4/glue/arm/syscall.h b/include/l4/glue/arm/syscall.h index 73fd6dd..169d7f1 100644 --- a/include/l4/glue/arm/syscall.h +++ b/include/l4/glue/arm/syscall.h @@ -8,6 +8,7 @@ #define __ARM_GLUE_SYSCALL_H__ #include +#include INC_GLUE(message.h) /* Only specific call is the trap that gives back the kip address * from which other system calls can be discovered. */ @@ -57,7 +58,7 @@ typedef struct msg_regs { * that imitates a page fault ipc etc. */ #define KTCB_REF_ARG0(ktcb) (&(ktcb)->syscall_regs->r0) -#define KTCB_REF_MR0(ktcb) (&(ktcb)->syscall_regs->r3) +#define KTCB_REF_MR0(ktcb) (&(ktcb)->syscall_regs->MR0_REGISTER) /* Represents each syscall. We get argument registers * from stack for now. This is slower but the simplest. */ diff --git a/tasks/libl4/src/arm/exregs.c b/tasks/libl4/src/arm/exregs.c index 72928e5..0947289 100644 --- a/tasks/libl4/src/arm/exregs.c +++ b/tasks/libl4/src/arm/exregs.c @@ -12,7 +12,7 @@ void exregs_set_mr(struct exregs_data *s, int offset, unsigned long val) { /* Get MR0 */ - u32 *mr = &s->context.r3; + u32 *mr = &s->context.MR0_REGISTER; /* Sanity check */ BUG_ON(offset > MR_TOTAL || offset < 0); @@ -21,7 +21,7 @@ void exregs_set_mr(struct exregs_data *s, int offset, unsigned long val) mr[offset] = val; /* Set valid bit for mr register */ - s->valid_vect |= FIELD_TO_BIT(exregs_context_t, r3) << offset; + s->valid_vect |= FIELD_TO_BIT(exregs_context_t, MR0_REGISTER) << offset; } void exregs_set_pager(struct exregs_data *s, l4id_t pagerid) diff --git a/tasks/libl4/src/arm/syscalls.S b/tasks/libl4/src/arm/syscalls.S index 8b964a7..31ab29b 100644 --- a/tasks/libl4/src/arm/syscalls.S +++ b/tasks/libl4/src/arm/syscalls.S @@ -6,6 +6,8 @@ #include #include #include +#include +#include INC_GLUE(message.h) .macro utcb_address rx ldr \rx, =utcb @@ -43,10 +45,7 @@ END_PROC(l4_kread) * For clone() we need special assembler handling * Same signature as ipc(): @r0 = to, @r1 = from * - * NOTE: MR_RETURN register is hardcoded here. - * It must be updated if MR_RETURN offset is changed! - * - * NOTE: Note that this also breaks l4 system call interface, + * NOTE: Note that this breaks l4 system call interface, * this should be moved elsewhere and modified using existing l4 mechanisms. */ BEGIN_PROC(arch_clone) @@ -65,7 +64,7 @@ BEGIN_PROC(arch_clone) */ cmp r0, #0 @ Check ipc success blt ipc_failed - cmp r3, #0 @ Check ipc return register MR_RETURN. + cmp MR_RETURN_REGISTER, #0 @ Check ipc return register MR_RETURN. blt clone_failed @ Ipc was ok but clone() failed. bgt parent_return @ It has child pid, goto parent return. child: