Fix breakpoint test when only one breakpoint present
authorAndrew Waterman <waterman@cs.berkeley.edu>
Sat, 18 Jun 2016 04:06:37 +0000 (21:06 -0700)
committerAndrew Waterman <waterman@cs.berkeley.edu>
Sat, 18 Jun 2016 04:06:37 +0000 (21:06 -0700)
isa/rv64mi/breakpoint.S

index 848435e64039c25bf3e8beff8a64c002c182a96b..77c9509c4e5f0d8ceb95c683271b5054dde27905 100644 (file)
@@ -16,7 +16,7 @@ RVTEST_CODE_BEGIN
   # Set up breakpoint to trap on M-mode fetches.
   li TESTNUM, 2
 
-  # Skip tdrselect is hard-wired.
+  # Skip tdrselect if hard-wired.
   li a0, 1<<(_RISCV_SZLONG-1)
   csrw tdrselect, a0
   csrr a1, tdrselect
@@ -87,6 +87,13 @@ RVTEST_CODE_BEGIN
   csrw tdrselect, a0
   csrr a1, tdrselect
   bne a0, a1, pass
+
+  # Make sure there's a breakpoint there.
+  csrr a0, tdrdata1
+  srli a0, a0, _RISCV_SZLONG-4
+  li a1, 1
+  bne a0, a1, pass
+
   li a0, BPCONTROL_M | BPCONTROL_R
   csrw tdrdata1, a0
   la a3, data2