diff options
-rw-r--r-- | apps/codecs/lib/codeclib.c | 4 | ||||
-rw-r--r-- | firmware/thread.c | 11 |
2 files changed, 14 insertions, 1 deletions
diff --git a/apps/codecs/lib/codeclib.c b/apps/codecs/lib/codeclib.c index 329b0e2136..5af4e01fff 100644 --- a/apps/codecs/lib/codeclib.c +++ b/apps/codecs/lib/codeclib.c | |||
@@ -163,7 +163,9 @@ const uint8_t bs_clz_tab[256] ICONST_ATTR = { | |||
163 | 163 | ||
164 | #ifdef RB_PROFILE | 164 | #ifdef RB_PROFILE |
165 | void __cyg_profile_func_enter(void *this_fn, void *call_site) { | 165 | void __cyg_profile_func_enter(void *this_fn, void *call_site) { |
166 | #ifdef CPU_COLDFIRE | 166 | /* This workaround is required for coldfire gcc 3.4 but is broken for 4.4 |
167 | and 4.5, but for those the other way works. */ | ||
168 | #if defined(CPU_COLDFIRE) && defined(__GNUC__) && __GNUC__ < 4 | ||
167 | (void)call_site; | 169 | (void)call_site; |
168 | ci->profile_func_enter(this_fn, __builtin_return_address(1)); | 170 | ci->profile_func_enter(this_fn, __builtin_return_address(1)); |
169 | #else | 171 | #else |
diff --git a/firmware/thread.c b/firmware/thread.c index 655af1a940..91fe81be4a 100644 --- a/firmware/thread.c +++ b/firmware/thread.c | |||
@@ -1149,8 +1149,19 @@ void switch_thread(void) | |||
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | #ifdef RB_PROFILE | 1151 | #ifdef RB_PROFILE |
1152 | #ifdef CPU_COLDFIRE | ||
1153 | /* Call this from asm to make sure the sp is pointing to the | ||
1154 | correct place before the context is saved */ | ||
1155 | uint16_t id = thread->id & THREAD_ID_SLOT_MASK; | ||
1156 | asm volatile ("move.l %[id], -(%%sp)\n\t" | ||
1157 | "jsr profile_thread_stopped\n\t" | ||
1158 | "addq.l #4, %%sp\n\t" | ||
1159 | :: [id] "r" (id) | ||
1160 | : "cc", "memory"); | ||
1161 | #else | ||
1152 | profile_thread_stopped(thread->id & THREAD_ID_SLOT_MASK); | 1162 | profile_thread_stopped(thread->id & THREAD_ID_SLOT_MASK); |
1153 | #endif | 1163 | #endif |
1164 | #endif | ||
1154 | 1165 | ||
1155 | /* Begin task switching by saving our current context so that we can | 1166 | /* Begin task switching by saving our current context so that we can |
1156 | * restore the state of the current thread later to the point prior | 1167 | * restore the state of the current thread later to the point prior |