From 2a86a4f62a38c630a27d8e2690c7fc1bb3873c99 Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Sun, 28 Sep 2003 21:22:59 +0000 Subject: [PATCH] Handle dcbz. Ignore unaligned load/store multiple. Fix icbi/isync. --- .../src/kpx_cpu/src/cpu/ppc/ppc-decode.cpp | 2 +- .../src/kpx_cpu/src/cpu/ppc/ppc-execute.cpp | 23 ++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-decode.cpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-decode.cpp index 699ff10c..a3b1b316 100644 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-decode.cpp +++ b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-decode.cpp @@ -267,7 +267,7 @@ const powerpc_cpu::instr_info_t powerpc_cpu::powerpc_ii_table[] = { X_form, 31, 246, CFLOW_NORMAL }, { "dcbz", - EXECUTE_0(nop), + EXECUTE_2(dcbz, operand_RA_or_0, operand_RB), NULL, X_form, 31, 1014, CFLOW_NORMAL }, diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-execute.cpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-execute.cpp index 22ceb087..fc0e6e4d 100644 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-execute.cpp +++ b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-execute.cpp @@ -564,8 +564,15 @@ void powerpc_cpu::execute_loadstore_multiple(uint32 opcode) uint32 ea = a + d; // FIXME: generate exception if ea is not word-aligned - if ((ea & 3) != 0) + if ((ea & 3) != 0) { +#ifdef SHEEPSHAVER + D(bug("unaligned EA load/store multiple\n")); + increment_pc(4); + return; +#else abort(); +#endif + } int r = LD ? rD_field::extract(opcode) : rS_field::extract(opcode); while (r <= 31) { @@ -1065,11 +1072,25 @@ void powerpc_cpu::execute_mftbr(uint32 opcode) void powerpc_cpu::execute_icbi(uint32 opcode) { // TODO: record address range of code to invalidate + increment_pc(4); } void powerpc_cpu::execute_isync(uint32 opcode) { invalidate_cache(); + increment_pc(4); +} + +/** + * (Fake) data cache management + **/ + +template< class RA, class RB > +void powerpc_cpu::execute_dcbz(uint32 opcode) +{ + uint32 ea = RA::get(this, opcode) + RB::get(this, opcode); + vm_memset(ea - (ea % 32), 0, 32); + increment_pc(4); } /**