summaryrefslogtreecommitdiff
path: root/cesar/ecos/packages/hal/sparc
diff options
context:
space:
mode:
authorschodet2010-02-23 13:13:49 +0000
committerschodet2010-02-23 13:13:49 +0000
commited6f1130c5145bf7b745b6c51cde05e568a43ab8 (patch)
tree9daa8f4e8c35c1af61b6fcd0ccd0e40d7186e16e /cesar/ecos/packages/hal/sparc
parent7376d3b7a71d76364bd09467117f03a1e69db17d (diff)
cesar/ecos: merge trace and interrupt stack code, refs #1263
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@6773 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/ecos/packages/hal/sparc')
-rw-r--r--cesar/ecos/packages/hal/sparc/arch/current/include/hal_intr.h19
-rw-r--r--cesar/ecos/packages/hal/sparc/arch/current/src/vec_ivsr.S56
2 files changed, 21 insertions, 54 deletions
diff --git a/cesar/ecos/packages/hal/sparc/arch/current/include/hal_intr.h b/cesar/ecos/packages/hal/sparc/arch/current/include/hal_intr.h
index 06b665aaee..489402b176 100644
--- a/cesar/ecos/packages/hal/sparc/arch/current/include/hal_intr.h
+++ b/cesar/ecos/packages/hal/sparc/arch/current/include/hal_intr.h
@@ -77,28 +77,21 @@
#include "hal/trace/trace_cpu.h"
-#if HAL_TRACE_CPU
-
-# ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
-# error "not compatible with HAL_TRACE_CPU"
-# endif
-
-/* Hook on interrupt stack switch callback. */
-externC void hal_interrupt_stack_call_pending_DSRs(void);
-#define HAL_INTERRUPT_STACK_CALL_PENDING_DSRS() \
- hal_interrupt_stack_call_pending_DSRs()
-
-#endif
+// Use the same callback as interrupt stack switching.
//---------------------------------------------------------------------------
// Routine to execute DSRs using separate interrupt stack
-#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
+#if defined (CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK) \
+ || HAL_TRACE_CPU
externC void hal_interrupt_stack_call_pending_DSRs(void);
#define HAL_INTERRUPT_STACK_CALL_PENDING_DSRS() \
hal_interrupt_stack_call_pending_DSRs()
+#endif
+
+#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
// these are offered solely for stack usage testing
// if they are not defined, then there is no interrupt stack.
#define HAL_INTERRUPT_STACK_BASE cyg_interrupt_stack_base
diff --git a/cesar/ecos/packages/hal/sparc/arch/current/src/vec_ivsr.S b/cesar/ecos/packages/hal/sparc/arch/current/src/vec_ivsr.S
index b227760c24..d595a2fe50 100644
--- a/cesar/ecos/packages/hal/sparc/arch/current/src/vec_ivsr.S
+++ b/cesar/ecos/packages/hal/sparc/arch/current/src/vec_ivsr.S
@@ -584,12 +584,14 @@ spurious_gic2:
!----------------------------------------------------------------------------
-#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
+#if defined (CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK) \
+ || HAL_TRACE_CPU
! This routine can only be called from a thread stack, maybe
! with interrupts (but not traps) disabled.
! It switches to the interrupt stack then calls back to the
! kernel to execute DSRs.
+! It is also used to trace DSR execution.
.global hal_interrupt_stack_call_pending_DSRs
hal_interrupt_stack_call_pending_DSRs:
@@ -602,8 +604,8 @@ hal_interrupt_stack_call_pending_DSRs:
st %o7, [ %sp + 25 * 4 ]
#endif
+#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
MARKSTACKUSED ! kilroy was here
-
! now switch stack to the interrupt stack, plus some headroom
! for saving a register set if we are interrupted
#if !defined(CYGPKG_HAL_SMP_SUPPORT)
@@ -618,41 +620,10 @@ hal_interrupt_stack_call_pending_DSRs:
ld [ %o0 + %o1 ], %o0
sub %o0, 24 * 4, %sp
#endif
-
MARKSTACKUSED ! kilroy was here
-
- .extern cyg_interrupt_call_pending_DSRs
- call cyg_interrupt_call_pending_DSRs
- nop
-
-#if !defined(CYGHWR_HAL_SPARC_FLAT)
- ret
- restore
-#else
- sub %i7, 26 * 4, %sp
- ld [ %sp + 24 * 4 ], %i7
- ld [ %sp + 25 * 4 ], %o7
- retl
- add %sp, 26 * 4, %sp
-#endif
-
#endif // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
-!----------------------------------------------------------------------------
-
#if HAL_TRACE_CPU
-
- .global hal_interrupt_stack_call_pending_DSRs
-hal_interrupt_stack_call_pending_DSRs:
-#if !defined(CYGHWR_HAL_SPARC_FLAT)
- save %sp, -24 * 4, %sp
-#else
- add %sp, -26 * 4, %sp
- st %i7, [ %sp + 24 * 4 ]
- sub %sp, -26 * 4, %i7
- st %o7, [ %sp + 25 * 4 ]
-#endif
-
! Trace.
! load bare->data_tail and bare->data_end
sethi %hi(hal_trace_cpu_bare_buffer), %o1
@@ -671,11 +642,13 @@ hal_interrupt_stack_call_pending_DSRs:
ld [ %o1 + %lo(hal_trace_cpu_bare_buffer + 8) ], %o2
! store modified bare->data_tail
1: st %o2, [ %o1 + %lo(hal_trace_cpu_bare_buffer) ]
+#endif
.extern cyg_interrupt_call_pending_DSRs
call cyg_interrupt_call_pending_DSRs
- nop
+ nop
+#if HAL_TRACE_CPU
! Trace.
! load bare->data_tail and bare->data_end
sethi %hi(hal_trace_cpu_bare_buffer), %o1
@@ -694,19 +667,20 @@ hal_interrupt_stack_call_pending_DSRs:
ld [ %o1 + %lo(hal_trace_cpu_bare_buffer + 8) ], %o2
! store modified bare->data_tail
1: st %o2, [ %o1 + %lo(hal_trace_cpu_bare_buffer) ]
+#endif
#if !defined(CYGHWR_HAL_SPARC_FLAT)
ret
- restore
+ restore
#else
- sub %i7, 26 * 4, %sp
- ld [ %sp + 24 * 4 ], %i7
- ld [ %sp + 25 * 4 ], %o7
- retl
- add %sp, 26 * 4, %sp
+ sub %i7, 26 * 4, %sp
+ ld [ %sp + 24 * 4 ], %i7
+ ld [ %sp + 25 * 4 ], %o7
+ retl
+ add %sp, 26 * 4, %sp
#endif
-#endif /* HAL_TRACE_CPU */
+#endif // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK || HAL_TRACE_CPU
!----------------------------------------------------------------------------