Skip to contentSkip to conversation

target-openrisc: bugfix for dec_sys to decode instructions correctly

PATCH Applied David Morrison 3 participants 3 messages Jan 6, 2015 – Jan 12, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 target-openrisc: bugfix for dec_sys to decode instructions correctly

Fixed the decoding of "system" instructions (starting with 0x2) in dec_sys() in translate.c. In particular, the l.trap instruction is now correctly decoded, which enables for singlestepping and breakpoints to be set in GDB.

---
 target-openrisc/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Changes since previous version:
* Added 'signed-off-by' line; sorry to forget this before!

target-openrisc/translate.c +1 -1
index 407bd97..d36278f 100644
@@ -1320,7 +1320,7 @@ static void dec_sys(DisasContext *dc, uint32_t insn)
 #ifdef OPENRISC_DISAS
     uint32_t K16;
 #endif
-    op0 = extract32(insn, 16, 8);
+    op0 = extract32(insn, 16, 10);
 #ifdef OPENRISC_DISAS
     K16 = extract32(insn, 0, 16);
 #endif
Signature · 1 line
2.2.1
Acked-by on v2 1/1
#1 lore raw

Hi David,

Quoted 18 lines · David Morrison

Fixed the decoding of "system" instructions (starting with 0x2) in dec_sys() in translate.c. In particular, the l.trap instruction is now correctly decoded, which enables for singlestepping and breakpoints to be set in GDB.

---
 target-openrisc/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Changes since previous version:
* Added 'signed-off-by' line; sorry to forget this before!

target-openrisc/translate.c +0 -0
index 407bd97..d36278f 100644

target-openrisc/translate.c static void dec_sys(DisasContext *dc, uint32_t insn) · line 1323

Quoted 5 lines
target-openrisc/translate.c +1 -1
@@ -1320,7 +1320,7 @@ static void dec_sys(DisasContext *dc, uint32_t insn)
 #ifdef OPENRISC_DISAS
     uint32_t K16;
 #endif
-    op0 = extract32(insn, 16, 8);
+    op0 = extract32(insn, 16, 10);

Thank you for pointing this.

Quoted 6 lines
target-openrisc/translate.c +0 -1
 #ifdef OPENRISC_DISAS
     K16 = extract32(insn, 0, 16);
 #endif
--

2.2.1

Regards,
Jia

#2 lore raw
In reply to David Morrison
Quoted 4 lines · David Morrison

Fixed the decoding of "system" instructions (starting with 0x2) in dec_sys() in translate.c. In particular, the l.trap instruction is now correctly decoded, which enables for singlestepping and breakpoints to be set in GDB.

Applied to -trivial, thank you!

/mjt