tracing: nios2: fix swap tracing

Fixed ordering of tracepoints for the nios2 architecture.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2020-08-04 17:03:05 -04:00 committed by Carles Cufí
commit c1a2c7992b

View file

@ -13,7 +13,6 @@ GTEXT(arch_swap)
GTEXT(z_thread_entry_wrapper) GTEXT(z_thread_entry_wrapper)
/* imports */ /* imports */
GTEXT(sys_trace_thread_switched_in)
GTEXT(_k_neg_eagain) GTEXT(_k_neg_eagain)
/* unsigned int arch_swap(unsigned int key) /* unsigned int arch_swap(unsigned int key)
@ -22,7 +21,7 @@ GTEXT(_k_neg_eagain)
*/ */
SECTION_FUNC(exception.other, arch_swap) SECTION_FUNC(exception.other, arch_swap)
#ifdef CONFIG_EXECUTION_BENCHMARKING #if defined(CONFIG_EXECUTION_BENCHMARKING) || defined(CONFIG_TRACING)
/* Get a reference to _kernel in r10 */ /* Get a reference to _kernel in r10 */
movhi r10, %hi(_kernel) movhi r10, %hi(_kernel)
ori r10, r10, %lo(_kernel) ori r10, r10, %lo(_kernel)
@ -35,7 +34,11 @@ SECTION_FUNC(exception.other, arch_swap)
stw ra, _thread_offset_to_ra(r11) stw ra, _thread_offset_to_ra(r11)
stw sp, _thread_offset_to_sp(r11) stw sp, _thread_offset_to_sp(r11)
#if CONFIG_TRACING
call sys_trace_thread_switched_out
#elif CONFIG_EXECUTION_BENCHMARKING
call read_timer_start_of_swap call read_timer_start_of_swap
#endif
/* Get a reference to _kernel in r10 */ /* Get a reference to _kernel in r10 */
movhi r10, %hi(_kernel) movhi r10, %hi(_kernel)
ori r10, r10, %lo(_kernel) ori r10, r10, %lo(_kernel)
@ -49,6 +52,7 @@ SECTION_FUNC(exception.other, arch_swap)
ldw sp, _thread_offset_to_sp(r11) ldw sp, _thread_offset_to_sp(r11)
#endif #endif
/* Get a reference to _kernel in r10 */ /* Get a reference to _kernel in r10 */
movhi r10, %hi(_kernel) movhi r10, %hi(_kernel)
ori r10, r10, %lo(_kernel) ori r10, r10, %lo(_kernel)
@ -84,13 +88,6 @@ SECTION_FUNC(exception.other, arch_swap)
ldw r4, (r5) ldw r4, (r5)
stw r4, _thread_offset_to_retval(r11) stw r4, _thread_offset_to_retval(r11)
#if CONFIG_TRACING
call sys_trace_thread_switched_in
/* restore caller-saved r10 */
movhi r10, %hi(_kernel)
ori r10, r10, %lo(_kernel)
#endif
/* get cached thread to run */ /* get cached thread to run */
ldw r2, _kernel_offset_to_ready_q_cache(r10) ldw r2, _kernel_offset_to_ready_q_cache(r10)
@ -142,7 +139,7 @@ no_unlock:
wrctl status, r3 wrctl status, r3
#endif #endif
#ifdef CONFIG_EXECUTION_BENCHMARKING #if defined(CONFIG_EXECUTION_BENCHMARKING) || defined(CONFIG_TRACING)
/* Get a reference to _kernel in r10 */ /* Get a reference to _kernel in r10 */
movhi r10, %hi(_kernel) movhi r10, %hi(_kernel)
ori r10, r10, %lo(_kernel) ori r10, r10, %lo(_kernel)
@ -154,7 +151,11 @@ no_unlock:
stw ra, _thread_offset_to_ra(r11) stw ra, _thread_offset_to_ra(r11)
stw sp, _thread_offset_to_sp(r11) stw sp, _thread_offset_to_sp(r11)
#if CONFIG_TRACING
call sys_trace_thread_switched_in
#elif CONFIG_EXECUTION_BENCHMARKING
call read_timer_end_of_swap call read_timer_end_of_swap
#endif
/* Get a reference to _kernel in r10 */ /* Get a reference to _kernel in r10 */
movhi r10, %hi(_kernel) movhi r10, %hi(_kernel)