diff mbox series

[RFC,v2,3/3] target/mips/op_helper: Log unimplemented cache opcode

Message ID 20200813181527.22551-4-f4bug@amsat.org
State New
Headers show
Series [RFC,v2,1/3] target/mips/op_helper: Convert multiple if() to switch case | expand

Commit Message

Philippe Mathieu-Daudé Aug. 13, 2020, 6:15 p.m. UTC
In case the guest uses a cache opcode we are not expecting,
log it to give us a chance to notice it, in case we should
actually do something.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/mips/op_helper.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Richard Henderson Aug. 13, 2020, 7:50 p.m. UTC | #1
On 8/13/20 11:15 AM, Philippe Mathieu-Daudé wrote:
>  #ifndef CONFIG_USER_ONLY
> +    static const char *type_name[] = {

const char * const

Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
diff mbox series

Patch

diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c
index 2496d1dd71..a3b27f39db 100644
--- a/target/mips/op_helper.c
+++ b/target/mips/op_helper.c
@@ -1574,6 +1574,13 @@  void helper_msa_st_d(CPUMIPSState *env, uint32_t wd,
 void helper_cache(CPUMIPSState *env, target_ulong addr, uint32_t op)
 {
 #ifndef CONFIG_USER_ONLY
+    static const char *type_name[] = {
+        "Primary Instruction",
+        "Primary Data or Unified Primary",
+        "Tertiary",
+        "Secondary"
+    };
+    uint32_t cache_type = extract32(op, 0, 2);
     uint32_t cache_operation = extract32(op, 2, 3);
     target_ulong index = addr & 0x1fffffff;
 
@@ -1592,6 +1599,8 @@  void helper_cache(CPUMIPSState *env, target_ulong addr, uint32_t op)
         /* no-op */
         break;
     default:
+        qemu_log_mask(LOG_UNIMP, "cache operation:%u (type: %s cache)\n",
+                      cache_operation, type_name[cache_type]);
         break;
     }
 #endif