diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/target/coldfire/thread-coldfire.c | 14 | ||||
-rw-r--r-- | firmware/thread.c | 9 |
2 files changed, 15 insertions, 8 deletions
diff --git a/firmware/target/coldfire/thread-coldfire.c b/firmware/target/coldfire/thread-coldfire.c index f151a971c7..c94580a4e7 100644 --- a/firmware/target/coldfire/thread-coldfire.c +++ b/firmware/target/coldfire/thread-coldfire.c @@ -95,3 +95,17 @@ static inline void core_sleep(void) /* Supervisor mode, interrupts enabled upon wakeup */ asm volatile ("stop #0x2000"); }; + +/*--------------------------------------------------------------------------- + * Call this from asm to make sure the sp is pointing to the + * correct place before the context is saved. + *--------------------------------------------------------------------------- + */ +static inline void _profile_thread_stopped(int current_thread) +{ + asm volatile ("move.l %[id], -(%%sp)\n\t" + "jsr profile_thread_stopped\n\t" + "addq.l #4, %%sp\n\t" + :: [id] "r" (current_thread) + : "cc", "memory"); +} diff --git a/firmware/thread.c b/firmware/thread.c index 91fe81be4a..6cd4d33c6e 100644 --- a/firmware/thread.c +++ b/firmware/thread.c @@ -1150,14 +1150,7 @@ void switch_thread(void) #ifdef RB_PROFILE #ifdef CPU_COLDFIRE - /* Call this from asm to make sure the sp is pointing to the - correct place before the context is saved */ - uint16_t id = thread->id & THREAD_ID_SLOT_MASK; - asm volatile ("move.l %[id], -(%%sp)\n\t" - "jsr profile_thread_stopped\n\t" - "addq.l #4, %%sp\n\t" - :: [id] "r" (id) - : "cc", "memory"); + _profile_thread_stopped(thread->id & THREAD_ID_SLOT_MASK); #else profile_thread_stopped(thread->id & THREAD_ID_SLOT_MASK); #endif |