summaryrefslogtreecommitdiff
path: root/firmware/thread.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2010-12-27 09:49:33 +0000
committerNils Wallménius <nils@rockbox.org>2010-12-27 09:49:33 +0000
commit479414faccedeeb1ca7d0b6074bd69f2ef6dd441 (patch)
treecc139d0cbc6e5491a0540b0892de027b80fc7093 /firmware/thread.c
parentbf897793d7275948b6d2953283448b890058488e (diff)
downloadrockbox-479414faccedeeb1ca7d0b6074bd69f2ef6dd441.tar.gz
rockbox-479414faccedeeb1ca7d0b6074bd69f2ef6dd441.zip
Fix profiling on coldfire with newer Gcc.
In switch_thread, make the call to profile_thread_stopped from an inline asm block to make sure the sp is pointing to the right place before storing the context. This apparently worked by luck with the old Gcc. The workaround used for coldfire in the codeclib's __cyg_profile_func_enter does not work with newer gcc, however the workaround isn't needed for those so enable it only for coldfire gcc version < 4. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28908 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/thread.c')
-rw-r--r--firmware/thread.c11
1 files changed, 11 insertions, 0 deletions
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