summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c/src/exec/score/cpu/sparc/cpu.h4
-rw-r--r--c/src/exec/score/cpu/sparc/cpu_asm.S2
-rw-r--r--c/src/lib/libbsp/sparc/erc32/start/start.S5
-rw-r--r--c/src/lib/libbsp/sparc/erc32/startsis/startsis.S5
-rw-r--r--c/src/lib/libbsp/sparc/erc32/startup/bspstart.c2
-rw-r--r--c/src/lib/libbsp/sparc/erc32/startup/spurious.c52
-rw-r--r--cpukit/score/cpu/sparc/cpu_asm.S2
7 files changed, 55 insertions, 17 deletions
diff --git a/c/src/exec/score/cpu/sparc/cpu.h b/c/src/exec/score/cpu/sparc/cpu.h
index 592a3a438f..cf50f035d6 100644
--- a/c/src/exec/score/cpu/sparc/cpu.h
+++ b/c/src/exec/score/cpu/sparc/cpu.h
@@ -472,7 +472,7 @@ typedef struct {
unsigned32 i6_fp;
unsigned32 i7;
unsigned32 y;
- unsigned32 pad0_offset;
+ unsigned32 tpc;
} CPU_Interrupt_frame;
#endif /* ASM */
@@ -501,7 +501,7 @@ typedef struct {
#define ISF_I6_FP_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x40
#define ISF_I7_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x44
#define ISF_Y_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x48
-#define ISF_PAD0_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x4c
+#define ISF_TPC_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x4c
#define CONTEXT_CONTROL_INTERRUPT_FRAME_SIZE CPU_MINIMUM_STACK_FRAME_SIZE + 0x50
#ifndef ASM
diff --git a/c/src/exec/score/cpu/sparc/cpu_asm.S b/c/src/exec/score/cpu/sparc/cpu_asm.S
index 39962eedeb..d980d4bff7 100644
--- a/c/src/exec/score/cpu/sparc/cpu_asm.S
+++ b/c/src/exec/score/cpu/sparc/cpu_asm.S
@@ -336,6 +336,7 @@ SYM(_ISR_Handler):
! Is this a synchronous trap?
be,a win_ovflow ! No, then skip the adjustment
nop ! DELAY
+ mov %l1, %l6 ! save trapped pc for debug info
mov %l2, %l1 ! do not return to the instruction
add %l2, 4, %l2 ! indicated
@@ -441,6 +442,7 @@ save_isf:
rd %y, %g1
st %g1, [%sp + ISF_Y_OFFSET] ! save y
+ st %l6, [%sp + ISF_TPC_OFFSET] ! save real trapped pc
mov %sp, %o1 ! 2nd arg to ISR Handler
diff --git a/c/src/lib/libbsp/sparc/erc32/start/start.S b/c/src/lib/libbsp/sparc/erc32/start/start.S
index 6097c4ab36..960dd9618d 100644
--- a/c/src/lib/libbsp/sparc/erc32/start/start.S
+++ b/c/src/lib/libbsp/sparc/erc32/start/start.S
@@ -136,7 +136,10 @@ __ERC32_MEC_Timer_Control_Mirror:
BAD_TRAP; BAD_TRAP; ! 7C - 7D undefined
_CLOCK_SPEED:
- BAD_TRAP; BAD_TRAP; ! BAD_TRAP; BAD_TRAP; ! 7E - 7F undefined
+
+ .word 0x0a, 0, 0, 0 ! 7E (10 MHz default)
+
+ BAD_TRAP; ! 7F undefined
/*
* Software traps
diff --git a/c/src/lib/libbsp/sparc/erc32/startsis/startsis.S b/c/src/lib/libbsp/sparc/erc32/startsis/startsis.S
index 6097c4ab36..960dd9618d 100644
--- a/c/src/lib/libbsp/sparc/erc32/startsis/startsis.S
+++ b/c/src/lib/libbsp/sparc/erc32/startsis/startsis.S
@@ -136,7 +136,10 @@ __ERC32_MEC_Timer_Control_Mirror:
BAD_TRAP; BAD_TRAP; ! 7C - 7D undefined
_CLOCK_SPEED:
- BAD_TRAP; BAD_TRAP; ! BAD_TRAP; BAD_TRAP; ! 7E - 7F undefined
+
+ .word 0x0a, 0, 0, 0 ! 7E (10 MHz default)
+
+ BAD_TRAP; ! 7F undefined
/*
* Software traps
diff --git a/c/src/lib/libbsp/sparc/erc32/startup/bspstart.c b/c/src/lib/libbsp/sparc/erc32/startup/bspstart.c
index 0219dfeccc..d314ff3050 100644
--- a/c/src/lib/libbsp/sparc/erc32/startup/bspstart.c
+++ b/c/src/lib/libbsp/sparc/erc32/startup/bspstart.c
@@ -103,6 +103,7 @@ rtems_extension fast_idle_switch_hook(
void bsp_postdriver_hook(void);
void bsp_libc_init( void *, unsigned32, int );
+extern void bsp_spurious_initialize();
/*
* bsp_pretasking_hook
@@ -161,6 +162,7 @@ void bsp_pretasking_hook(void)
rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
#endif
+ bsp_spurious_initialize();
}
/*
diff --git a/c/src/lib/libbsp/sparc/erc32/startup/spurious.c b/c/src/lib/libbsp/sparc/erc32/startup/spurious.c
index fa1a704079..30b0a0120a 100644
--- a/c/src/lib/libbsp/sparc/erc32/startup/spurious.c
+++ b/c/src/lib/libbsp/sparc/erc32/startup/spurious.c
@@ -21,6 +21,17 @@
static const char digits[16] = "0123456789abcdef";
+/* Simple integer-to-string conversion */
+
+void itos(unsigned32 u, char *s)
+{
+ int i;
+
+ for (i=0; i<8; i++) {
+ s[i] = digits[(u >> (28 - (i*4))) & 0x0f];
+ }
+}
+
/*
* bsp_spurious_handler
*
@@ -28,17 +39,21 @@ static const char digits[16] = "0123456789abcdef";
*/
rtems_isr bsp_spurious_handler(
- rtems_vector_number trap
+ rtems_vector_number trap,
+ CPU_Interrupt_frame *isf
)
{
char line[ 80 ];
- int length;
rtems_unsigned32 real_trap;
- DEBUG_puts( "Spurious Trap" );
-
real_trap = SPARC_REAL_TRAP_NUMBER(trap);
+ strcpy(line, "Unexpected trap (0x ) at address 0x ");
+ line[ 19 ] = digits[ real_trap >> 4 ];
+ line[ 20 ] = digits[ real_trap & 0xf ];
+ itos(isf->tpc, &line[36]);
+ DEBUG_puts( line );
+
switch (real_trap) {
/*
@@ -67,7 +82,9 @@ rtems_isr bsp_spurious_handler(
DEBUG_puts( "fp exception" );
break;
case 0x09:
- DEBUG_puts( "data access exception" );
+ strcpy(line, "data access exception at 0x " );
+ itos(ERC32_MEC.First_Failing_Address, &line[27]);
+ DEBUG_puts( line );
break;
case 0x0A:
DEBUG_puts( "tag overflow" );
@@ -124,11 +141,6 @@ rtems_isr bsp_spurious_handler(
break;
default:
- strcpy( line, "Number 0x " );
- length = strlen ( line );
- line[ length - 2 ] = digits[ real_trap >> 4 ];
- line[ length - 1 ] = digits[ real_trap & 0xf ];
- DEBUG_puts( line );
break;
}
@@ -142,23 +154,37 @@ rtems_isr bsp_spurious_handler(
/*
* bsp_spurious_initialize
*
- * Install the spurious handler for most traps.
+ * Install the spurious handler for most traps. Note that set_vector()
+ * will unmask the corresponding asynchronous interrupt, so the initial
+ * interrupt mask is restored after the handlers are installed.
*/
void bsp_spurious_initialize()
{
rtems_unsigned32 trap;
+ unsigned32 level = 15;
+ unsigned32 mask;
+
+ sparc_disable_interrupts(level);
+ mask = ERC32_MEC.Interrupt_Mask;
for ( trap=0 ; trap<256 ; trap++ ) {
/*
* Skip window overflow, underflow, and flush as well as software
- * trap 0 which we will use as a shutdown.
+ * trap 0 which we will use as a shutdown. Also avoid trap 0x70 - 0x7f
+ * which cannot happen and where some of the space is used to pass
+ * paramaters to the program.
*/
- if ( trap == 5 || trap == 6 || trap == 0x83 || trap == 0x80)
+ if (( trap == 5 || trap == 6 || trap == 0x83 ) ||
+ (( trap >= 0x70 ) && ( trap <= 0x80 )))
continue;
set_vector( bsp_spurious_handler, SPARC_SYNCHRONOUS_TRAP( trap ), 1 );
}
+
+ ERC32_MEC.Interrupt_Mask = mask;
+ sparc_enable_interrupts(level);
+
}
diff --git a/cpukit/score/cpu/sparc/cpu_asm.S b/cpukit/score/cpu/sparc/cpu_asm.S
index 39962eedeb..d980d4bff7 100644
--- a/cpukit/score/cpu/sparc/cpu_asm.S
+++ b/cpukit/score/cpu/sparc/cpu_asm.S
@@ -336,6 +336,7 @@ SYM(_ISR_Handler):
! Is this a synchronous trap?
be,a win_ovflow ! No, then skip the adjustment
nop ! DELAY
+ mov %l1, %l6 ! save trapped pc for debug info
mov %l2, %l1 ! do not return to the instruction
add %l2, 4, %l2 ! indicated
@@ -441,6 +442,7 @@ save_isf:
rd %y, %g1
st %g1, [%sp + ISF_Y_OFFSET] ! save y
+ st %l6, [%sp + ISF_TPC_OFFSET] ! save real trapped pc
mov %sp, %o1 ! 2nd arg to ISR Handler