DCSR cause was moved, bug debug ROM wasn't updated
authorTim Newsome <tim@sifive.com>
Fri, 3 Jun 2016 20:08:09 +0000 (13:08 -0700)
committerTim Newsome <tim@sifive.com>
Fri, 3 Jun 2016 20:08:09 +0000 (13:08 -0700)
As a result Debug ROM would always take the spontaneous halt code path.
This didn't hurt spike since (so far?) the spike debug handler doesn't
attempt to do anything quick while code is running. But now the ROM is
more correct.

debug_rom/debug_rom.S
debug_rom/debug_rom.h

index 457104f05cfe0c71e8fc1daf2f16f3fd2b71ca99..9e83098116c9abea051d84843d5d2fc26794b73d 100755 (executable)
@@ -72,9 +72,9 @@ _entry:
 
         # Check why we're here
         csrr    s0, CSR_DCSR
-        # cause is in bits 2:0 of dcsr
+        # cause is in bits 8:6 of dcsr
         andi    s0, s0, DCSR_CAUSE
-        addi    s0, s0, -DCSR_CAUSE_DEBUGINT
+        addi    s0, s0, -(DCSR_CAUSE_DEBUGINT<<6)
         bnez    s0, spontaneous_halt
 
 jdebugram:
index bbd7f237a272085f6904eb6c1dd89197f3bfb872..a929a27f99a77a54b2397ac9e2dc84b4137d7a2c 100644 (file)
@@ -8,7 +8,7 @@ static const unsigned char debug_rom_raw[] = {
   0x73, 0x24, 0x00, 0x7b, 0x13, 0x74, 0x84, 0x00, 0x63, 0x04, 0x04, 0x00,
   0x6f, 0x00, 0x80, 0x05, 0x73, 0x24, 0x20, 0x7b, 0x73, 0x00, 0x20, 0x7b,
   0x73, 0x10, 0x24, 0x7b, 0x73, 0x24, 0x00, 0x7b, 0x13, 0x74, 0x04, 0x1c,
-  0x13, 0x04, 0xd4, 0xff, 0x63, 0x18, 0x04, 0x02, 0x0f, 0x10, 0x00, 0x00,
+  0x13, 0x04, 0x04, 0xf4, 0x63, 0x18, 0x04, 0x02, 0x0f, 0x10, 0x00, 0x00,
   0x73, 0x24, 0x00, 0xf1, 0x63, 0x46, 0x04, 0x00, 0x23, 0x2e, 0x90, 0x42,
   0x67, 0x00, 0x00, 0x40, 0x13, 0x14, 0x14, 0x00, 0x63, 0x46, 0x04, 0x00,
   0x23, 0x3c, 0x90, 0x42, 0x67, 0x00, 0x00, 0x40, 0x13, 0x00, 0x00, 0x00,