From 448334c2eb8a8be159399e653624ad5e68c748a8 Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Tue, 12 Jul 2016 09:54:54 -0700 Subject: [PATCH] nios2: _Swap(): fix C calling issue The code expected r10 to be preserved across the call to the event logger, which wasn't reasonable given that it is caller- saved. Change-Id: I694357ea7ee9b410b93b5a0894e8c38c53127363 Signed-off-by: Andrew Boie --- arch/nios2/core/swap.S | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/nios2/core/swap.S b/arch/nios2/core/swap.S index 898f22f0510..3d2f8918c4b 100644 --- a/arch/nios2/core/swap.S +++ b/arch/nios2/core/swap.S @@ -63,6 +63,11 @@ SECTION_FUNC(exception.other, _Swap) #if CONFIG_KERNEL_EVENT_LOGGER_CONTEXT_SWITCH call _sys_k_event_logger_context_switch + /* Restore caller-saved r10. We could have stuck its value + * onto the stack, but less instructions to just use immediates + */ + movhi r10, %hi(_nanokernel) + ori r10, r10, %lo(_nanokernel) #endif /* Find the next context to run. Choose _nanokernel.fiber