arch: aarch64: Add check on context switch

Check whether we actually need to schedule a new thread before calling
the context switch routine.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This commit is contained in:
Carlo Caione 2020-03-20 12:03:45 +01:00 committed by Ioannis Glaropoulos
commit 67e4ccbc51

View file

@ -209,6 +209,14 @@ offload:
b inv
context_switch:
/* Check if we need to context switch */
ldr x1, =_kernel
ldr x2, [x1, #_kernel_offset_to_current]
ldr x3, [x1, #_kernel_offset_to_ready_q_cache]
cmp x2, x3
beq exit
/* Switch thread */
bl z_arm64_context_switch
exit: