1 # See LICENSE for license details.
3 #*****************************************************************************
5 #-----------------------------------------------------------------------------
7 # Test breakpoints, if they are implemented.
10 #include "riscv_test.h"
11 #include "test_macros.h"
16 # Set up breakpoint to trap on M-mode fetches.
19 # Skip tselect if hard-wired.
24 # Make sure there's a breakpoint there.
26 srli a0, a0, __riscv_xlen - 4
32 li a0, MCONTROL_M | MCONTROL_EXECUTE
34 # Skip if breakpoint type is unsupported.
40 # Trap handler should skip this instruction.
43 # Make sure reads don't trap.
48 # Set up breakpoint to trap on M-mode reads.
50 li a0, MCONTROL_M | MCONTROL_LOAD
52 # Skip if breakpoint type is unsupported.
59 # Trap handler should skip this instruction.
63 # Make sure writes don't trap.
68 # Set up breakpoint to trap on M-mode stores.
70 li a0, MCONTROL_M | MCONTROL_STORE
72 # Skip if breakpoint type is unsupported.
77 # Trap handler should skip this instruction.
80 # Make sure store didn't succeed.
85 # Try to set up a second breakpoint.
91 # Make sure there's a breakpoint there.
93 srli a0, a0, __riscv_xlen - 4
97 li a0, MCONTROL_M | MCONTROL_LOAD
102 # Make sure the second breakpoint triggers.
107 # Make sure the first breakpoint still triggers.
119 .global mtvec_handler
121 # Only even-numbered tests should trap.
125 li t0, CAUSE_BREAKPOINT