From 5fb370267f81a8429a76f0237767804b849d1f81 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Wed, 20 Aug 2014 05:58:59 -0400 Subject: Make sure load_context is the last thing in switch_thread. This should fix the android crash issue (fingers crossed). Change-Id: I9d3f773dbdf7dde60bd76962dcf66a3bad8b0925 --- firmware/kernel/thread.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/firmware/kernel/thread.c b/firmware/kernel/thread.c index bbd610122b..01395a9d6d 100644 --- a/firmware/kernel/thread.c +++ b/firmware/kernel/thread.c @@ -254,18 +254,18 @@ static NO_INLINE void thread_stkov(struct thread_entry *thread) static FORCE_INLINE void thread_store_context(struct thread_entry *thread) { + store_context(&thread->context); #if (CONFIG_PLATFORM & PLATFORM_HOSTED) thread->__errno = errno; #endif - store_context(&thread->context); } static FORCE_INLINE void thread_load_context(struct thread_entry *thread) { - load_context(&thread->context); #if (CONFIG_PLATFORM & PLATFORM_HOSTED) errno = thread->__errno; #endif + load_context(&thread->context); } static FORCE_INLINE unsigned int @@ -1101,12 +1101,12 @@ void switch_thread(void) RTR_UNLOCK(corep); enable_irq(); - /* And finally, give control to the next thread. */ - thread_load_context(thread); - #ifdef RB_PROFILE profile_thread_started(THREAD_ID_SLOT(thread->id)); #endif + + /* And finally, give control to the next thread. */ + thread_load_context(thread); } /*--------------------------------------------------------------------------- -- cgit v1.2.3