Skip to content

Commit 9da5a78

Browse files
tbr-ttioannisg
authored andcommitted
SPARC: catch unexpected softare traps
Unexpected software traps ("ta" instruction) are now handled by the fatal exception handler and eventually end up in z_fatal_error(). Signed-off-by: Martin Åberg <[email protected]>
1 parent 9fd4ea9 commit 9da5a78

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

arch/sparc/core/trap_table_mvt.S

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,19 @@
3737
jmp %g4+%lo(handler); \
3838
nop;
3939

40-
#define SOFT_TRAP \
40+
/*
41+
* Generate the "trap in trap" condition which causes the processor to halt and
42+
* enter error mode. Typically used to stop a simulator (QEMU, TSIM) or leave
43+
* control to a hardware debug monitor (LEON DSU via GRMON).
44+
*/
45+
#define TRAP_IN_TRAP \
4146
ta 0x00; \
4247
nop; \
4348
nop; \
4449
nop;
4550

51+
#define SOFT_TRAP BAD_TRAP
52+
4653
#define WOF_TRAP TRAP(__sparc_trap_window_overflow)
4754
#define WUF_TRAP TRAP(__sparc_trap_window_underflow)
4855
#define FLW_TRAP BAD_TRAP
@@ -145,7 +152,7 @@ __start:
145152

146153
/* trap_instruction 0x80 - 0xFF */
147154
/* NOTE: "ta 5" can be generated by compiler. */
148-
SOFT_TRAP; ! 0 System calls
155+
TRAP_IN_TRAP; ! 0 System calls
149156
SOFT_TRAP; ! 1 Breakpoints
150157
SOFT_TRAP; ! 2 Division by zero
151158
FLW_TRAP; ! 3 Flush windows

0 commit comments

Comments
 (0)