Skip to contentSkip to conversation

target/mips: Raise exception when DINSV opcode used with DSP disabled

PATCH Applied Philippe Mathieu-Daudé 2 participants 3 messages May 29, 2021 – Jun 19, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/mips: Raise exception when DINSV opcode used with DSP disabled

Per the "MIPS® DSP Module for MIPS64 Architecture" manual, rev. 3.02, Table 5.3 "SPECIAL3 Encoding of Function Field for DSP Module":

If the Module/ASE is not implemented, executing such an instruction must cause a Reserved Instruction Exception.

The DINSV instruction lists the following exceptions:
- Reserved Instruction
- DSP Disabled

If the MIPS core doesn't support the DSP module, or the DSP is disabled, do not handle the '$rt = $0' case as a no-op but raise the proper exception instead.

Cc Jia Liu <[email protected]>
Fixes 1cb6686cf92 ("target-mips: Add ASE DSP bit/manipulation instructions")
---
 target/mips/tcg/translate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
target/mips/tcg/translate.c +2 -1
index c03a8ae1fed..6ccba34c050 100644
@@ -24373,10 +24373,11 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx)
         {
             TCGv t0, t1;
 
+            check_dsp(ctx);
+
             if (rt == 0) {
                 break;
             }
-            check_dsp(ctx);
 
             t0 = tcg_temp_new();
             t1 = tcg_temp_new();
Signature · 1 line
2.26.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Philippe Mathieu-Daudé

Per the "MIPS® DSP Module for MIPS64 Architecture" manual, rev. 3.02, Table 5.3 "SPECIAL3 Encoding of Function Field for DSP Module":

If the Module/ASE is not implemented, executing such an instruction must cause a Reserved Instruction Exception.

The DINSV instruction lists the following exceptions:
- Reserved Instruction
- DSP Disabled

If the MIPS core doesn't support the DSP module, or the DSP is disabled, do not handle the '$rt = $0' case as a no-op but raise the proper exception instead.

Quoted 6 lines
Cc Jia Liu<[email protected]>
Fixes 1cb6686cf92 ("target-mips: Add ASE DSP bit/manipulation instructions")
---
  target/mips/tcg/translate.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

r~

#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 14 lines · Philippe Mathieu-Daudé

Per the "MIPS® DSP Module for MIPS64 Architecture" manual, rev. 3.02, Table 5.3 "SPECIAL3 Encoding of Function Field for DSP Module":

If the Module/ASE is not implemented, executing such an instruction must cause a Reserved Instruction Exception.

The DINSV instruction lists the following exceptions:
- Reserved Instruction
- DSP Disabled

If the MIPS core doesn't support the DSP module, or the DSP is disabled, do not handle the '$rt = $0' case as a no-op but raise the proper exception instead.

Quoted 6 lines
Cc Jia Liu <[email protected]>
Fixes 1cb6686cf92 ("target-mips: Add ASE DSP bit/manipulation instructions")
---
 target/mips/tcg/translate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Thanks, applied to mips-next.