Skip to content

Commit

Permalink
SPARC: catch unexpected softare traps
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
tbr-tt authored and ioannisg committed Mar 25, 2021
1 parent 9fd4ea9 commit 9da5a78
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions arch/sparc/core/trap_table_mvt.S
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,19 @@
jmp %g4+%lo(handler); \
nop;

#define SOFT_TRAP \
/*
* Generate the "trap in trap" condition which causes the processor to halt and
* enter error mode. Typically used to stop a simulator (QEMU, TSIM) or leave
* control to a hardware debug monitor (LEON DSU via GRMON).
*/
#define TRAP_IN_TRAP \
ta 0x00; \
nop; \
nop; \
nop;

#define SOFT_TRAP BAD_TRAP

#define WOF_TRAP TRAP(__sparc_trap_window_overflow)
#define WUF_TRAP TRAP(__sparc_trap_window_underflow)
#define FLW_TRAP BAD_TRAP
Expand Down Expand Up @@ -145,7 +152,7 @@ __start:

/* trap_instruction 0x80 - 0xFF */
/* NOTE: "ta 5" can be generated by compiler. */
SOFT_TRAP; ! 0 System calls
TRAP_IN_TRAP; ! 0 System calls
SOFT_TRAP; ! 1 Breakpoints
SOFT_TRAP; ! 2 Division by zero
FLW_TRAP; ! 3 Flush windows
Expand Down

0 comments on commit 9da5a78

Please sign in to comment.