Implement AllocateVpl.

This commit is contained in:
Jean-Philip Desjardins 2024-11-11 12:17:33 -05:00
parent 11faba0797
commit aad9ef7f5a
4 changed files with 29 additions and 0 deletions

View file

@ -2762,6 +2762,17 @@ uint32 CIopBios::DeleteVpl(uint32 vplId)
return 0;
}
uint32 CIopBios::AllocateVpl(uint32 vplId, uint32 size)
{
uint32 result = pAllocateVpl(vplId, size);
if(result == KERNEL_RESULT_ERROR_NO_MEMORY)
{
CLog::GetInstance().Warn(LOGNAME, "No memory left while calling AllocateVpl, should be waiting. (not implemented)");
assert(false);
}
return result;
}
uint32 CIopBios::pAllocateVpl(uint32 vplId, uint32 size)
{
auto vpl = m_vpls[vplId];

View file

@ -282,6 +282,7 @@ public:
uint32 CreateVpl(uint32);
uint32 DeleteVpl(uint32);
uint32 AllocateVpl(uint32, uint32);
uint32 pAllocateVpl(uint32, uint32);
uint32 FreeVpl(uint32, uint32);
uint32 ReferVplStatus(uint32, uint32);

View file

@ -7,6 +7,7 @@ using namespace Iop;
#define FUNCTION_CREATEVPL "CreateVpl"
#define FUNCTION_DELETEVPL "DeleteVpl"
#define FUNCTION_ALLOCATEVPL "AllocateVpl"
#define FUNCTION_PALLOCATEVPL "pAllocateVpl"
#define FUNCTION_FREEVPL "FreeVpl"
#define FUNCTION_REFERVPLSTATUS "ReferVplStatus"
@ -31,6 +32,9 @@ std::string CThvpool::GetFunctionName(unsigned int functionId) const
case 5:
return FUNCTION_DELETEVPL;
break;
case 6:
return FUNCTION_ALLOCATEVPL;
break;
case 7:
return FUNCTION_PALLOCATEVPL;
break;
@ -58,6 +62,11 @@ void CThvpool::Invoke(CMIPS& context, unsigned int functionId)
context.m_State.nGPR[CMIPS::V0].nD0 = static_cast<int32>(DeleteVpl(
context.m_State.nGPR[CMIPS::A0].nV0));
break;
case 6:
context.m_State.nGPR[CMIPS::V0].nD0 = static_cast<int32>(AllocateVpl(
context.m_State.nGPR[CMIPS::A0].nV0,
context.m_State.nGPR[CMIPS::A1].nV0));
break;
case 7:
context.m_State.nGPR[CMIPS::V0].nD0 = static_cast<int32>(pAllocateVpl(
context.m_State.nGPR[CMIPS::A0].nV0,
@ -93,6 +102,13 @@ uint32 CThvpool::DeleteVpl(uint32 vplId)
return m_bios.DeleteVpl(vplId);
}
uint32 CThvpool::AllocateVpl(uint32 vplId, uint32 size)
{
CLog::GetInstance().Print(LOG_NAME, FUNCTION_ALLOCATEVPL "(vplId = %d, size = 0x%08X);\r\n",
vplId, size);
return m_bios.AllocateVpl(vplId, size);
}
uint32 CThvpool::pAllocateVpl(uint32 vplId, uint32 size)
{
CLog::GetInstance().Print(LOG_NAME, FUNCTION_PALLOCATEVPL "(vplId = %d, size = 0x%08X);\r\n",

View file

@ -18,6 +18,7 @@ namespace Iop
private:
uint32 CreateVpl(uint32);
uint32 DeleteVpl(uint32);
uint32 AllocateVpl(uint32, uint32);
uint32 pAllocateVpl(uint32, uint32);
uint32 FreeVpl(uint32, uint32);
uint32 ReferVplStatus(uint32, uint32);