Skip to contentSkip to conversation

mips: set CP0 Debug DExcCode for SDBBP instruction

PATCH In review Pavel Dovgalyuk 3 participants 3 messages May 2, 2017 – May 6, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mips: set CP0 Debug DExcCode for SDBBP instruction

From: Pavel Dovgalyuk <[email protected]>

This patch fixes setting DExcCode field of CP0 Debug register when SDBBP instruction is executed. According to EJTAG specification, this field must be set to the value 9 (Bp).

---
 target/mips/helper.c |    2 ++
 1 file changed, 2 insertions(+)
target/mips/helper.c +2 -0
index e359ca3b44..166f0d1243 100644
@@ -627,6 +627,8 @@ void mips_cpu_do_interrupt(CPUState *cs)
         goto set_DEPC;
     case EXCP_DBp:
         env->CP0_Debug |= 1 << CP0DB_DBp;
+        /* Setup DExcCode - SDBBP instruction */
+        env->CP0_Debug = (env->CP0_Debug & ~(0x1fULL << CP0DB_DEC)) | 9 << CP0DB_DEC;
         goto set_DEPC;
     case EXCP_DDBS:
         env->CP0_Debug |= 1 << CP0DB_DDBS;
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Pavel Dovgalyuk

From: Pavel Dovgalyuk <[email protected]>

This patch fixes setting DExcCode field of CP0 Debug register when SDBBP instruction is executed. According to EJTAG specification, this field must be set to the value 9 (Bp).

Quoted 19 lines
---
 target/mips/helper.c |    2 ++
 1 file changed, 2 insertions(+)
target/mips/helper.c +2 -0
index e359ca3b44..166f0d1243 100644
@@ -627,6 +627,8 @@ void mips_cpu_do_interrupt(CPUState *cs)
         goto set_DEPC;
     case EXCP_DBp:
         env->CP0_Debug |= 1 << CP0DB_DBp;
+        /* Setup DExcCode - SDBBP instruction */
+        env->CP0_Debug = (env->CP0_Debug & ~(0x1fULL << CP0DB_DEC)) | 9 << CP0DB_DEC;
         goto set_DEPC;
     case EXCP_DDBS:
         env->CP0_Debug |= 1 << CP0DB_DDBS;
Reviewed-by on v1 1/1
#2 lore raw
In reply to Pavel Dovgalyuk
Quoted 17 lines · Pavel Dovgalyuk

From: Pavel Dovgalyuk <[email protected]>

This patch fixes setting DExcCode field of CP0 Debug register when SDBBP instruction is executed. According to EJTAG specification, this field must be set to the value 9 (Bp).

---
 target/mips/helper.c |    2 ++
 1 file changed, 2 insertions(+)
target/mips/helper.c +0 -0
index e359ca3b44..166f0d1243 100644

target/mips/helper.c void mips_cpu_do_interrupt(CPUState *cs) · line 634

Quoted 8 lines
target/mips/helper.c +2 -0
@@ -627,6 +627,8 @@ void mips_cpu_do_interrupt(CPUState *cs)
         goto set_DEPC;
     case EXCP_DBp:
         env->CP0_Debug |= 1 << CP0DB_DBp;
+        /* Setup DExcCode - SDBBP instruction */
+        env->CP0_Debug = (env->CP0_Debug & ~(0x1fULL << CP0DB_DEC)) | 9 << CP0DB_DEC;
         goto set_DEPC;
     case EXCP_DDBS:
         env->CP0_Debug |= 1 << CP0DB_DDBS;
Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                 http://www.aurel32.net