Skip to contentSkip to conversation

target/m68k: Allow movec only on 68010+

PATCH In review BALATON Zoltan 2 participants 6 messages Jan 14, 2020 – May 2, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/m68k: Allow movec only on 68010+

The movec opcode does not exist on 68000 and should raise an exception. Fix the feature mask to only allow movec on newer 68k CPUs.

---
 target/m68k/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/m68k/translate.c +1 -1
index fcdb7bc8e4..f19da064c8 100644
@@ -5988,7 +5988,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, FPU);
 #endif
     BASE(nop,       4e71, ffff);
     INSN(rtd,       4e74, ffff, RTD);
Signature · 1 line
2.13.7
#1 lore raw

Le 14/01/2020 à 21:13, BALATON Zoltan a écrit :

Quoted 14 lines

The movec opcode does not exist on 68000 and should raise an exception. Fix the feature mask to only allow movec on newer 68k CPUs.

---
 target/m68k/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/m68k/translate.c +0 -0
index fcdb7bc8e4..f19da064c8 100644

target/m68k/translate.c void register_m68k_insns (CPUM68KState *env) · line 5994

Quoted 8 lines
target/m68k/translate.c +1 -1
@@ -5988,7 +5988,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, FPU);
 #endif
     BASE(nop,       4e71, ffff);
     INSN(rtd,       4e74, ffff, RTD);

Good point. But as movec is not related to FPU I don't think this is the good flag to use.

Lucien has sent a patch to fix this issue last year:

[5/6] MOVEC insn. doesnt generate exception if wrong CR is accessed
https://patchwork.kernel.org/patch/10997467/

it needs a rework (M680x0 feature flags are now specific to each CPU, so the table cannot be set to the older one, 68010, and 68060 is missing) but I think it's a better approach.

Thanks,
Laurent

#2 lore raw
In reply to BALATON Zoltan

Ping?

Quoted 22 lines · BALATON Zoltan

The movec opcode does not exist on 68000 and should raise an exception. Fix the feature mask to only allow movec on newer 68k CPUs.

---
target/m68k/translate.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
target/m68k/translate.c +1 -1
index fcdb7bc8e4..f19da064c8 100644
@@ -5988,7 +5988,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, FPU);
 #endif
    BASE(nop,       4e71, ffff);
    INSN(rtd,       4e74, ffff, RTD);
#3 lore raw

Le 01/05/2020 à 15:11, BALATON Zoltan a écrit :

Quoted 1 line

Ping?

I sent a comment:

https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg02840.html

Thanks,
Laurent

Quoted 24 lines · BALATON Zoltan
Quoted 22 lines

The movec opcode does not exist on 68000 and should raise an exception. Fix the feature mask to only allow movec on newer 68k CPUs.

---
target/m68k/translate.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
target/m68k/translate.c +1 -1
index fcdb7bc8e4..f19da064c8 100644
@@ -5988,7 +5988,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, FPU);
 #endif
     BASE(nop,       4e71, ffff);
     INSN(rtd,       4e74, ffff, RTD);
#4 lore raw
Quoted 6 lines · Laurent Vivier

Le 01/05/2020 à 15:11, BALATON Zoltan a écrit :

Quoted 1 line

Ping?

I sent a comment:

https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg02840.html

Thanks, I've somehow missed that, did not show up in my inbox for some reason. I wasn't sure about the FPU flag but did not find a better one without adding new flag for 68010. Lucien's patch is indeed more complete and should fix the same problem. So will that be merged then?

Regards,
BALATON Zoltan

Quoted 29 lines

Thanks,
Laurent

Quoted 24 lines · BALATON Zoltan
Quoted 22 lines

The movec opcode does not exist on 68000 and should raise an exception. Fix the feature mask to only allow movec on newer 68k CPUs.

---
target/m68k/translate.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
target/m68k/translate.c +1 -1
index fcdb7bc8e4..f19da064c8 100644
@@ -5988,7 +5988,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, FPU);
 #endif
     BASE(nop,       4e71, ffff);
     INSN(rtd,       4e74, ffff, RTD);
#5 lore raw

Le 02/05/2020 à 03:38, BALATON Zoltan a écrit :

Quoted 12 lines · Laurent Vivier
Quoted 6 lines

Le 01/05/2020 à 15:11, BALATON Zoltan a écrit :

Quoted 1 line

Ping?

I sent a comment:

https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg02840.html

Thanks, I've somehow missed that, did not show up in my inbox for some reason. I wasn't sure about the FPU flag but did not find a better one without adding new flag for 68010. Lucien's patch is indeed more complete and should fix the same problem. So will that be merged then?

The series needs to be rebased but I'm not sure Lucien has the time for that (cc: Lucien).

Thanks,
Laurent