diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2009-02-11 12:55:51 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2009-02-11 12:55:51 +0000 |
commit | 21f0c9a2829415f52b64cbdf965b01525e78f17a (patch) | |
tree | b5cb8021097722969f75784011c9f64f991c0c3d /firmware/thread.c | |
parent | 4cd7597172d916db9fc99bde4c03b669366f852a (diff) | |
download | rockbox-21f0c9a2829415f52b64cbdf965b01525e78f17a.tar.gz rockbox-21f0c9a2829415f52b64cbdf965b01525e78f17a.zip |
Make basic cache functions into calls, and get rid of CACHE_FUNCTION_WRAPPERS and CACHE_FUNCTIONS_AS_CALL macros. Rename flush/invalidate_icache to cpucache_flush/invalidate. They're inlined only if an implementation isn't provided by defining HAVE_CPUCACHE_FLUSH/INVALIDATE.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19971 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/thread.c')
-rw-r--r-- | firmware/thread.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/firmware/thread.c b/firmware/thread.c index f779ca3ae0..ce78769d11 100644 --- a/firmware/thread.c +++ b/firmware/thread.c | |||
@@ -179,17 +179,17 @@ static void __attribute__((naked,used)) start_thread(void) | |||
179 | { | 179 | { |
180 | /* r0 = context */ | 180 | /* r0 = context */ |
181 | asm volatile ( | 181 | asm volatile ( |
182 | "ldr sp, [r0, #32] \n" /* Load initial sp */ | 182 | "ldr sp, [r0, #32] \n" /* Load initial sp */ |
183 | "ldr r4, [r0, #40] \n" /* start in r4 since it's non-volatile */ | 183 | "ldr r4, [r0, #40] \n" /* start in r4 since it's non-volatile */ |
184 | "mov r1, #0 \n" /* Mark thread as running */ | 184 | "mov r1, #0 \n" /* Mark thread as running */ |
185 | "str r1, [r0, #40] \n" | 185 | "str r1, [r0, #40] \n" |
186 | #if NUM_CORES > 1 | 186 | #if NUM_CORES > 1 |
187 | "ldr r0, =invalidate_icache \n" /* Invalidate this core's cache. */ | 187 | "ldr r0, =cpucache_invalidate \n" /* Invalidate this core's cache. */ |
188 | "mov lr, pc \n" /* This could be the first entry into */ | 188 | "mov lr, pc \n" /* This could be the first entry into */ |
189 | "bx r0 \n" /* plugin or codec code for this core. */ | 189 | "bx r0 \n" /* plugin or codec code for this core. */ |
190 | #endif | 190 | #endif |
191 | "mov lr, pc \n" /* Call thread function */ | 191 | "mov lr, pc \n" /* Call thread function */ |
192 | "bx r4 \n" | 192 | "bx r4 \n" |
193 | ); /* No clobber list - new thread doesn't care */ | 193 | ); /* No clobber list - new thread doesn't care */ |
194 | thread_exit(); | 194 | thread_exit(); |
195 | //asm volatile (".ltorg"); /* Dump constant pool */ | 195 | //asm volatile (".ltorg"); /* Dump constant pool */ |
@@ -668,7 +668,7 @@ static inline void switch_to_idle_stack(const unsigned int core) | |||
668 | static void core_switch_blk_op(unsigned int core, struct thread_entry *thread) | 668 | static void core_switch_blk_op(unsigned int core, struct thread_entry *thread) |
669 | { | 669 | { |
670 | /* Flush our data to ram */ | 670 | /* Flush our data to ram */ |
671 | flush_icache(); | 671 | cpucache_flush(); |
672 | /* Stash thread in r4 slot */ | 672 | /* Stash thread in r4 slot */ |
673 | thread->context.r[0] = (uint32_t)thread; | 673 | thread->context.r[0] = (uint32_t)thread; |
674 | /* Stash restart address in r5 slot */ | 674 | /* Stash restart address in r5 slot */ |
@@ -696,24 +696,24 @@ static void __attribute__((naked)) | |||
696 | * Stack access also isn't permitted until restoring the original stack and | 696 | * Stack access also isn't permitted until restoring the original stack and |
697 | * context. */ | 697 | * context. */ |
698 | asm volatile ( | 698 | asm volatile ( |
699 | "stmfd sp!, { r4-r12, lr } \n" /* Stack all non-volatile context on current core */ | 699 | "stmfd sp!, { r4-r12, lr } \n" /* Stack all non-volatile context on current core */ |
700 | "ldr r2, =idle_stacks \n" /* r2 = &idle_stacks[core][IDLE_STACK_WORDS] */ | 700 | "ldr r2, =idle_stacks \n" /* r2 = &idle_stacks[core][IDLE_STACK_WORDS] */ |
701 | "ldr r2, [r2, r0, lsl #2] \n" | 701 | "ldr r2, [r2, r0, lsl #2] \n" |
702 | "add r2, r2, %0*4 \n" | 702 | "add r2, r2, %0*4 \n" |
703 | "stmfd r2!, { sp } \n" /* save original stack pointer on idle stack */ | 703 | "stmfd r2!, { sp } \n" /* save original stack pointer on idle stack */ |
704 | "mov sp, r2 \n" /* switch stacks */ | 704 | "mov sp, r2 \n" /* switch stacks */ |
705 | "adr r2, 1f \n" /* r2 = new core restart address */ | 705 | "adr r2, 1f \n" /* r2 = new core restart address */ |
706 | "str r2, [r1, #40] \n" /* thread->context.start = r2 */ | 706 | "str r2, [r1, #40] \n" /* thread->context.start = r2 */ |
707 | "ldr pc, =switch_thread \n" /* r0 = thread after call - see load_context */ | 707 | "ldr pc, =switch_thread \n" /* r0 = thread after call - see load_context */ |
708 | "1: \n" | 708 | "1: \n" |
709 | "ldr sp, [r0, #32] \n" /* Reload original sp from context structure */ | 709 | "ldr sp, [r0, #32] \n" /* Reload original sp from context structure */ |
710 | "mov r1, #0 \n" /* Clear start address */ | 710 | "mov r1, #0 \n" /* Clear start address */ |
711 | "str r1, [r0, #40] \n" | 711 | "str r1, [r0, #40] \n" |
712 | "ldr r0, =invalidate_icache \n" /* Invalidate new core's cache */ | 712 | "ldr r0, =cpucache_invalidate \n" /* Invalidate new core's cache */ |
713 | "mov lr, pc \n" | 713 | "mov lr, pc \n" |
714 | "bx r0 \n" | 714 | "bx r0 \n" |
715 | "ldmfd sp!, { r4-r12, pc } \n" /* Restore non-volatile context to new core and return */ | 715 | "ldmfd sp!, { r4-r12, pc } \n" /* Restore non-volatile context to new core and return */ |
716 | ".ltorg \n" /* Dump constant pool */ | 716 | ".ltorg \n" /* Dump constant pool */ |
717 | : : "i"(IDLE_STACK_WORDS) | 717 | : : "i"(IDLE_STACK_WORDS) |
718 | ); | 718 | ); |
719 | (void)core; (void)thread; | 719 | (void)core; (void)thread; |
@@ -2457,7 +2457,7 @@ unsigned int create_thread(void (*function)(void), | |||
2457 | /* Writeback stack munging or anything else before starting */ | 2457 | /* Writeback stack munging or anything else before starting */ |
2458 | if (core != CURRENT_CORE) | 2458 | if (core != CURRENT_CORE) |
2459 | { | 2459 | { |
2460 | flush_icache(); | 2460 | cpucache_flush(); |
2461 | } | 2461 | } |
2462 | #endif | 2462 | #endif |
2463 | 2463 | ||
@@ -2597,7 +2597,7 @@ void thread_exit(void) | |||
2597 | switch_to_idle_stack(core); | 2597 | switch_to_idle_stack(core); |
2598 | } | 2598 | } |
2599 | 2599 | ||
2600 | flush_icache(); | 2600 | cpucache_flush(); |
2601 | 2601 | ||
2602 | /* At this point, this thread isn't using resources allocated for | 2602 | /* At this point, this thread isn't using resources allocated for |
2603 | * execution except the slot itself. */ | 2603 | * execution except the slot itself. */ |