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 tdrselect if hard-wired.
20 li a0, 1<<(_RISCV_SZLONG-1)
25 # Make sure there's a breakpoint there.
27 srli a0, a0, _RISCV_SZLONG-4
33 li a0, BPCONTROL_M | BPCONTROL_X
35 # Skip if breakpoint type is unsupported.
41 # Trap handler should skip this instruction.
44 # Make sure reads don't trap.
49 # Set up breakpoint to trap on M-mode reads.
51 li a0, BPCONTROL_M | BPCONTROL_R
53 # Skip if breakpoint type is unsupported.
60 # Trap handler should skip this instruction.
64 # Make sure writes don't trap.
69 # Set up breakpoint to trap on M-mode stores.
71 li a0, BPCONTROL_M | BPCONTROL_W
73 # Skip if breakpoint type is unsupported.
78 # Trap handler should skip this instruction.
81 # Make sure store didn't succeed.
86 # Try to set up a second breakpoint.
87 li a0, (1<<(_RISCV_SZLONG-1)) + 1
92 # Make sure there's a breakpoint there.
94 srli a0, a0, _RISCV_SZLONG-4
98 li a0, BPCONTROL_M | BPCONTROL_R
103 # Make sure the second breakpoint triggers.
108 # Make sure the first breakpoint still triggers.
120 # Only even-numbered tests should trap.
124 li t0, CAUSE_BREAKPOINT