summaryrefslogtreecommitdiff
path: root/firmware/thread.c
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2006-01-31 14:48:10 +0000
committerThom Johansen <thomj@rockbox.org>2006-01-31 14:48:10 +0000
commit023936d5e43ea53eaade66c8e30d538b9aa1b4f5 (patch)
treedfa88d045c19b5310f5b85c258a2dcecf8982f94 /firmware/thread.c
parentae0ae6d5cf85ecd578b58a37a9a1839acf88c2cb (diff)
downloadrockbox-023936d5e43ea53eaade66c8e30d538b9aa1b4f5.tar.gz
rockbox-023936d5e43ea53eaade66c8e30d538b9aa1b4f5.zip
ARM: r12 is scratch, so don't save it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8505 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/thread.c')
-rw-r--r--firmware/thread.c11
1 files 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
44#elif defined(CPU_ARM) 44#elif defined(CPU_ARM)
45struct regs 45struct regs
46{ 46{
47 unsigned int r[9]; /* Registers r4-r12 */ 47 unsigned int r[8]; /* Registers r4-r11 */
48 void *sp; /* Stack pointer (r13) */ 48 void *sp; /* Stack pointer (r13) */
49 unsigned int lr; /* r14 (lr) */ 49 unsigned int lr; /* r14 (lr) */
50 void *start; /* Thread start address, or NULL when started */ 50 void *start; /* Thread start address, or NULL when started */
@@ -93,7 +93,7 @@ void profile_thread(void) {
93static inline void store_context(void* addr) 93static inline void store_context(void* addr)
94{ 94{
95 asm volatile( 95 asm volatile(
96 "stmia %0, { r4-r14 } \n" 96 "stmia %0, { r4-r11, sp, lr }\n"
97 : : "r" (addr) 97 : : "r" (addr)
98 ); 98 );
99} 99}
@@ -105,17 +105,16 @@ static inline void store_context(void* addr)
105static inline void load_context(const void* addr) 105static inline void load_context(const void* addr)
106{ 106{
107 asm volatile( 107 asm volatile(
108 "ldmia %0, { r4-r14 } \n" /* load regs r4 to r14 from context */ 108 "ldmia %0, { r4-r11, sp, lr }\n" /* load regs r4 to r14 from context */
109 "ldr r0, [%0, #44] \n" /* load start pointer */ 109 "ldr r0, [%0, #40] \n" /* load start pointer */
110 "mov r1, #0 \n" 110 "mov r1, #0 \n"
111 "cmp r0, r1 \n" /* check for NULL */ 111 "cmp r0, r1 \n" /* check for NULL */
112 "strne r1, [%0, #44] \n" /* if it's NULL, we're already running */ 112 "strne r1, [%0, #40] \n" /* if it's NULL, we're already running */
113 "movne pc, r0 \n" /* not already running, so jump to start */ 113 "movne pc, r0 \n" /* not already running, so jump to start */
114 : : "r" (addr) : "r0", "r1" 114 : : "r" (addr) : "r0", "r1"
115 ); 115 );
116} 116}
117 117
118
119#elif defined(CPU_COLDFIRE) 118#elif defined(CPU_COLDFIRE)
120/*--------------------------------------------------------------------------- 119/*---------------------------------------------------------------------------
121 * Store non-volatile context. 120 * Store non-volatile context.