Skip to contentSkip to conversation

target/m68k: use EXCP_ILLEGAL instead of EXCP_UNSUPPORTED

PATCH In review Laurent Vivier 2 participants 2 messages Oct 30, 2018 – Oct 31, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/m68k: use EXCP_ILLEGAL instead of EXCP_UNSUPPORTED

Coldfire defines an "Unsupported instruction" exception if execution of a valid instruction is attempted but the required hardware is not present in the processor.

We use it with instructions that are in fact undefined or illegal, and the exception expected in this case by the kernel is the illegal exception, so this patch fixes that.

---
 linux-user/m68k/cpu_loop.c | 1 -
 target/m68k/cpu.h          | 1 -
 target/m68k/translate.c    | 6 +++---
 3 files changed, 3 insertions(+), 5 deletions(-)
linux-user/m68k/cpu_loop.c +0 -1
index b4d3d8af3d..30c3332af4 100644
@@ -55,7 +55,6 @@ void cpu_loop(CPUM68KState *env)
             break;
         case EXCP_LINEA:
         case EXCP_LINEF:
-        case EXCP_UNSUPPORTED:
         do_sigill:
             info.si_signo = TARGET_SIGILL;
             info.si_errno = 0;
target/m68k/cpu.h +0 -1
index 45e87deaef..d3980e5b9a 100644
@@ -70,7 +70,6 @@
 #define EXCP_MMU_CONF       56  /* MMU Configuration Error */
 #define EXCP_MMU_ILLEGAL    57  /* MMU Illegal Operation Error */
 #define EXCP_MMU_ACCESS     58  /* MMU Access Level Violation Error */
-#define EXCP_UNSUPPORTED    61
 
 #define EXCP_RTE            0x100
 #define EXCP_HALT_INSN      0x101
target/m68k/translate.c +3 -3
index 795c88e52f..3a00ac36b4 100644
@@ -1552,7 +1552,7 @@ DISAS_INSN(undef)
        but actually illegal for CPU32 or pre-68020.  */
     qemu_log_mask(LOG_UNIMP, "Illegal instruction: %04x @ %08x\n",
                   insn, s->base.pc_next);
-    gen_exception(s, s->base.pc_next, EXCP_UNSUPPORTED);
+    gen_exception(s, s->base.pc_next, EXCP_ILLEGAL);
 }
 
 DISAS_INSN(mulw)
@@ -2799,7 +2799,7 @@ DISAS_INSN(mull)
 
     if (ext & 0x400) {
         if (!m68k_feature(s->env, M68K_FEATURE_QUAD_MULDIV)) {
-            gen_exception(s, s->base.pc_next, EXCP_UNSUPPORTED);
+            gen_exception(s, s->base.pc_next, EXCP_ILLEGAL);
             return;
         }
 
@@ -4509,7 +4509,7 @@ DISAS_INSN(strldsr)
     addr = s->pc - 2;
     ext = read_im16(env, s);
     if (ext != 0x46FC) {
-        gen_exception(s, addr, EXCP_UNSUPPORTED);
+        gen_exception(s, addr, EXCP_ILLEGAL);
         return;
     }
     ext = read_im16(env, s);
Signature · 1 line
2.17.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Laurent Vivier

Coldfire defines an "Unsupported instruction" exception if execution of a valid instruction is attempted but the required hardware is not present in the processor.

We use it with instructions that are in fact undefined or illegal, and the exception expected in this case by the kernel is the illegal exception, so this patch fixes that.

Quoted 6 lines
---
 linux-user/m68k/cpu_loop.c | 1 -
 target/m68k/cpu.h          | 1 -
 target/m68k/translate.c    | 6 +++---
 3 files changed, 3 insertions(+), 5 deletions(-)

r~