Skip to contentSkip to conversation

target-mips: add missing restriction in DAUI instruction

PATCH In review Leon Alrae 2 participants 2 messages Sep 14, 2015

lore
Share & tools
lore

Leon Alrae

author
#0 lore raw

PATCH 1/1 target-mips: add missing restriction in DAUI instruction

rs cannot be the zero register, Reserved Instruction exception must be signalled for this case.

---
 target-mips/translate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
target-mips/translate.c +3 -1
index 7fb7c01..a8fd4a3 100644
@@ -19512,7 +19512,9 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
 #if defined(TARGET_MIPS64)
             /* OPC_DAUI */
             check_mips_64(ctx);
-            if (rt != 0) {
+            if (rs == 0) {
+                generate_exception(ctx, EXCP_RI);
+            } else if (rt != 0) {
                 TCGv t0 = tcg_temp_new();
                 gen_load_gpr(t0, rs);
                 tcg_gen_addi_tl(cpu_gpr[rt], t0, imm << 16);
Signature · 1 line
2.1.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Leon Alrae

rs cannot be the zero register, Reserved Instruction exception must be signalled for this case.

---
 target-mips/translate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
target-mips/translate.c +0 -0
index 7fb7c01..a8fd4a3 100644

target-mips/translate.c static void decode_opc(CPUMIPSState *env, DisasContext *ctx) · line 19520

Quoted 10 lines
target-mips/translate.c +3 -1
@@ -19512,7 +19512,9 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
 #if defined(TARGET_MIPS64)
             /* OPC_DAUI */
             check_mips_64(ctx);
-            if (rt != 0) {
+            if (rs == 0) {
+                generate_exception(ctx, EXCP_RI);
+            } else if (rt != 0) {
                 TCGv t0 = tcg_temp_new();
                 gen_load_gpr(t0, rs);
                 tcg_gen_addi_tl(cpu_gpr[rt], t0, imm << 16);
Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                 http://www.aurel32.net