summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-05-08 10:11:13 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-05-08 13:02:40 +0200
commit11b05f11d4d6d61717e345d20f492977b95ab131 (patch)
tree5f5bd2a21ea205ea0700d44718de7fcac8234fe7 /c
parentdoc: Use @dfn for glossary terms (diff)
downloadrtems-11b05f11d4d6d61717e345d20f492977b95ab131.tar.bz2
score: Fix CPU context usage on SMP
We must not alter the is executing indicator in _CPU_Context_Initialize() since this would cause an invalid state during a self restart. The is executing indicator must be valid at creation time since otherwise _Thread_Kill_zombies() uses an undefined value for not started threads. This could result in a system life lock.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/sparc/shared/irq_asm.S6
-rw-r--r--c/src/lib/libcpu/powerpc/new-exceptions/cpu.c6
-rw-r--r--c/src/lib/libcpu/powerpc/new-exceptions/cpu_asm.S14
3 files changed, 9 insertions, 17 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/irq_asm.S b/c/src/lib/libbsp/sparc/shared/irq_asm.S
index 8b152840ed..bf2dca9787 100644
--- a/c/src/lib/libbsp/sparc/shared/irq_asm.S
+++ b/c/src/lib/libbsp/sparc/shared/irq_asm.S
@@ -164,17 +164,17 @@ done_flushing:
nop
#if defined(RTEMS_SMP)
- ! Indicate that this context is no longer executing
+ ! The executing context no longer executes on this processor
stb %g0, [%o0 + SPARC_CONTEXT_CONTROL_IS_EXECUTING_OFFSET]
- ! Wait for context to stop execution if necessary
+ ! Wait for heir context to stop execution
1:
ldub [%o1 + SPARC_CONTEXT_CONTROL_IS_EXECUTING_OFFSET], %g1
cmp %g1, 0
bne 1b
mov 1, %g1
- ! Indicate that this context is executing
+ ! The heir context executes now on this processor
stb %g1, [%o1 + SPARC_CONTEXT_CONTROL_IS_EXECUTING_OFFSET]
#endif
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c b/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
index 32c0489308..c12a04e6d1 100644
--- a/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
+++ b/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
@@ -123,17 +123,11 @@ void _CPU_Context_Initialize(
else
msr_value &= ~PPC_MSR_FP;
- memset( the_context, 0, sizeof( *the_context ) );
-
the_ppc_context = ppc_get_context( the_context );
the_ppc_context->gpr1 = sp;
the_ppc_context->msr = msr_value;
the_ppc_context->lr = (uint32_t) entry_point;
-#ifdef RTEMS_SMP
- the_ppc_context->is_executing = false;
-#endif
-
#ifdef __ALTIVEC__
_CPU_Context_initialize_altivec( the_ppc_context );
#endif
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 4e74996d4c..6bde8bd11e 100644
--- a/c/src/lib/libcpu/powerpc/new-exceptions/cpu_asm.S
+++ b/c/src/lib/libcpu/powerpc/new-exceptions/cpu_asm.S
@@ -327,28 +327,26 @@ PROC (_CPU_Context_switch):
stw r2, PPC_CONTEXT_OFFSET_GPR2(r3)
#ifdef RTEMS_SMP
- /* Indicate that this context is no longer executing */
+ /* The executing context no longer executes on this processor */
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 */
+ /* Wait for heir context to stop execution */
1:
lbz r5, PPC_CONTEXT_OFFSET_IS_EXECUTING(r4)
cmpwi r5, 0
bne 1b
- /* Indicate that this context is executing */
+ /* The heir context executes now on this processor */
li r5, 1
stb r5, PPC_CONTEXT_OFFSET_IS_EXECUTING(r4)
isync
#endif
+ /* Restore context from r4 */
+restore_context:
+
#ifdef __ALTIVEC__
mr r14, r4
.extern _CPU_Context_switch_altivec