From 023936d5e43ea53eaade66c8e30d538b9aa1b4f5 Mon Sep 17 00:00:00 2001 From: Thom Johansen Date: Tue, 31 Jan 2006 14:48:10 +0000 Subject: [PATCH] ARM: r12 is scratch, so don't save it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8505 a1c6a512-1295-4272-9138-f99709370657 --- firmware/thread.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/firmware/thread.c b/firmware/thread.c index d8282111b5..2dd4a9539c 100644 --- a/firmware/thread.c +++ b/firmware/thread.c @@ -44,7 +44,7 @@ struct regs #elif defined(CPU_ARM) struct regs { - unsigned int r[9]; /* Registers r4-r12 */ + unsigned int r[8]; /* Registers r4-r11 */ void *sp; /* Stack pointer (r13) */ unsigned int lr; /* r14 (lr) */ void *start; /* Thread start address, or NULL when started */ @@ -93,7 +93,7 @@ void profile_thread(void) { static inline void store_context(void* addr) { asm volatile( - "stmia %0, { r4-r14 } \n" + "stmia %0, { r4-r11, sp, lr }\n" : : "r" (addr) ); } @@ -105,17 +105,16 @@ static inline void store_context(void* addr) static inline void load_context(const void* addr) { asm volatile( - "ldmia %0, { r4-r14 } \n" /* load regs r4 to r14 from context */ - "ldr r0, [%0, #44] \n" /* load start pointer */ + "ldmia %0, { r4-r11, sp, lr }\n" /* load regs r4 to r14 from context */ + "ldr r0, [%0, #40] \n" /* load start pointer */ "mov r1, #0 \n" "cmp r0, r1 \n" /* check for NULL */ - "strne r1, [%0, #44] \n" /* if it's NULL, we're already running */ + "strne r1, [%0, #40] \n" /* if it's NULL, we're already running */ "movne pc, r0 \n" /* not already running, so jump to start */ : : "r" (addr) : "r0", "r1" ); } - #elif defined(CPU_COLDFIRE) /*--------------------------------------------------------------------------- * Store non-volatile context.