DSP: Add txt file with luigi ucode comments (very basic). Rename some stuff. Remove function pointer in g_dsp structure, replace with a "Host" function call. Fix a problem where symbols weren't loaded into DSP debugger.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3563 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2009-06-28 10:00:25 +00:00
parent 7ea2bc5da9
commit 895b02f410
34 changed files with 2826 additions and 250 deletions
@@ -58,8 +58,7 @@
#include "WII_IPC_HLE_Device_net.h" #include "WII_IPC_HLE_Device_net.h"
#include <stdio.h> #include <stdio.h>
#ifdef _WIN32 #ifdef _WIN32
#include <winsock.h> #include <ws2tcpip.h>
typedef int socklen_t;
#else #else
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
@@ -287,7 +286,7 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command, u32 _BufferIn,
// Clean the location of the output buffer to zeroes as a safety precaution */ // Clean the location of the output buffer to zeroes as a safety precaution */
Memory::Memset(BufferOut, 0, BufferOutSize); Memory::Memset(BufferOut, 0, BufferOutSize);
switch(_Command) switch (_Command)
{ {
case IOCTL_SO_STARTUP: case IOCTL_SO_STARTUP:
break; break;
@@ -297,7 +296,7 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command, u32 _BufferIn,
u32 TYPE = Memory::Read_U32(_BufferIn + 0x04); u32 TYPE = Memory::Read_U32(_BufferIn + 0x04);
u32 PROT = Memory::Read_U32(_BufferIn + 0x04 * 2); u32 PROT = Memory::Read_U32(_BufferIn + 0x04 * 2);
u32 Unk1 = Memory::Read_U32(_BufferIn + 0x04 * 3); u32 Unk1 = Memory::Read_U32(_BufferIn + 0x04 * 3);
u32 Socket = socket(AF,TYPE,PROT); u32 Socket = socket(AF, TYPE, PROT);
return Common::swap32(Socket); // So it doesn't get mangled later on return Common::swap32(Socket); // So it doesn't get mangled later on
} }
break; break;
+28 -28
View File
@@ -413,6 +413,14 @@
RelativePath=".\Src\DspIntBranch.cpp" RelativePath=".\Src\DspIntBranch.cpp"
> >
</File> </File>
<File
RelativePath=".\Src\DSPIntExtOps.cpp"
>
</File>
<File
RelativePath=".\Src\DSPIntExtOps.h"
>
</File>
<File <File
RelativePath=".\Src\DspIntLoadStore.cpp" RelativePath=".\Src\DspIntLoadStore.cpp"
> >
@@ -425,6 +433,10 @@
RelativePath=".\Src\DspIntMultiplier.cpp" RelativePath=".\Src\DspIntMultiplier.cpp"
> >
</File> </File>
<File
RelativePath=".\Src\DSPIntUtil.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="Debugger" Name="Debugger"
@@ -446,6 +458,14 @@
RelativePath=".\Src\disassemble.h" RelativePath=".\Src\disassemble.h"
> >
</File> </File>
<File
RelativePath=".\Src\DSPAccelerator.cpp"
>
</File>
<File
RelativePath=".\Src\DSPAccelerator.h"
>
</File>
<File <File
RelativePath=".\Src\DSPAnalyzer.cpp" RelativePath=".\Src\DSPAnalyzer.cpp"
> >
@@ -486,6 +506,14 @@
RelativePath=".\Src\DSPJit.h" RelativePath=".\Src\DSPJit.h"
> >
</File> </File>
<File
RelativePath=".\Src\DSPMemoryMap.cpp"
>
</File>
<File
RelativePath=".\Src\DSPMemoryMap.h"
>
</File>
<File <File
RelativePath=".\Src\DSPTables.cpp" RelativePath=".\Src\DSPTables.cpp"
> >
@@ -494,14 +522,6 @@
RelativePath=".\Src\DSPTables.h" RelativePath=".\Src\DSPTables.h"
> >
</File> </File>
<File
RelativePath=".\Src\gdsp_aram.cpp"
>
</File>
<File
RelativePath=".\Src\gdsp_aram.h"
>
</File>
<File <File
RelativePath=".\Src\gdsp_condition_codes.cpp" RelativePath=".\Src\gdsp_condition_codes.cpp"
> >
@@ -510,14 +530,6 @@
RelativePath=".\Src\gdsp_condition_codes.h" RelativePath=".\Src\gdsp_condition_codes.h"
> >
</File> </File>
<File
RelativePath=".\Src\gdsp_ext_op.cpp"
>
</File>
<File
RelativePath=".\Src\gdsp_ext_op.h"
>
</File>
<File <File
RelativePath=".\Src\gdsp_interface.cpp" RelativePath=".\Src\gdsp_interface.cpp"
> >
@@ -534,18 +546,6 @@
RelativePath=".\Src\gdsp_interpreter.h" RelativePath=".\Src\gdsp_interpreter.h"
> >
</File> </File>
<File
RelativePath=".\Src\gdsp_memory.cpp"
>
</File>
<File
RelativePath=".\Src\gdsp_memory.h"
>
</File>
<File
RelativePath=".\Src\gdsp_opcodes_helper.h"
>
</File>
<File <File
RelativePath=".\Src\gdsp_registers.cpp" RelativePath=".\Src\gdsp_registers.cpp"
> >
@@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _GDSP_ARAM_H #ifndef _DSP_ACCELERATOR_H
#define _GDSP_ARAM_H #define _DSP_ACCELERATOR_H
u16 dsp_read_accelerator(); u16 dsp_read_accelerator();
+9 -2
View File
@@ -18,7 +18,7 @@
#include "DSPAnalyzer.h" #include "DSPAnalyzer.h"
#include "DSPInterpreter.h" #include "DSPInterpreter.h"
#include "DSPTables.h" #include "DSPTables.h"
#include "gdsp_memory.h" #include "DSPMemoryMap.h"
namespace DSPAnalyzer { namespace DSPAnalyzer {
@@ -30,12 +30,13 @@ u8 code_flags[ISPACE];
// as well give up its time slice immediately, after executing once. // as well give up its time slice immediately, after executing once.
// Max signature length is 6. A 0 in a signature is ignored. // Max signature length is 6. A 0 in a signature is ignored.
#define NUM_IDLE_SIGS 4 #define NUM_IDLE_SIGS 5
#define MAX_IDLE_SIG_SIZE 6 #define MAX_IDLE_SIG_SIZE 6
// 0xFFFF means ignore. // 0xFFFF means ignore.
const u16 idle_skip_sigs[NUM_IDLE_SIGS][MAX_IDLE_SIG_SIZE + 1] = const u16 idle_skip_sigs[NUM_IDLE_SIGS][MAX_IDLE_SIG_SIZE + 1] =
{ {
// From AX:
{ 0x26fc, // LRS $30, @DMBH { 0x26fc, // LRS $30, @DMBH
0x02c0, 0x8000, // ANDCF $30, #0x8000 0x02c0, 0x8000, // ANDCF $30, #0x8000
0x029d, 0xFFFF, // JLZ 0x027a 0x029d, 0xFFFF, // JLZ 0x027a
@@ -52,6 +53,12 @@ const u16 idle_skip_sigs[NUM_IDLE_SIGS][MAX_IDLE_SIG_SIZE + 1] =
0x03c0, 0x8000, // ANDCF $31, #0x8000 0x03c0, 0x8000, // ANDCF $31, #0x8000
0x029c, 0xFFFF, // JLNZ 0x0280 0x029c, 0xFFFF, // JLNZ 0x0280
0, 0 }, // RET 0, 0 }, // RET
// From Zelda:
{ 0x00de, 0xFFFE, // LR $AC0.M, @CMBH
0x02c0, 0x8000, // ANDCF $AC0.M, #0x8000
0x029c, 0xFFFF, // JLNZ 0x05cf
0 }
}; };
void Reset() void Reset()
+2 -3
View File
@@ -30,7 +30,7 @@
#include "gdsp_interface.h" #include "gdsp_interface.h"
#include "gdsp_registers.h" #include "gdsp_registers.h"
#include "gdsp_opcodes_helper.h" #include "DSPIntUtil.h"
SDSP g_dsp; SDSP g_dsp;
@@ -156,8 +156,7 @@ void DSPCore_CheckExternalInterrupt()
// level 7 is the interrupt exception // level 7 is the interrupt exception
DSPCore_SetException(7); DSPCore_SetException(7);
// Uh, confusing. Can this really be right? g_dsp.cr &= ~CR_EXTERNAL_INT;
g_dsp.cr &= ~0x0002;
} }
} }
} }
+20 -8
View File
@@ -59,23 +59,35 @@ struct SDSP
#if PROFILE #if PROFILE
u16 err_pc; u16 err_pc;
#endif #endif
u16 *iram;
u16 *dram; // This is NOT the same cr as r[DSP_REG_CR].
u16 *irom; // This register is shared with the main emulation, see DSP.cpp
u16 *coef; // The plugin has control over 0x0C07 of this reg.
u8 *cpu_ram; // Bits are defined in a struct in DSP.cpp.
u16 cr; u16 cr;
u8 reg_stack_ptr[4]; u8 reg_stack_ptr[4];
u8 exceptions; // pending exceptions? u8 exceptions; // pending exceptions?
bool exception_in_progress_hack; // is this the same as "exception enabled"? bool exception_in_progress_hack; // is this the same as "exception enabled"?
// lets make stack depth to 32 for now // Let's make stack depth 32 for now. The real DSP has different depths
// for the different stacks, but it would be strange if any ucode relied on stack
// overflows since on the DSP, when the stack overflows, you're screwed.
u16 reg_stack[4][DSP_STACK_DEPTH]; u16 reg_stack[4][DSP_STACK_DEPTH];
void (*irq_request)(void);
// for debugger only // For debugging.
u32 iram_crc; u32 iram_crc;
u64 step_counter; u64 step_counter;
// When state saving, all of the above can just be memcpy'd into the save state.
// The below needs special handling.
u16 *iram;
u16 *dram;
u16 *irom;
u16 *coef;
// This one doesn't really belong here.
u8 *cpu_ram;
}; };
extern SDSP g_dsp; extern SDSP g_dsp;
+1
View File
@@ -27,6 +27,7 @@ u8 DSPHost_ReadHostMemory(u32 addr);
void DSPHost_WriteHostMemory(u8 value, u32 addr); void DSPHost_WriteHostMemory(u8 value, u32 addr);
bool DSPHost_OnThread(); bool DSPHost_OnThread();
bool DSPHost_Running(); bool DSPHost_Running();
void DSPHost_InterruptRequest();
u32 DSPHost_CodeLoaded(const u8 *ptr, int size); u32 DSPHost_CodeLoaded(const u8 *ptr, int size);
#endif #endif
@@ -23,8 +23,8 @@
====================================================================*/ ====================================================================*/
#include "gdsp_opcodes_helper.h" #include "DSPIntUtil.h"
#include "gdsp_memory.h" #include "DSPMemoryMap.h"
// Extended opcodes do not exist on their own. These opcodes can only be // Extended opcodes do not exist on their own. These opcodes can only be
// attached to opcodes that allow extending (8 lower bits of opcode not used by // attached to opcodes that allow extending (8 lower bits of opcode not used by
@@ -23,19 +23,18 @@
====================================================================*/ ====================================================================*/
#ifndef _GDSP_OPCODES_HELPER_H #ifndef _DSP_INT_UTIL_H
#define _GDSP_OPCODES_HELPER_H #define _DSP_INT_UTIL_H
#include "Common.h" #include "Common.h"
#include "DSPInterpreter.h" #include "DSPInterpreter.h"
#include "DSPCore.h" #include "DSPCore.h"
#include "DSPMemoryMap.h"
#include "gdsp_memory.h"
#include "gdsp_interpreter.h" #include "gdsp_interpreter.h"
#include "gdsp_registers.h" #include "gdsp_registers.h"
#include "gdsp_ext_op.h" // #include "DSPIntExtOps.h"
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// --- SR // --- SR
@@ -51,20 +50,8 @@ inline bool dsp_SR_is_flag_set(int flag)
} }
// See http://code.google.com/p/dolphin-emu/source/detail?r=3125
inline void dsp_decrement_addr_reg(int reg)
{
// This one was easy. increment is worse...
if ((g_dsp.r[reg] & g_dsp.r[DSP_REG_WR0 + reg]) == 0)
g_dsp.r[reg] |= g_dsp.r[DSP_REG_WR0 + reg];
else
g_dsp.r[reg]--;
}
// HORRIBLE UGLINESS, someone please fix. // HORRIBLE UGLINESS, someone please fix.
// See http://code.google.com/p/dolphin-emu/source/detail?r=3125 // See http://code.google.com/p/dolphin-emu/source/detail?r=3125
inline u16 ToMask(u16 a) inline u16 ToMask(u16 a)
{ {
a = a | (a >> 8); a = a | (a >> 8);
@@ -82,6 +69,16 @@ inline void dsp_increment_addr_reg(int reg)
g_dsp.r[reg]++; g_dsp.r[reg]++;
} }
// See http://code.google.com/p/dolphin-emu/source/detail?r=3125
inline void dsp_decrement_addr_reg(int reg)
{
// This one is easy. Looks like a hw implementation. Increment is worse...
if ((g_dsp.r[reg] & g_dsp.r[DSP_REG_WR0 + reg]) == 0)
g_dsp.r[reg] |= g_dsp.r[DSP_REG_WR0 + reg];
else
g_dsp.r[reg]--;
}
inline void dsp_increase_addr_reg(int reg, s16 value) inline void dsp_increase_addr_reg(int reg, s16 value)
{ {
// TODO: DO RIGHT! // TODO: DO RIGHT!
@@ -26,20 +26,20 @@
#include <stdio.h> #include <stdio.h>
#include "gdsp_interpreter.h" #include "gdsp_interpreter.h"
#include "gdsp_memory.h"
#include "gdsp_interface.h" #include "gdsp_interface.h"
#include "DSPMemoryMap.h"
#include "DSPCore.h" #include "DSPCore.h"
u16 dsp_imem_read(u16 addr) u16 dsp_imem_read(u16 addr)
{ {
switch (addr >> 12) switch (addr >> 12)
{ {
case 0: case 0: // 0xxx IRAM
return g_dsp.iram[addr & DSP_IRAM_MASK]; return g_dsp.iram[addr & DSP_IRAM_MASK];
case 8: case 8: // 8xxx IROM - contains code to receive code for IRAM, and a bunch of mixing loops.
return g_dsp.irom[addr & DSP_IROM_MASK]; return g_dsp.irom[addr & DSP_IROM_MASK];
default: default: // Unmapped/non-existing memory
ERROR_LOG(DSPLLE, "%04x DSP ERROR: Executing from invalid (%04x) memory", g_dsp.pc, addr); ERROR_LOG(DSPLLE, "%04x DSP ERROR: Executing from invalid (%04x) memory", g_dsp.pc, addr);
return 0; return 0;
} }
@@ -49,16 +49,17 @@ u16 dsp_dmem_read(u16 addr)
{ {
switch (addr >> 12) switch (addr >> 12)
{ {
case 0x0: // 0xxx DRAM case 0x0: // 0xxx DRAM
return g_dsp.dram[addr & DSP_DRAM_MASK]; return g_dsp.dram[addr & DSP_DRAM_MASK];
case 0x1: // 1xxx COEF case 0x1: // 1xxx COEF
// DEBUG_LOG(DSPLLE, "%04x : Coef Read @ %04x", g_dsp.pc, addr);
return g_dsp.coef[addr & DSP_COEF_MASK]; return g_dsp.coef[addr & DSP_COEF_MASK];
case 0xf: // Fxxx HW regs case 0xf: // Fxxx HW regs
return gdsp_ifx_read(addr); return gdsp_ifx_read(addr);
default: // error default: // Unmapped/non-existing memory
ERROR_LOG(DSPLLE, "%04x DSP ERROR: Read from UNKNOWN (%04x) memory", g_dsp.pc, addr); ERROR_LOG(DSPLLE, "%04x DSP ERROR: Read from UNKNOWN (%04x) memory", g_dsp.pc, addr);
return 0; return 0;
} }
@@ -73,14 +74,14 @@ void dsp_dmem_write(u16 addr, u16 val)
break; break;
case 0x1: // 1xxx COEF case 0x1: // 1xxx COEF
ERROR_LOG(DSPLLE, "someone writes to COEF (pc = %02x)", g_dsp.pc); ERROR_LOG(DSPLLE, "Illegal write to COEF (pc = %02x)", g_dsp.pc);
break; break;
case 0xf: // Fxxx HW regs case 0xf: // Fxxx HW regs
gdsp_ifx_write(addr, val); gdsp_ifx_write(addr, val);
break; break;
default: // error default: // Unmapped/non-existing memory
ERROR_LOG(DSPLLE, "%04x DSP ERROR: Write to UNKNOWN (%04x) memory", g_dsp.pc, addr); ERROR_LOG(DSPLLE, "%04x DSP ERROR: Write to UNKNOWN (%04x) memory", g_dsp.pc, addr);
break; break;
} }
@@ -22,6 +22,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/ ====================================================================*/
#ifndef _GDSP_MEMORY_H #ifndef _GDSP_MEMORY_H
#define _GDSP_MEMORY_H #define _GDSP_MEMORY_H
+1 -1
View File
@@ -53,7 +53,7 @@ jnz, ifs, retlnz
#include "DSPInterpreter.h" #include "DSPInterpreter.h"
#include "DSPJit.h" #include "DSPJit.h"
#include "gdsp_ext_op.h" #include "DSPIntExtOps.h"
void nop(const UDSPInstruction& opc) void nop(const UDSPInstruction& opc)
{ {
+1 -1
View File
@@ -20,7 +20,7 @@
#include "DSPInterpreter.h" #include "DSPInterpreter.h"
#include "gdsp_condition_codes.h" #include "gdsp_condition_codes.h"
#include "gdsp_opcodes_helper.h" #include "DSPIntUtil.h"
// Arithmetic and accumulator control. // Arithmetic and accumulator control.
+2 -3
View File
@@ -21,9 +21,8 @@
#include "DSPCore.h" #include "DSPCore.h"
#include "gdsp_condition_codes.h" #include "gdsp_condition_codes.h"
#include "gdsp_opcodes_helper.h" #include "DSPIntUtil.h"
#include "gdsp_memory.h" #include "DSPMemoryMap.h"
namespace DSPInterpreter { namespace DSPInterpreter {
+2 -2
View File
@@ -19,8 +19,8 @@
#include "DSPInterpreter.h" #include "DSPInterpreter.h"
#include "gdsp_memory.h" #include "DSPMemoryMap.h"
#include "gdsp_opcodes_helper.h" #include "DSPIntUtil.h"
namespace DSPInterpreter { namespace DSPInterpreter {
+1 -1
View File
@@ -23,7 +23,7 @@
#include "DSPCore.h" #include "DSPCore.h"
#include "gdsp_registers.h" #include "gdsp_registers.h"
#include "gdsp_opcodes_helper.h" #include "DSPIntUtil.h"
namespace DSPInterpreter { namespace DSPInterpreter {
+1 -1
View File
@@ -23,7 +23,7 @@
#include "DSPInterpreter.h" #include "DSPInterpreter.h"
#include "gdsp_condition_codes.h" #include "gdsp_condition_codes.h"
#include "gdsp_opcodes_helper.h" #include "DSPIntUtil.h"
#include "gdsp_registers.h" #include "gdsp_registers.h"
namespace DSPInterpreter { namespace DSPInterpreter {
+2 -4
View File
@@ -32,7 +32,7 @@
#include "DSPHost.h" #include "DSPHost.h"
#include "DSPTables.h" #include "DSPTables.h"
#include "DSPAnalyzer.h" #include "DSPAnalyzer.h"
#include "gdsp_aram.h" #include "DSPAccelerator.h"
#include "gdsp_interpreter.h" #include "gdsp_interpreter.h"
#include "gdsp_interface.h" #include "gdsp_interface.h"
@@ -124,7 +124,7 @@ void gdsp_ifx_write(u16 addr, u16 val)
{ {
case 0xfb: // DIRQ case 0xfb: // DIRQ
if (val & 0x1) if (val & 0x1)
g_dsp.irq_request(); DSPHost_InterruptRequest();
break; break;
case 0xfc: // DMBH case 0xfc: // DMBH
@@ -311,5 +311,3 @@ void gdsp_dma()
break; break;
} }
} }

Some files were not shown because too many files have changed in this diff Show More