mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-09 06:30:51 +00:00
ppcopcodes: Don't change MQ if not MPC601.
MQ should not be writable if not doing MPC601. Fix is_601 and include_601. This fixes risu tests.
This commit is contained in:
parent
1d807d10e9
commit
b38b1731a0
@ -325,6 +325,7 @@ extern bool int_pin;
|
||||
extern bool dec_exception_pending;
|
||||
|
||||
extern bool is_601; // For PowerPC 601 Emulation
|
||||
extern bool include_601; // For non-PowerPC 601 emulation with 601 extras (matches Mac OS 9 environment which can emulate MPC 601 instructions)
|
||||
extern bool is_altivec; // For Altivec Emulation
|
||||
extern bool is_64bit; // For PowerPC G5 Emulation
|
||||
|
||||
@ -417,7 +418,7 @@ void ppc_opcode31();
|
||||
void ppc_opcode59();
|
||||
void ppc_opcode63();
|
||||
|
||||
void initialize_ppc_opcode_tables(bool include_601);
|
||||
void initialize_ppc_opcode_tables();
|
||||
|
||||
extern double fp_return_double(uint32_t reg);
|
||||
extern uint64_t fp_return_uint64(uint32_t reg);
|
||||
|
@ -56,6 +56,7 @@ using namespace dppc_interpreter;
|
||||
MemCtrlBase* mem_ctrl_instance = 0;
|
||||
|
||||
bool is_601 = false;
|
||||
bool include_601 = false;
|
||||
|
||||
bool is_deterministic = false;
|
||||
|
||||
@ -637,7 +638,7 @@ do { \
|
||||
#define OP63d(subopcode, fn) OPXd(SubOpcode63, subopcode, fn)
|
||||
#define OP63dc(subopcode, fn, carry) OPXdc(SubOpcode63, subopcode, fn, carry)
|
||||
|
||||
void initialize_ppc_opcode_tables(bool include_601) {
|
||||
void initialize_ppc_opcode_tables() {
|
||||
std::fill_n(OpcodeGrabber, 64, ppc_illegalop);
|
||||
OP(3, ppc_twi);
|
||||
//OP(4, ppc_opcode4); - Altivec instructions not emulated yet. Uncomment once they're implemented.
|
||||
@ -873,7 +874,7 @@ void initialize_ppc_opcode_tables(bool include_601) {
|
||||
}
|
||||
}
|
||||
|
||||
void ppc_cpu_init(MemCtrlBase* mem_ctrl, uint32_t cpu_version, bool include_601, uint64_t tb_freq)
|
||||
void ppc_cpu_init(MemCtrlBase* mem_ctrl, uint32_t cpu_version, bool do_include_601, uint64_t tb_freq)
|
||||
{
|
||||
mem_ctrl_instance = mem_ctrl;
|
||||
|
||||
@ -882,8 +883,9 @@ void ppc_cpu_init(MemCtrlBase* mem_ctrl, uint32_t cpu_version, bool include_601,
|
||||
|
||||
ppc_state.spr[SPR::PVR] = cpu_version;
|
||||
is_601 = (cpu_version >> 16) == 1;
|
||||
include_601 = !is_601 & do_include_601;
|
||||
|
||||
initialize_ppc_opcode_tables(include_601);
|
||||
initialize_ppc_opcode_tables();
|
||||
|
||||
// initialize emulator timers
|
||||
TimerManager::get_instance()->set_time_now_cb(&get_virt_time_ns);
|
||||
|
@ -903,7 +903,7 @@ void dppc_interpreter::ppc_mfspr() {
|
||||
|
||||
switch (ref_spr) {
|
||||
case SPR::MQ:
|
||||
if (!is_601) {
|
||||
if (!(is_601 || include_601)) {
|
||||
ppc_exception_handler(Except_Type::EXC_PROGRAM, Exc_Cause::ILLEGAL_OP);
|
||||
}
|
||||
ppc_state.gpr[reg_d] = ppc_state.spr[ref_spr];
|
||||
@ -957,10 +957,10 @@ void dppc_interpreter::ppc_mtspr() {
|
||||
|
||||
switch (ref_spr) {
|
||||
case SPR::MQ:
|
||||
if (!is_601) {
|
||||
if (is_601 || include_601)
|
||||
ppc_state.spr[ref_spr] = val;
|
||||
else
|
||||
ppc_exception_handler(Except_Type::EXC_PROGRAM, Exc_Cause::ILLEGAL_OP);
|
||||
}
|
||||
ppc_state.spr[ref_spr] = val;
|
||||
break;
|
||||
case SPR::RTCL_U:
|
||||
case SPR::RTCU_U:
|
||||
|
@ -321,7 +321,8 @@ static void read_test_float_data() {
|
||||
}
|
||||
|
||||
int main() {
|
||||
initialize_ppc_opcode_tables(true); //kludge
|
||||
is_601 = true;
|
||||
initialize_ppc_opcode_tables(); //kludge
|
||||
|
||||
cout << "Running DingusPPC emulator tests..." << endl << endl;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user