From a13a1d5492ce30c51f4b2277819d2a6736705c90 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 28 Sep 2007 10:54:27 +0000 Subject: Anti-red: No need for COP initialization in the bootloaders nor idle stacks. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14880 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/system-target.h | 2 ++ firmware/thread.c | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'firmware') diff --git a/firmware/target/arm/system-target.h b/firmware/target/arm/system-target.h index 4811f7e2d6..6dc317e427 100644 --- a/firmware/target/arm/system-target.h +++ b/firmware/target/arm/system-target.h @@ -71,6 +71,7 @@ static inline unsigned int current_core(void) return core; } +#ifndef BOOTLOADER #define CACHE_FUNCTIONS_AS_CALL #define HAVE_INVALIDATE_ICACHE @@ -78,6 +79,7 @@ void invalidate_icache(void); #define HAVE_FLUSH_ICACHE void flush_icache(void); +#endif #else unsigned int current_core(void); diff --git a/firmware/thread.c b/firmware/thread.c index d0a0229430..b37a99237d 100644 --- a/firmware/thread.c +++ b/firmware/thread.c @@ -81,7 +81,7 @@ static void start_thread(void) "ldr r4, [r0, #40] \n" /* start in r4 since it's non-volatile */ "mov r1, #0 \n" /* Mark thread as running */ "str r1, [r0, #40] \n" -#if NUM_CORES > 1 +#if NUM_CORES > 1 && !defined (BOOTLOADER) "ldr r0, =invalidate_icache \n" /* Invalidate this core's cache. */ "mov lr, pc \n" /* This could be the first entry into */ "bx r0 \n" /* plugin or codec code for this core. */ @@ -132,11 +132,13 @@ extern int cpu_idlestackbegin[]; extern int cpu_idlestackend[]; extern int cop_idlestackbegin[]; extern int cop_idlestackend[]; +#ifndef BOOTLOADER static int * const idle_stacks[NUM_CORES] NOCACHEDATA_ATTR = { [CPU] = cpu_idlestackbegin, [COP] = cop_idlestackbegin }; +#endif /* BOOTLOADER */ #else /* NUM_CORES == 1 */ #ifndef BOOTLOADER extern int cop_stackbegin[]; @@ -171,10 +173,13 @@ static inline void core_sleep(void) */ static inline void switch_to_idle_stack(const unsigned int core) { +#ifndef BOOTLOADER asm volatile ( "str sp, [%0] \n" /* save original stack pointer on idle stack */ "mov sp, %0 \n" /* switch stacks */ : : "r"(&idle_stacks[core][IDLE_STACK_WORDS-1])); +#endif + (void)core; } #endif /* NUM_CORES */ @@ -926,7 +931,9 @@ struct thread_entry* /* Writeback stack munging or anything else before starting */ if (core != CURRENT_CORE) + { flush_icache(); + } #endif /* Align stack to an even 32 bit boundary */ @@ -1086,6 +1093,7 @@ void init_threads(void) } else { +#ifndef BOOTLOADER /* Initial stack is the COP idle stack */ threads[slot].stack = cop_idlestackbegin; threads[slot].stack_size = IDLE_STACK_SIZE; @@ -1096,7 +1104,8 @@ void init_threads(void) CPU_CTL = PROC_WAKE; set_irq_level(0); remove_thread(NULL); -#endif +#endif /* BOOTLOADER */ +#endif /* NUM_CORES */ } } @@ -1115,7 +1124,7 @@ int thread_stack_usage(const struct thread_entry *thread) thread->stack_size; } -#if NUM_CORES > 1 +#if NUM_CORES > 1 && !defined (BOOTLOADER) /*--------------------------------------------------------------------------- * Returns the maximum percentage of the core's idle stack ever used during * runtime. -- cgit v1.2.3