From 4fcb357e2fdb0d0024d68e68baf8e02d430b9ba0 Mon Sep 17 00:00:00 2001 From: joevt Date: Mon, 5 Feb 2024 06:02:26 -0800 Subject: [PATCH] ppcfpopcodes: add 601 variant of mffs. --- cpu/ppc/ppcemu.h | 1 + cpu/ppc/ppcexec.cpp | 2 ++ cpu/ppc/ppcfpopcodes.cpp | 11 ++++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cpu/ppc/ppcemu.h b/cpu/ppc/ppcemu.h index cce6c1b..5992da8 100644 --- a/cpu/ppc/ppcemu.h +++ b/cpu/ppc/ppcemu.h @@ -521,6 +521,7 @@ extern void ppc_mtfsb1(); extern void ppc_mcrfs(); extern void ppc_fmr(); extern void ppc_mffs(); +extern void ppc_mffs_601(); extern void ppc_mtfsf(); extern void ppc_mtfsfi(); diff --git a/cpu/ppc/ppcexec.cpp b/cpu/ppc/ppcexec.cpp index 9ea8c6b..0fee4c9 100644 --- a/cpu/ppc/ppcexec.cpp +++ b/cpu/ppc/ppcexec.cpp @@ -781,6 +781,8 @@ void ppc_cpu_init(MemCtrlBase* mem_ctrl, uint32_t cpu_version, uint64_t tb_freq) SubOpcode63Grabber[i + 23] = ppc_illegalop; // fsel } SubOpcode63Grabber[26] = ppc_illegalop; // frsqrte; + + SubOpcode63Grabber[583] = ppc_mffs_601; } if (cpu_version != PPC_VER::MPC970MP) { SubOpcode59Grabber[22] = ppc_illegalop; // fsqrts diff --git a/cpu/ppc/ppcfpopcodes.cpp b/cpu/ppc/ppcfpopcodes.cpp index 907e67a..f024e08 100644 --- a/cpu/ppc/ppcfpopcodes.cpp +++ b/cpu/ppc/ppcfpopcodes.cpp @@ -869,7 +869,16 @@ void dppc_interpreter::ppc_fmr() { void dppc_interpreter::ppc_mffs() { ppc_grab_regsda(); - ppc_state.fpr[reg_d].int64_r = (uint64_t)ppc_state.fpscr; + ppc_state.fpr[reg_d].int64_r = (uint64_t)ppc_state.fpscr | 0xFFF8000000000000ULL; + + if (rc_flag) + ppc_update_cr1(); +} + +void dppc_interpreter::ppc_mffs_601() { + ppc_grab_regsda(); + + ppc_state.fpr[reg_d].int64_r = (uint64_t)ppc_state.fpscr | 0xFFFFFFFF00000000ULL; if (rc_flag) ppc_update_cr1();