diff options
Diffstat (limited to 'c/src/lib/libcpu/powerpc/new-exceptions/cpu_asm.S')
-rw-r--r-- | c/src/lib/libcpu/powerpc/new-exceptions/cpu_asm.S | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/cpu_asm.S b/c/src/lib/libcpu/powerpc/new-exceptions/cpu_asm.S index dcd33df789..4e74996d4c 100644 --- a/c/src/lib/libcpu/powerpc/new-exceptions/cpu_asm.S +++ b/c/src/lib/libcpu/powerpc/new-exceptions/cpu_asm.S @@ -326,9 +326,29 @@ PROC (_CPU_Context_switch): stw r2, PPC_CONTEXT_OFFSET_GPR2(r3) +#ifdef RTEMS_SMP + /* Indicate that this context is no longer executing */ + msync + li r5, 0 + stb r5, PPC_CONTEXT_OFFSET_IS_EXECUTING(r3) +#endif + /* Restore context from r4 */ restore_context: +#ifdef RTEMS_SMP + /* Wait for context to stop execution if necessary */ +1: + lbz r5, PPC_CONTEXT_OFFSET_IS_EXECUTING(r4) + cmpwi r5, 0 + bne 1b + + /* Indicate that this context is executing */ + li r5, 1 + stb r5, PPC_CONTEXT_OFFSET_IS_EXECUTING(r4) + isync +#endif + #ifdef __ALTIVEC__ mr r14, r4 .extern _CPU_Context_switch_altivec |