From 874dab37f893ccd6d22b6dcc750e665405c0b755 Mon Sep 17 00:00:00 2001 From: pierre Date: Sun, 7 Nov 2010 23:15:31 +0000 Subject: [PATCH] Core/DSPCore: Make Jit read from coefficient ROM when told to do so, change the unit test to catch this bug if it turns up again and two more zeroWriteBackLog() calls. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6356 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DSPCore/Src/Jit/DSPJitMisc.cpp | 2 ++ Source/Core/DSPCore/Src/Jit/DSPJitUtil.cpp | 4 ++-- Source/UnitTests/AudioJitTests.cpp | 22 ++++++++++++++++++++++ Source/UnitTests/DSPJitTester.cpp | 11 +++++++---- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/Source/Core/DSPCore/Src/Jit/DSPJitMisc.cpp b/Source/Core/DSPCore/Src/Jit/DSPJitMisc.cpp index 4a2e3c6540..a1cddbca24 100644 --- a/Source/Core/DSPCore/Src/Jit/DSPJitMisc.cpp +++ b/Source/Core/DSPCore/Src/Jit/DSPJitMisc.cpp @@ -166,6 +166,7 @@ void DSPEmitter::sbclr(const UDSPInstruction opc) { u8 bit = (opc & 0x7) + 6; + zeroWriteBackLog(opc); clrCompileSR(1 << bit); } @@ -177,6 +178,7 @@ void DSPEmitter::sbset(const UDSPInstruction opc) { u8 bit = (opc & 0x7) + 6; + zeroWriteBackLog(opc); setCompileSR(1 << bit); } diff --git a/Source/Core/DSPCore/Src/Jit/DSPJitUtil.cpp b/Source/Core/DSPCore/Src/Jit/DSPJitUtil.cpp index 8f749414a1..950b3aa84b 100644 --- a/Source/Core/DSPCore/Src/Jit/DSPJitUtil.cpp +++ b/Source/Core/DSPCore/Src/Jit/DSPJitUtil.cpp @@ -386,9 +386,9 @@ void DSPEmitter::ext_dmem_read(u16 addr) // return g_dsp.coef[addr & DSP_COEF_MASK]; AND(16, R(ECX), Imm16(DSP_COEF_MASK)); #ifdef _M_X64 - MOV(64, R(ESI), ImmPtr(g_dsp.dram)); + MOV(64, R(ESI), ImmPtr(g_dsp.coef)); #else - MOV(32, R(ESI), ImmPtr(g_dsp.dram)); + MOV(32, R(ESI), ImmPtr(g_dsp.coef)); #endif MOV(16, R(EAX), MComplex(ESI,ECX,2,0)); diff --git a/Source/UnitTests/AudioJitTests.cpp b/Source/UnitTests/AudioJitTests.cpp index 4cef5931fa..4991eeb485 100644 --- a/Source/UnitTests/AudioJitTests.cpp +++ b/Source/UnitTests/AudioJitTests.cpp @@ -286,6 +286,27 @@ void nx_slnm() tester2.Report(); } +void nx_ld() +{ + DSPJitTester tester1(0x8000, 0x00c0); + tester1.AddTestData(DSP_REG_AXL0,0xdead); + tester1.AddTestData(DSP_REG_AXL1,0xbeef); + tester1.AddTestData(DSP_REG_AR0); + tester1.AddTestData(DSP_REG_WR0); + tester1.AddTestData(DSP_REG_IX0); + tester1.TestAll(true); + tester1.Report(); + + DSPJitTester tester2(0x8000, 0x00c0); + tester2.AddTestData(DSP_REG_AXL0,0xdead); + tester2.AddTestData(DSP_REG_AXL1,0xbeef); + tester2.AddTestData(DSP_REG_AR3); + tester2.AddTestData(DSP_REG_WR3); + tester2.AddTestData(DSP_REG_IX3); + tester2.TestAll(true); + tester2.Report(); +} + void AudioJitTests() { DSPJitTester::Initialize(); @@ -315,6 +336,7 @@ void AudioJitTests() nx_sln(); nx_slm(); nx_slnm(); + nx_ld(); } //required to be able to link against DSPCore diff --git a/Source/UnitTests/DSPJitTester.cpp b/Source/UnitTests/DSPJitTester.cpp index c0b95ca35e..0eaed4e0ea 100644 --- a/Source/UnitTests/DSPJitTester.cpp +++ b/Source/UnitTests/DSPJitTester.cpp @@ -168,10 +168,13 @@ int DSPJitTester::TestAll(bool verbose_fail) dsp.dram = (u16*)AllocateMemoryPages(DSP_DRAM_BYTE_SIZE); dsp.coef = (u16*)AllocateMemoryPages(DSP_COEF_BYTE_SIZE); - // Fill roms with zeros. - memset(dsp.irom, 0, DSP_IROM_BYTE_SIZE); - memset(dsp.coef, 0, DSP_COEF_BYTE_SIZE); - memset(dsp.dram, 0, DSP_DRAM_BYTE_SIZE); + // Fill roms with distinct patterns. + for (int i = 0; i < DSP_IROM_SIZE; i++) + dsp.irom[i] = (i & 0x3fff) | 0x4000; + for (int i = 0; i < DSP_COEF_SIZE; i++) + dsp.coef[i] = (i & 0x3fff) | 0x8000; + for (int i = 0; i < DSP_DRAM_SIZE; i++) + dsp.dram[i] = (i & 0x3fff) | 0xc000; // Fill IRAM with HALT opcodes. for (int i = 0; i < DSP_IRAM_SIZE; i++) dsp.iram[i] = 0x0021; // HALT opcode