When LOADCORE LoadAndStartModule fails, reply immediately to the EE to prevent it from being locked down.

This commit is contained in:
Jean-Philip Desjardins 2014-08-23 21:42:02 -04:00
parent 44ddca5622
commit 3b7dc5ee1d
4 changed files with 20 additions and 9 deletions

View File

@ -450,18 +450,19 @@ void CIopBios::FinishModuleLoad()
m_sifMan->SendCallReply(Iop::CLoadcore::MODULE_ID, nullptr);
}
void CIopBios::LoadAndStartModule(const char* path, const char* args, unsigned int argsLength)
bool CIopBios::LoadAndStartModule(const char* path, const char* args, unsigned int argsLength)
{
uint32 handle = m_ioman->Open(Iop::Ioman::CDevice::OPEN_FLAG_RDONLY, path);
if(handle & 0x80000000)
{
CLog::GetInstance().Print(LOGNAME, "Tried to load '%s' which couldn't be found.", path);
return;
CLog::GetInstance().Print(LOGNAME, "Tried to load '%s' which couldn't be found.\r\n", path);
return false;
}
Iop::CIoman::CFile file(handle, *m_ioman);
Framework::CStream* stream = m_ioman->GetFileStream(file);
CElfFile module(*stream);
LoadAndStartModule(module, path, args, argsLength);
return true;
}
void CIopBios::LoadAndStartModule(uint32 modulePtr, const char* args, unsigned int argsLength)

View File

@ -88,7 +88,7 @@ public:
CIopBios(CMIPS&, uint8*, uint32);
virtual ~CIopBios();
void LoadAndStartModule(const char*, const char*, unsigned int);
bool LoadAndStartModule(const char*, const char*, unsigned int);
void LoadAndStartModule(uint32, const char*, unsigned int);
bool IsModuleLoaded(const char*) const;

View File

@ -79,8 +79,7 @@ bool CLoadcore::Invoke(uint32 method, uint32* args, uint32 argsSize, uint32* ret
switch(method)
{
case 0x00:
LoadModule(args, argsSize, ret, retSize);
return false; //Block EE till module is loaded
return LoadModule(args, argsSize, ret, retSize);
break;
case 0x01:
LoadExecutable(args, argsSize, ret, retSize);
@ -122,7 +121,7 @@ uint32 CLoadcore::QueryBootMode(uint32 param)
return 0;
}
void CLoadcore::LoadModule(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize)
bool CLoadcore::LoadModule(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize)
{
char moduleName[PATH_MAX_SIZE];
char moduleArgs[ARGS_MAX_SIZE];
@ -140,10 +139,21 @@ void CLoadcore::LoadModule(uint32* args, uint32 argsSize, uint32* ret, uint32 re
//Load the module
CLog::GetInstance().Print(LOG_NAME, "Request to load module '%s' received with %d bytes arguments payload.\r\n", moduleName, moduleArgsSize);
m_bios.LoadAndStartModule(moduleName, moduleArgs, moduleArgsSize);
bool loadResult = m_bios.LoadAndStartModule(moduleName, moduleArgs, moduleArgsSize);
//This function returns something negative upon failure
ret[0] = 0x00000000;
if(loadResult)
{
//Block EE till the IOP has completed the operation and sends its reply to the EE
return false;
}
else
{
//Loading module failed, reply can be sent over immediately
return true;
}
}
void CLoadcore::LoadExecutable(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize)

View File

@ -33,7 +33,7 @@ namespace Iop
uint32 RegisterLibraryEntries(uint32);
uint32 QueryBootMode(uint32);
void LoadModule(uint32*, uint32, uint32*, uint32);
bool LoadModule(uint32*, uint32, uint32*, uint32);
void LoadExecutable(uint32*, uint32, uint32*, uint32);
void LoadModuleFromMemory(uint32*, uint32, uint32*, uint32);
void SearchModuleByName(uint32*, uint32, uint32*, uint32);