PPCThread removed (it does nothing anyway)

This commit is contained in:
Nekotekina 2015-02-26 03:54:49 +03:00
parent 9b2907dc64
commit be4e85f0f2
13 changed files with 50 additions and 92 deletions

View file

@ -1,27 +0,0 @@
#include "stdafx.h"
#include "PPCThread.h"
#include "Emu/Memory/Memory.h"
PPCThread* GetCurrentPPCThread()
{
CPUThread* thread = GetCurrentCPUThread();
if(!thread || (thread->GetType() != CPU_THREAD_PPU && thread->GetType() != CPU_THREAD_SPU && thread->GetType() != CPU_THREAD_RAW_SPU))
{
throw std::string("GetCurrentPPCThread: bad thread");
}
return (PPCThread*)thread;
}
PPCThread::PPCThread(CPUThreadType type) : CPUThread(type)
{
}
PPCThread::~PPCThread()
{
}
void PPCThread::DoReset()
{
}

View file

@ -1,22 +0,0 @@
#pragma once
#include "Emu/CPU/CPUThread.h"
class PPCThread : public CPUThread
{
public:
virtual std::string GetThreadName() const
{
return fmt::format("%s[0x%08x]", GetFName(), PC);
}
protected:
PPCThread(CPUThreadType type);
public:
virtual ~PPCThread();
protected:
virtual void DoReset() override;
};
PPCThread* GetCurrentPPCThread();

View file

@ -19,14 +19,14 @@ extern void ppu_free_tls(u32 thread);
PPUThread& GetCurrentPPUThread() PPUThread& GetCurrentPPUThread()
{ {
PPCThread* thread = GetCurrentPPCThread(); CPUThread* thread = GetCurrentCPUThread();
if(!thread || thread->GetType() != CPU_THREAD_PPU) throw std::string("GetCurrentPPUThread: bad thread"); if(!thread || thread->GetType() != CPU_THREAD_PPU) throw std::string("GetCurrentPPUThread: bad thread");
return *(PPUThread*)thread; return *(PPUThread*)thread;
} }
PPUThread::PPUThread() : PPCThread(CPU_THREAD_PPU) PPUThread::PPUThread() : CPUThread(CPU_THREAD_PPU)
{ {
owned_mutexes = 0; owned_mutexes = 0;
Reset(); Reset();
@ -39,8 +39,6 @@ PPUThread::~PPUThread()
void PPUThread::DoReset() void PPUThread::DoReset()
{ {
PPCThread::DoReset();
//reset regs //reset regs
memset(VPR, 0, sizeof(VPR)); memset(VPR, 0, sizeof(VPR));
memset(FPR, 0, sizeof(FPR)); memset(FPR, 0, sizeof(FPR));

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "Emu/Cell/Common.h" #include "Emu/Cell/Common.h"
#include "Emu/Cell/PPCThread.h" #include "Emu/CPU/CPUThread.h"
#include "Emu/Memory/vm.h" #include "Emu/Memory/vm.h"
enum enum
@ -467,7 +467,7 @@ struct FPRdouble
static int Cmp(PPCdouble a, PPCdouble b); static int Cmp(PPCdouble a, PPCdouble b);
}; };
class PPUThread : public PPCThread class PPUThread : public CPUThread
{ {
public: public:
PPCdouble FPR[32]; //Floating Point Register PPCdouble FPR[32]; //Floating Point Register

View file

@ -47,7 +47,7 @@ bool RawSPUThread::Read32(const u32 addr, u32* value)
case SPU_MBox_Status_offs: case SPU_MBox_Status_offs:
{ {
*value = (SPU.Out_MBox.GetCount() & 0xff) | (SPU.In_MBox.GetFreeCount() << 8); *value = (SPU.Out_MBox.GetCount() & 0xff) | (SPU.In_MBox.GetFreeCount() << 8) | (SPU.Out_IntrMBox.GetCount() << 16);
break; break;
} }

View file

@ -23,7 +23,7 @@
SPUThread& GetCurrentSPUThread() SPUThread& GetCurrentSPUThread()
{ {
PPCThread* thread = GetCurrentPPCThread(); CPUThread* thread = GetCurrentCPUThread();
if(!thread || (thread->GetType() != CPU_THREAD_SPU && thread->GetType() != CPU_THREAD_RAW_SPU)) if(!thread || (thread->GetType() != CPU_THREAD_SPU && thread->GetType() != CPU_THREAD_RAW_SPU))
{ {
@ -33,7 +33,7 @@ SPUThread& GetCurrentSPUThread()
return *(SPUThread*)thread; return *(SPUThread*)thread;
} }
SPUThread::SPUThread(CPUThreadType type) : PPCThread(type) SPUThread::SPUThread(CPUThreadType type) : CPUThread(type)
{ {
assert(type == CPU_THREAD_SPU || type == CPU_THREAD_RAW_SPU); assert(type == CPU_THREAD_SPU || type == CPU_THREAD_RAW_SPU);
@ -73,10 +73,8 @@ void SPUThread::Task()
void SPUThread::DoReset() void SPUThread::DoReset()
{ {
PPCThread::DoReset();
//reset regs //reset regs
memset(GPR, 0, sizeof(u128) * 128); memset(GPR, 0, sizeof(GPR));
} }
void SPUThread::InitRegs() void SPUThread::InitRegs()
@ -568,7 +566,7 @@ void SPUThread::WriteChannel(u32 ch, const u128& r)
return; return;
} }
//if (Ini.HLELogging.GetValue()) if (Ini.HLELogging.GetValue())
{ {
LOG_WARNING(Log::SPU, "sys_spu_thread_throw_event(spup=%d, data0=0x%x, data1=0x%x)", spup, v & 0x00ffffff, data); LOG_WARNING(Log::SPU, "sys_spu_thread_throw_event(spup=%d, data0=0x%x, data1=0x%x)", spup, v & 0x00ffffff, data);
} }

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "Emu/Cell/Common.h" #include "Emu/Cell/Common.h"
#include "Emu/CPU/CPUThread.h"
#include "Emu/Memory/atomic_type.h" #include "Emu/Memory/atomic_type.h"
#include "PPCThread.h"
#include "Emu/SysCalls/lv2/sleep_queue_type.h" #include "Emu/SysCalls/lv2/sleep_queue_type.h"
#include "Emu/SysCalls/lv2/sys_event.h" #include "Emu/SysCalls/lv2/sys_event.h"
#include "Emu/Event.h" #include "Emu/Event.h"
@ -287,7 +287,7 @@ union SPU_SNRConfig_hdr
struct SpuGroupInfo; struct SpuGroupInfo;
class SPUThread : public PPCThread class SPUThread : public CPUThread
{ {
public: public:
u128 GPR[128]; // General-Purpose Registers u128 GPR[128]; // General-Purpose Registers

View file

@ -32,10 +32,17 @@ u32 add_ppu_func_sub(StaticFunc func)
u32 add_ppu_func_sub(const char group[8], const u64 ops[], const char* name, Module* module, ppu_func_caller func) u32 add_ppu_func_sub(const char group[8], const u64 ops[], const char* name, Module* module, ppu_func_caller func)
{ {
char group_name[9] = {};
if (group)
{
strcpy_trunc(group_name, group);
}
StaticFunc sf; StaticFunc sf;
sf.index = add_ppu_func(ModuleFunc(get_function_id(name), 0, module, func)); sf.index = add_ppu_func(ModuleFunc(get_function_id(name), 0, module, func));
sf.name = name; sf.name = name;
sf.group = *(u64*)group; sf.group = *(u64*)group_name;
sf.found = 0; sf.found = 0;
// TODO: check for self-inclusions, use CRC // TODO: check for self-inclusions, use CRC
@ -259,6 +266,12 @@ void hook_ppu_funcs(u32* base, u32 size)
{ {
const u64 group = g_ppu_func_subs[i].group; const u64 group = g_ppu_func_subs[i].group;
if (!group)
{
// skip if group not set
continue;
}
enum GroupSearchResult : u32 enum GroupSearchResult : u32
{ {
GSR_SUCCESS = 0, // every function from this group has been found once GSR_SUCCESS = 0, // every function from this group has been found once
@ -320,17 +333,17 @@ void hook_ppu_funcs(u32* base, u32 size)
if (g_ppu_func_subs[j].group == group) g_ppu_func_subs[j].found = 0; if (g_ppu_func_subs[j].group == group) g_ppu_func_subs[j].found = 0;
} }
char name[9] = "????????"; char group_name[9] = {};
*(u64*)name = group; *(u64*)group_name = group;
if (res == GSR_SUCCESS) if (res == GSR_SUCCESS)
{ {
LOG_SUCCESS(LOADER, "Function group [%s] successfully hooked", std::string(name, 9).c_str()); LOG_SUCCESS(LOADER, "Function group [%s] successfully hooked", group_name);
} }
else else
{ {
LOG_ERROR(LOADER, "Function group [%s] failed:%s%s", std::string(name, 9).c_str(), LOG_ERROR(LOADER, "Function group [%s] failed:%s%s", group_name,
(res & GSR_MISSING ? " missing;" : ""), (res & GSR_MISSING ? " missing;" : ""),
(res & GSR_EXCESS ? " excess;" : "")); (res & GSR_EXCESS ? " excess;" : ""));
} }

View file

@ -151,4 +151,6 @@ void hook_ppu_funcs(u32* base, u32 size);
static const u64 name ## _table[] = {__VA_ARGS__ , 0}; \ static const u64 name ## _table[] = {__VA_ARGS__ , 0}; \
if (name ## _table[0]) add_ppu_func_sub(group, name ## _table, #name, &module, bind_func(name)) if (name ## _table[0]) add_ppu_func_sub(group, name ## _table, #name, &module, bind_func(name))
#define op_mask(op) []() -> u64 { s32 XXX = 0; u64 _op = (op); XXX = -1; return ((op) ^ ~_op) << 32 | _op; }()
#define UNIMPLEMENTED_FUNC(module) module.Error("%s", __FUNCTION__) #define UNIMPLEMENTED_FUNC(module) module.Error("%s", __FUNCTION__)

View file

@ -1,8 +1,10 @@
#include "stdafx.h" #include "stdafx.h"
#include "Utilities/Log.h"
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
#include "Emu/System.h" #include "Emu/System.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
#include "Emu/SysCalls/CB_FUNC.h" #include "Emu/SysCalls/CB_FUNC.h"
#include "Emu/Cell/PPUInstrTable.h"
#include "Emu/CPU/CPUThreadManager.h" #include "Emu/CPU/CPUThreadManager.h"
#include "cellAudio.h" #include "cellAudio.h"
@ -638,6 +640,8 @@ Module libmixer("libmixer", []()
ssp.clear(); ssp.clear();
}; };
using namespace PPU_instr;
REG_SUB(libmixer, "surmxAAN", cellAANAddData, REG_SUB(libmixer, "surmxAAN", cellAANAddData,
0xffffffff7c691b78, 0xffffffff7c691b78,
0xffffffff7c0802a6, 0xffffffff7c0802a6,
@ -776,7 +780,7 @@ Module libmixer("libmixer", []()
); );
REG_SUB(libmixer, "surmixer", cellSurMixerGetAANHandle, REG_SUB(libmixer, "surmixer", cellSurMixerGetAANHandle,
0xff00000081428250, // lwz op_mask(LWZ(10, 2, XXX)),
0xffffffff3d607fce, 0xffffffff3d607fce,
0xffffffff616bfffe, 0xffffffff616bfffe,
0xffffffff812a0018, 0xffffffff812a0018,
@ -793,7 +797,7 @@ Module libmixer("libmixer", []()
); );
REG_SUB(libmixer, "surmixer", cellSurMixerChStripGetAANPortNo, REG_SUB(libmixer, "surmixer", cellSurMixerChStripGetAANPortNo,
0xff00000081228250, // lwz op_mask(LWZ(9, 2, XXX)),
0xffffffff7c661b78, 0xffffffff7c661b78,
0xffffffff3c608031, 0xffffffff3c608031,
0xffffffff78c60020, 0xffffffff78c60020,
@ -808,7 +812,7 @@ Module libmixer("libmixer", []()
); );
REG_SUB(libmixer, "surmixer", cellSurMixerSetNotifyCallback, REG_SUB(libmixer, "surmixer", cellSurMixerSetNotifyCallback,
0xff00000081428250, // lwz op_mask(LWZ(10, 2, XXX)),
0xffffffff7c0802a6, 0xffffffff7c0802a6,
0xfffffffff821ff81, 0xfffffffff821ff81,
0xfffffffff8010090, 0xfffffffff8010090,
@ -828,7 +832,7 @@ Module libmixer("libmixer", []()
0xffffffff7c0803a6, 0xffffffff7c0803a6,
0xffffffff4e800020, 0xffffffff4e800020,
0xffffff00419affec, // beq 0xffffff00419affec, // beq
0xf0000000800a001c, // lwz op_mask(LWZ(0, 10, XXX)),
0xffffffff79290020, 0xffffffff79290020,
0xffffffff38810070, 0xffffffff38810070,
0xffffffff2f800000, 0xffffffff2f800000,
@ -836,7 +840,7 @@ Module libmixer("libmixer", []()
); );
REG_SUB(libmixer, "surmixer", cellSurMixerRemoveNotifyCallback, REG_SUB(libmixer, "surmixer", cellSurMixerRemoveNotifyCallback,
0xff00000081628250, // lwz op_mask(LWZ(11, 2, XXX)),
0xffffffff7c0802a6, 0xffffffff7c0802a6,
0xfffffffff821ff81, 0xfffffffff821ff81,
0xfffffffff8010090, 0xfffffffff8010090,
@ -857,7 +861,7 @@ Module libmixer("libmixer", []()
0xfffffffff821ff71, 0xfffffffff821ff71,
0xffffffff7c0802a6, 0xffffffff7c0802a6,
0xfffffffffbc10080, 0xfffffffffbc10080,
0xf000000083c20000, // lwz op_mask(LWZ(30, 2, XXX)),
0xfffffffff80100a0, 0xfffffffff80100a0,
0xfffffffffba10078, 0xfffffffffba10078,
0xfffffffffbe10088, 0xfffffffffbe10088,
@ -881,7 +885,7 @@ Module libmixer("libmixer", []()
0xffffffff7c0802a6, 0xffffffff7c0802a6,
0xfffffffffbc10070, 0xfffffffffbc10070,
0xfffffffffc000890, 0xfffffffffc000890,
0xf000000083c28250, // lwz op_mask(LWZ(30, 2, XXX)),
0xffffffff3d208031, 0xffffffff3d208031,
0xfffffffff8010090, 0xfffffffff8010090,
0xfffffffffbe10078, 0xfffffffffbe10078,
@ -933,7 +937,7 @@ Module libmixer("libmixer", []()
); );
REG_SUB(libmixer, "surmixer", cellSurMixerSurBusAddData, REG_SUB(libmixer, "surmixer", cellSurMixerSurBusAddData,
0xff00000081428250, // lwz op_mask(LWZ(10, 2, XXX)),
0xffffffff7c0802a6, 0xffffffff7c0802a6,
0xfffffffff821ff91, 0xfffffffff821ff91,
0xfffffffff8010080, 0xfffffffff8010080,
@ -962,7 +966,7 @@ Module libmixer("libmixer", []()
); );
REG_SUB(libmixer, "surmixer", cellSurMixerChStripSetParameter, REG_SUB(libmixer, "surmixer", cellSurMixerChStripSetParameter,
0xff00000081028250, // lwz op_mask(LWZ(8, 2, XXX)),
0xffffffff7c6b1b78, 0xffffffff7c6b1b78,
0xffffffff3c608031, 0xffffffff3c608031,
0xffffffff7c8a2378, 0xffffffff7c8a2378,
@ -982,7 +986,7 @@ Module libmixer("libmixer", []()
); );
REG_SUB(libmixer, "surmixer", cellSurMixerPause, REG_SUB(libmixer, "surmixer", cellSurMixerPause,
0xff00000081428250, // lwz op_mask(LWZ(10, 2, XXX)),
0xffffffff7c0802a6, 0xffffffff7c0802a6,
0xfffffffff821ff81, 0xfffffffff821ff81,
0xfffffffff8010090, 0xfffffffff8010090,
@ -1007,7 +1011,7 @@ Module libmixer("libmixer", []()
); );
REG_SUB(libmixer, "surmixer", cellSurMixerGetCurrentBlockTag, REG_SUB(libmixer, "surmixer", cellSurMixerGetCurrentBlockTag,
0xff00000081628250, // lwz op_mask(LWZ(11, 2, XXX)),
0xffffffff3d208031, 0xffffffff3d208031,
0xffffffff61290002, 0xffffffff61290002,
0xffffffff880b0020, 0xffffffff880b0020,
@ -1021,7 +1025,7 @@ Module libmixer("libmixer", []()
); );
REG_SUB(libmixer, "surmixer", cellSurMixerGetTimestamp, REG_SUB(libmixer, "surmixer", cellSurMixerGetTimestamp,
0xff00000081628250, // lwz op_mask(LWZ(11, 2, XXX)),
0xffffffff7c0802a6, 0xffffffff7c0802a6,
0xfffffffff821ff91, 0xfffffffff821ff91,
0xfffffffff8010080, 0xfffffffff8010080,
@ -1043,7 +1047,7 @@ Module libmixer("libmixer", []()
); );
REG_SUB(libmixer, "surmixer", cellSurMixerBeep, REG_SUB(libmixer, "surmixer", cellSurMixerBeep,
0xff00000081228250, // lwz op_mask(LWZ(9, 2, XXX)),
0xffffffff7c641b78, 0xffffffff7c641b78,
0xffffffff80690018, 0xffffffff80690018,
0xffffffff2f830000, 0xffffffff2f830000,

View file

@ -7,7 +7,7 @@
#include "Debugger.h" #include "Debugger.h"
#include "InterpreterDisAsm.h" #include "InterpreterDisAsm.h"
#include "Emu/CPU/CPUThreadManager.h" #include "Emu/CPU/CPUThreadManager.h"
#include "Emu/Cell/PPCThread.h" #include "Emu/CPU/CPUThread.h"
class DbgEmuPanel : public wxPanel class DbgEmuPanel : public wxPanel
@ -95,7 +95,7 @@ public:
break; break;
case DID_EXIT_THR_SYSCALL: case DID_EXIT_THR_SYSCALL:
Emu.GetCPU().RemoveThread(((PPCThread*)event.GetClientData())->GetId()); Emu.GetCPU().RemoveThread(((CPUThread*)event.GetClientData())->GetId());
break; break;
} }

View file

@ -131,7 +131,6 @@
<ClCompile Include="Emu\Audio\XAudio2\XAudio2Thread.cpp" /> <ClCompile Include="Emu\Audio\XAudio2\XAudio2Thread.cpp" />
<ClCompile Include="Emu\Cell\MFC.cpp" /> <ClCompile Include="Emu\Cell\MFC.cpp" />
<ClCompile Include="Emu\Cell\PPCDecoder.cpp" /> <ClCompile Include="Emu\Cell\PPCDecoder.cpp" />
<ClCompile Include="Emu\Cell\PPCThread.cpp" />
<ClCompile Include="Emu\Cell\PPULLVMRecompilerTests.cpp"> <ClCompile Include="Emu\Cell\PPULLVMRecompilerTests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - MemLeak|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - MemLeak|x64'">true</ExcludedFromBuild>
@ -362,7 +361,6 @@
<ClInclude Include="Emu\Cell\PPCDecoder.h" /> <ClInclude Include="Emu\Cell\PPCDecoder.h" />
<ClInclude Include="Emu\Cell\PPCDisAsm.h" /> <ClInclude Include="Emu\Cell\PPCDisAsm.h" />
<ClInclude Include="Emu\Cell\PPCInstrTable.h" /> <ClInclude Include="Emu\Cell\PPCInstrTable.h" />
<ClInclude Include="Emu\Cell\PPCThread.h" />
<ClInclude Include="Emu\Cell\PPUDecoder.h" /> <ClInclude Include="Emu\Cell\PPUDecoder.h" />
<ClInclude Include="Emu\Cell\PPUDisAsm.h" /> <ClInclude Include="Emu\Cell\PPUDisAsm.h" />
<ClInclude Include="Emu\Cell\PPUInstrTable.h" /> <ClInclude Include="Emu\Cell\PPUInstrTable.h" />

View file

@ -341,9 +341,6 @@
<ClCompile Include="Emu\Cell\PPCDecoder.cpp"> <ClCompile Include="Emu\Cell\PPCDecoder.cpp">
<Filter>Emu\CPU\Cell</Filter> <Filter>Emu\CPU\Cell</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Emu\Cell\PPCThread.cpp">
<Filter>Emu\CPU\Cell</Filter>
</ClCompile>
<ClCompile Include="Emu\Cell\PPUThread.cpp"> <ClCompile Include="Emu\Cell\PPUThread.cpp">
<Filter>Emu\CPU\Cell</Filter> <Filter>Emu\CPU\Cell</Filter>
</ClCompile> </ClCompile>
@ -1105,9 +1102,6 @@
<ClInclude Include="Emu\Cell\PPCInstrTable.h"> <ClInclude Include="Emu\Cell\PPCInstrTable.h">
<Filter>Emu\CPU\Cell</Filter> <Filter>Emu\CPU\Cell</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Emu\Cell\PPCThread.h">
<Filter>Emu\CPU\Cell</Filter>
</ClInclude>
<ClInclude Include="Emu\Cell\PPUDecoder.h"> <ClInclude Include="Emu\Cell\PPUDecoder.h">
<Filter>Emu\CPU\Cell</Filter> <Filter>Emu\CPU\Cell</Filter>
</ClInclude> </ClInclude>