cellSync2 stub activated

This commit is contained in:
Nekotekina 2014-08-27 02:44:32 +04:00
parent 36e691c2db
commit bbf7508d41
8 changed files with 134 additions and 115 deletions

View File

@ -48,8 +48,9 @@ extern Module *cellSail;
extern void cellSpurs_init();
extern Module *cellSpurs;
extern void cellSync_init();
extern void cellSync_load();
extern Module *cellSync;
extern void cellSync2_init();
extern Module *cellSync2;
extern void cellSysmodule_init();
extern Module *cellSysmodule;
extern void cellSysutil_init();
@ -253,7 +254,9 @@ void ModuleManager::init()
cellSpurs = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x000a, cellSpurs_init);
cellSync = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back("cellSync", cellSync_init, cellSync_load, nullptr);
m_mod_init.emplace_back("cellSync", cellSync_init);
cellSync2 = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back("cellSync2", cellSync2_init);
cellSysutil = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0015, cellSysutil_init);
cellSysutilAp = static_cast <Module*>(&(m_mod_init.back())) + 1;

View File

@ -1,4 +1,5 @@
#include "stdafx.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/SysCalls/Modules.h"
#include "Emu/SysCalls/Static.h"
@ -187,4 +188,16 @@ IdManager& Module::GetIdManager() const
void Module::PushNewFuncSub(SFunc* func)
{
Emu.GetSFuncManager().push_back(func);
}
void fix_import(Module* module, u32 func, u32 addr)
{
Memory.Write32(addr + 0x0, 0x3d600000 | (func >> 16)); /* lis r11, (func_id >> 16) */
Memory.Write32(addr + 0x4, 0x616b0000 | (func & 0xffff)); /* ori r11, (func_id & 0xffff) */
Memory.Write32(addr + 0x8, 0x60000000); /* nop */
// leave rtoc saving at 0xC
Memory.Write64(addr + 0x10, 0x440000024e800020ull); /* sc + blr */
Memory.Write64(addr + 0x18, 0x6000000060000000ull); /* nop + nop */
module->Load(func);
}

View File

@ -162,6 +162,10 @@ __forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], cons
PushNewFuncSub(sf);
}
void fix_import(Module* module, u32 func, u32 addr);
#define FIX_IMPORT(module, func, addr) fix_import(module, getFunctionId(#func), addr)
#define REG_SUB(module, group, name, ...) \
static const u64 name ## _table[] = {__VA_ARGS__ , 0}; \
module->AddFuncSub(group, name ## _table, #name, name)

View File

@ -14,22 +14,7 @@ Module *cellSync = nullptr;
#ifdef PRX_DEBUG
#include "prx_libsre.h"
u32 libsre;
u32 libsre_rtoc;
void fix_import(Module* module, u32 func, u32 addr)
{
Memory.Write32(addr + 0x0, 0x3d600000 | (func >> 16)); /* lis r11, (func_id >> 16) */
Memory.Write32(addr + 0x4, 0x616b0000 | (func & 0xffff)); /* ori r11, (func_id & 0xffff) */
Memory.Write32(addr + 0x8, 0x60000000); /* nop */
// leave rtoc saving at 0xC
Memory.Write64(addr + 0x10, 0x440000024e800020ull); /* sc + blr */
Memory.Write64(addr + 0x18, 0x6000000060000000ull); /* nop + nop */
module->Load(func);
}
#define FIX_IMPORT(module, func, addr) fix_import(module, getFunctionId(#func), addr)
u32 libsre_rtoc;
#endif
s32 syncMutexInitialize(mem_ptr_t<CellSyncMutex> mutex)
@ -2217,10 +2202,7 @@ void cellSync_init()
cellSync->AddFunc(0xe1bc7add, _cellSyncLFQueuePopBody);
cellSync->AddFunc(0xe9bf2110, _cellSyncLFQueueGetPushPointer);
cellSync->AddFunc(0xfe74e8e7, _cellSyncLFQueueCompletePopPointer);
}
void cellSync_load()
{
#ifdef PRX_DEBUG
CallAfter([]()
{
@ -2317,5 +2299,4 @@ void cellSync_load()
#endif
}
#undef PRX_DEBUG
#undef FIX_IMPORT
#undef PRX_DEBUG

View File

@ -1,25 +1,19 @@
#include "stdafx.h"
#if 0
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/SysCalls/Modules.h"
void cellSync2_init();
Module cellSync2(0x0055, cellSync2_init);
#include "cellSync2.h"
// Return Codes
enum
{
CELL_SYNC2_ERROR_AGAIN = 0x80410C01,
CELL_SYNC2_ERROR_INVAL = 0x80410C02,
CELL_SYNC2_ERROR_NOMEM = 0x80410C04,
CELL_SYNC2_ERROR_DEADLK = 0x80410C08,
CELL_SYNC2_ERROR_PERM = 0x80410C09,
CELL_SYNC2_ERROR_BUSY = 0x80410C0A,
CELL_SYNC2_ERROR_STAT = 0x80410C0F,
CELL_SYNC2_ERROR_ALIGN = 0x80410C10,
CELL_SYNC2_ERROR_NULL_POINTER = 0x80410C11,
CELL_SYNC2_ERROR_NOT_SUPPORTED_THREAD = 0x80410C12,
CELL_SYNC2_ERROR_NO_NOTIFIER = 0x80410C13,
CELL_SYNC2_ERROR_NO_SPU_CONTEXT_STORAGE = 0x80410C14,
};
//void cellSync2_init();
//Module cellSync2(0x0055, cellSync2_init);
Module* cellSync2 = nullptr;
#ifdef PRX_DEBUG
#include "prx_libsync2.h"
u32 libsync2;
u32 libsync2_rtoc;
#endif
int _cellSync2MutexAttributeInitialize()
{
@ -215,40 +209,42 @@ int cellSync2QueueGetDepth()
void cellSync2_init()
{
cellSync2.AddFunc(0x55836e73, _cellSync2MutexAttributeInitialize);
cellSync2.AddFunc(0xd51bfae7, cellSync2MutexEstimateBufferSize);
cellSync2.AddFunc(0xeb81a467, cellSync2MutexInitialize);
cellSync2.AddFunc(0x27f2d61c, cellSync2MutexFinalize);
cellSync2.AddFunc(0xa400d82e, cellSync2MutexLock);
cellSync2.AddFunc(0xa69c749c, cellSync2MutexTryLock);
cellSync2.AddFunc(0x0080fe88, cellSync2MutexUnlock);
cellSync2->AddFunc(0x55836e73, _cellSync2MutexAttributeInitialize);
cellSync2->AddFunc(0xd51bfae7, cellSync2MutexEstimateBufferSize);
cellSync2->AddFunc(0xeb81a467, cellSync2MutexInitialize);
cellSync2->AddFunc(0x27f2d61c, cellSync2MutexFinalize);
cellSync2->AddFunc(0xa400d82e, cellSync2MutexLock);
cellSync2->AddFunc(0xa69c749c, cellSync2MutexTryLock);
cellSync2->AddFunc(0x0080fe88, cellSync2MutexUnlock);
cellSync2.AddFunc(0xdf3c532a, _cellSync2CondAttributeInitialize);
cellSync2.AddFunc(0x5b1e4d7a, cellSync2CondEstimateBufferSize);
cellSync2.AddFunc(0x58be9a0f, cellSync2CondInitialize);
cellSync2.AddFunc(0x63062249, cellSync2CondFinalize);
cellSync2.AddFunc(0xbc96d751, cellSync2CondWait);
cellSync2.AddFunc(0x871af804, cellSync2CondSignal);
cellSync2.AddFunc(0x8aae07c2, cellSync2CondSignalAll);
cellSync2->AddFunc(0xdf3c532a, _cellSync2CondAttributeInitialize);
cellSync2->AddFunc(0x5b1e4d7a, cellSync2CondEstimateBufferSize);
cellSync2->AddFunc(0x58be9a0f, cellSync2CondInitialize);
cellSync2->AddFunc(0x63062249, cellSync2CondFinalize);
cellSync2->AddFunc(0xbc96d751, cellSync2CondWait);
cellSync2->AddFunc(0x871af804, cellSync2CondSignal);
cellSync2->AddFunc(0x8aae07c2, cellSync2CondSignalAll);
cellSync2.AddFunc(0x2d77fe17, _cellSync2SemaphoreAttributeInitialize);
cellSync2.AddFunc(0x74c2780f, cellSync2SemaphoreEstimateBufferSize);
cellSync2.AddFunc(0xc5dee254, cellSync2SemaphoreInitialize);
cellSync2.AddFunc(0x164843a7, cellSync2SemaphoreFinalize);
cellSync2.AddFunc(0xd1b0d146, cellSync2SemaphoreAcquire);
cellSync2.AddFunc(0x5e4b0f87, cellSync2SemaphoreTryAcquire);
cellSync2.AddFunc(0x0c2983ac, cellSync2SemaphoreRelease);
cellSync2.AddFunc(0x4e2ee031, cellSync2SemaphoreGetCount);
cellSync2->AddFunc(0x2d77fe17, _cellSync2SemaphoreAttributeInitialize);
cellSync2->AddFunc(0x74c2780f, cellSync2SemaphoreEstimateBufferSize);
cellSync2->AddFunc(0xc5dee254, cellSync2SemaphoreInitialize);
cellSync2->AddFunc(0x164843a7, cellSync2SemaphoreFinalize);
cellSync2->AddFunc(0xd1b0d146, cellSync2SemaphoreAcquire);
cellSync2->AddFunc(0x5e4b0f87, cellSync2SemaphoreTryAcquire);
cellSync2->AddFunc(0x0c2983ac, cellSync2SemaphoreRelease);
cellSync2->AddFunc(0x4e2ee031, cellSync2SemaphoreGetCount);
cellSync2.AddFunc(0x5e00d433, _cellSync2QueueAttributeInitialize);
cellSync2.AddFunc(0xc08cc0f9, cellSync2QueueEstimateBufferSize);
cellSync2.AddFunc(0xf125e044, cellSync2QueueInitialize);
cellSync2.AddFunc(0x6af85cdf, cellSync2QueueFinalize);
cellSync2.AddFunc(0x7d967d91, cellSync2QueuePush);
cellSync2.AddFunc(0x7fd479fe, cellSync2QueueTryPush);
cellSync2.AddFunc(0xd83ab0c9, cellSync2QueuePop);
cellSync2.AddFunc(0x0c9a0ea9, cellSync2QueueTryPop);
cellSync2.AddFunc(0x12f0a27d, cellSync2QueueGetSize);
cellSync2.AddFunc(0xf0e1471c, cellSync2QueueGetDepth);
}
cellSync2->AddFunc(0x5e00d433, _cellSync2QueueAttributeInitialize);
cellSync2->AddFunc(0xc08cc0f9, cellSync2QueueEstimateBufferSize);
cellSync2->AddFunc(0xf125e044, cellSync2QueueInitialize);
cellSync2->AddFunc(0x6af85cdf, cellSync2QueueFinalize);
cellSync2->AddFunc(0x7d967d91, cellSync2QueuePush);
cellSync2->AddFunc(0x7fd479fe, cellSync2QueueTryPush);
cellSync2->AddFunc(0xd83ab0c9, cellSync2QueuePop);
cellSync2->AddFunc(0x0c9a0ea9, cellSync2QueueTryPop);
cellSync2->AddFunc(0x12f0a27d, cellSync2QueueGetSize);
cellSync2->AddFunc(0xf0e1471c, cellSync2QueueGetDepth);
#ifdef PRX_DEBUG
#endif
}

View File

@ -0,0 +1,18 @@
#pragma once
// Return Codes
enum
{
CELL_SYNC2_ERROR_AGAIN = 0x80410C01,
CELL_SYNC2_ERROR_INVAL = 0x80410C02,
CELL_SYNC2_ERROR_NOMEM = 0x80410C04,
CELL_SYNC2_ERROR_DEADLK = 0x80410C08,
CELL_SYNC2_ERROR_PERM = 0x80410C09,
CELL_SYNC2_ERROR_BUSY = 0x80410C0A,
CELL_SYNC2_ERROR_STAT = 0x80410C0F,
CELL_SYNC2_ERROR_ALIGN = 0x80410C10,
CELL_SYNC2_ERROR_NULL_POINTER = 0x80410C11,
CELL_SYNC2_ERROR_NOT_SUPPORTED_THREAD = 0x80410C12,
CELL_SYNC2_ERROR_NO_NOTIFIER = 0x80410C13,
CELL_SYNC2_ERROR_NO_SPU_CONTEXT_STORAGE = 0x80410C14,
};

View File

@ -371,6 +371,7 @@
<ClInclude Include="Emu\SysCalls\Modules\cellRtc.h" />
<ClInclude Include="Emu\SysCalls\Modules\cellSpurs.h" />
<ClInclude Include="Emu\SysCalls\Modules\cellSync.h" />
<ClInclude Include="Emu\SysCalls\Modules\cellSync2.h" />
<ClInclude Include="Emu\SysCalls\Modules\cellSysutil.h" />
<ClInclude Include="Emu\SysCalls\Modules\cellSysutil_SaveData.h" />
<ClInclude Include="Emu\SysCalls\Modules\cellUserInfo.h" />

View File

@ -60,9 +60,6 @@
<Filter Include="Utilities\SimpleIni">
<UniqueIdentifier>{84c34dd1-4c49-4ecf-8ee2-4165c14f24be}</UniqueIdentifier>
</Filter>
<Filter Include="Emu\Cell\currently_unused">
<UniqueIdentifier>{ead7494f-a872-4b4d-a864-1a61c3b6012f}</UniqueIdentifier>
</Filter>
<Filter Include="Emu\RSX">
<UniqueIdentifier>{fadb4b36-57af-4583-891d-d22ff369e266}</UniqueIdentifier>
</Filter>
@ -75,6 +72,9 @@
<Filter Include="Emu\Io\Null">
<UniqueIdentifier>{fcac6852-b45f-4cf2-afee-cf56bcea14e5}</UniqueIdentifier>
</Filter>
<Filter Include="Emu\SysCalls\currently_unused">
<UniqueIdentifier>{ead7494f-a872-4b4d-a864-1a61c3b6012f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Crypto\aes.cpp">
@ -369,109 +369,106 @@
<Filter>Emu\Cell</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellBgdl.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellCamera.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellCelp8Enc.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellCelpEnc.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellFiber.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellGem.cpp">
<Filter>Emu\SysCalls\Modules</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellHttpUtil.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellImejp.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellJpgEnc.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellKey2char.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellLv2dbg.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellMic.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellMusicDecode.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellMusicExport.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellOvis.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellPhotoDecode.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellPhotoExport.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellPhotoImport.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellPngEnc.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellPrint.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellRudp.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellSail.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellSailRec.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellScreenshot.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellSearch.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellSheap.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellSsl.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellSubdisplay.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellSync2.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellUsbd.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellUsbpspcm.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellVoice.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\libsnd3.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\libsynth2.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\sys_http.cpp">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="..\Utilities\SSemaphore.cpp">
<Filter>Utilities</Filter>
@ -605,6 +602,9 @@
<ClCompile Include="Ini.cpp">
<Filter>Utilities</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellSync2.cpp">
<Filter>Emu\SysCalls\Modules</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Crypto\aes.h">
@ -974,10 +974,10 @@
<Filter>Emu\Cell</Filter>
</ClInclude>
<ClInclude Include="Emu\SysCalls\Modules\libsnd3.h">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClInclude>
<ClInclude Include="Emu\SysCalls\Modules\libsynth2.h">
<Filter>Emu\Cell\currently_unused</Filter>
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClInclude>
<ClInclude Include="Emu\Event.h">
<Filter>Emu\SysCalls</Filter>
@ -1159,5 +1159,8 @@
<ClInclude Include="Emu\Io\Null\NullMouseHandler.h">
<Filter>Emu\Io\Null</Filter>
</ClInclude>
<ClInclude Include="Emu\SysCalls\Modules\cellSync2.h">
<Filter>Emu\SysCalls\Modules</Filter>
</ClInclude>
</ItemGroup>
</Project>