Skip to contentSkip to conversation

MOVEC insn. doesnt generate exception if wrong CR is accessed

PATCH In review Lucien Murray-Pitts 1 participant 1 message Jun 16, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 5/6 MOVEC insn. doesnt generate exception if wrong CR is accessed

Added "CPU class" m68k_feature to each CPU init func so MOVEC can detect wrong CR (Control Register) access.

Added CPU class detection for each CR type in the m68k_move_to/from helpers, so that it throws and exception if an unsupported register is requested for that CPU class.

Reclassified MOVEC insn. as only supported in 68010.

---
 target/m68k/cpu.c       |   3 +
 target/m68k/cpu.h       |   4 +
 target/m68k/helper.c    | 192 ++++++++++++++++++++++++++++++----------
 target/m68k/translate.c |   2 +-
 4 files changed, 155 insertions(+), 46 deletions(-)
target/m68k/cpu.c +3 -0
index f3246d6e72..50260de97d 100644
@@ -134,6 +134,7 @@ static void m68010_cpu_initfn(Object *obj)
     CPUM68KState *env = &cpu->env;
 
     m68000_cpu_initfn(obj);
+    m68k_set_feature(env, M68K_FEATURE_M68010);
     m68k_set_feature(env, M68K_FEATURE_RTD);
     m68k_set_feature(env, M68K_FEATURE_BKPT);
 }
@@ -151,6 +152,7 @@ static void m68020_cpu_initfn(Object *obj)
     CPUM68KState *env = &cpu->env;
 
     m68010_cpu_initfn(obj);
+    m68k_set_feature(env, M68K_FEATURE_M68020);
     m68k_set_feature(env, M68K_FEATURE_QUAD_MULDIV);
     m68k_set_feature(env, M68K_FEATURE_BRAL);
     m68k_set_feature(env, M68K_FEATURE_BCCL);
@@ -177,6 +179,7 @@ static void m68030_cpu_initfn(Object *obj)
     CPUM68KState *env = &cpu->env;
 
     m68020_cpu_initfn(obj);
+    m68k_set_feature(env, M68K_FEATURE_M68030);
 }
 
 
target/m68k/cpu.h +4 -0
index 2386419c42..86ba19f779 100644
@@ -488,7 +488,11 @@ void do_m68k_semihosting(CPUM68KState *env, int nr);
 
 enum m68k_features {
     M68K_FEATURE_M68000,   /* Base m68k instruction set */
+    M68K_FEATURE_M68010,   /* Additional insn. specific to MC68010 */
+    M68K_FEATURE_M68020,   /* Additional insn. specific to MC68020 */
+    M68K_FEATURE_M68030,   /* Additional insn. specific to MC68030 */
     M68K_FEATURE_M68040,   /* Additional insn. specific to MC68040 */
+    M68K_FEATURE_M68060,   /* Additional insn. specific to MC68060 */
     M68K_FEATURE_CF_ISA_A, /* Base Coldfire set Rev A. */
     M68K_FEATURE_CF_ISA_B, /* (ISA B or C).  */
     M68K_FEATURE_CF_ISA_APLUSC, /* BIT/BITREV, FF1, STRLDSR (ISA A+ or C).  */
target/m68k/helper.c +147 -45

261 lines not on this page · raw message

target/m68k/translate.c +1 -1
index 9b0ca4c14c..cbca02a7b5 100644
@@ -5990,7 +5990,7 @@ void register_m68k_insns (CPUM68KState *env)
     BASE(stop,      4e72, ffff);
     BASE(rte,       4e73, ffff);
     INSN(cf_movec,  4e7b, ffff, CF_ISA_A);
-    INSN(m68k_movec, 4e7a, fffe, M68000);
+    INSN(m68k_movec, 4e7a, fffe, M68010);
 #endif
     BASE(nop,       4e71, ffff);
     INSN(rtd,       4e74, ffff, RTD);
Signature · 1 line
2.21.0