diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-11-11 14:37:51 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-11-18 07:30:34 +0100 |
commit | d5e073cde70211b2471e4366be397370e9f6ce48 (patch) | |
tree | 7ee1e3cad3dd7dfbb52475af7bacc61b216dc0e5 /c/src/lib/libbsp/sparc/shared/irq_asm.S | |
parent | score: Add Per_CPU_Control::Interrupt_frame (diff) | |
download | rtems-d5e073cde70211b2471e4366be397370e9f6ce48.tar.bz2 |
score: Allow interrupts during thread dispatch
Use a processor-specific interrupt frame during context switches in case
the executing thread is longer executes on the processor and the heir
thread is about to start execution. During this period we must not use
a thread stack for interrupt processing.
Update #2809.
Diffstat (limited to 'c/src/lib/libbsp/sparc/shared/irq_asm.S')
-rw-r--r-- | c/src/lib/libbsp/sparc/shared/irq_asm.S | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/irq_asm.S b/c/src/lib/libbsp/sparc/shared/irq_asm.S index 7a595d1711..a842a62a1e 100644 --- a/c/src/lib/libbsp/sparc/shared/irq_asm.S +++ b/c/src/lib/libbsp/sparc/shared/irq_asm.S @@ -178,17 +178,22 @@ done_flushing: mov %g4, %wim #if defined(RTEMS_SMP) - ! The executing context no longer executes on this processor + /* + * The executing thread no longer executes on this processor. Switch + * the stack to the temporary interrupt stack of this processor. Mark + * the context of the executing thread as not executing. + */ + add %g6, PER_CPU_INTERRUPT_FRAME_AREA + CPU_INTERRUPT_FRAME_SIZE, %sp st %g0, [%o0 + SPARC_CONTEXT_CONTROL_IS_EXECUTING_OFFSET] ! Try to update the is executing indicator of the heir context mov 1, %g1 -try_update_is_executing: +.Ltry_update_is_executing: swap [%o1 + SPARC_CONTEXT_CONTROL_IS_EXECUTING_OFFSET], %g1 cmp %g1, 0 - bne check_is_executing + bne .Lcheck_is_executing ! The next load is in a delay slot, which is all right #endif @@ -225,12 +230,12 @@ try_update_is_executing: nop ! delay slot #if defined(RTEMS_SMP) -check_is_executing: +.Lcheck_is_executing: ! Check the is executing indicator of the heir context ld [%o1 + SPARC_CONTEXT_CONTROL_IS_EXECUTING_OFFSET], %g1 cmp %g1, 0 - beq try_update_is_executing + beq .Ltry_update_is_executing mov 1, %g1 ! We may have a new heir @@ -242,7 +247,7 @@ check_is_executing: ! Update the executing only if necessary to avoid cache line ! monopolization. cmp %g2, %g4 - beq try_update_is_executing + beq .Ltry_update_is_executing mov 1, %g1 ! Calculate the heir context pointer @@ -252,7 +257,7 @@ check_is_executing: ! Update the executing st %g4, [%g6 + PER_CPU_OFFSET_EXECUTING] - ba try_update_is_executing + ba .Ltry_update_is_executing mov 1, %g1 #endif |