mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-06 06:51:18 +12:00
PPCRec: Support for arbitrary function calls in the IR
Used for MFTBU/MFTBL instruction
This commit is contained in:
parent
4517c209d5
commit
b55785a0a0
6 changed files with 140 additions and 13 deletions
|
@ -6,6 +6,7 @@
|
|||
#include "IML/IML.h"
|
||||
#include "IML/IMLRegisterAllocatorRanges.h"
|
||||
#include "PPCFunctionBoundaryTracker.h"
|
||||
#include "Cafe/OS/libs/coreinit/coreinit_Time.h"
|
||||
|
||||
bool PPCRecompiler_decodePPCInstruction(ppcImlGenContext_t* ppcImlGenContext);
|
||||
|
||||
|
@ -398,15 +399,30 @@ bool PPCRecompilerImlGen_MFSPR(ppcImlGenContext_t* ppcImlGenContext, uint32 opco
|
|||
return true;
|
||||
}
|
||||
|
||||
ATTR_MS_ABI uint32 PPCRecompiler_GetTBL()
|
||||
{
|
||||
return (uint32)coreinit::coreinit_getTimerTick();
|
||||
}
|
||||
|
||||
ATTR_MS_ABI uint32 PPCRecompiler_GetTBU()
|
||||
{
|
||||
return (uint32)(coreinit::coreinit_getTimerTick() >> 32);
|
||||
}
|
||||
|
||||
bool PPCRecompilerImlGen_MFTB(ppcImlGenContext_t* ppcImlGenContext, uint32 opcode)
|
||||
{
|
||||
printf("PPCRecompilerImlGen_MFTB(): Not supported\n");
|
||||
return false;
|
||||
|
||||
uint32 rD, spr1, spr2, spr;
|
||||
PPC_OPC_TEMPL_XO(opcode, rD, spr1, spr2);
|
||||
spr = spr1 | (spr2<<5);
|
||||
|
||||
if( spr == SPR_TBL || spr == SPR_TBU )
|
||||
{
|
||||
IMLReg resultReg = _GetRegGPR(ppcImlGenContext, rD);
|
||||
ppcImlGenContext->emitInst().make_call_imm(spr == SPR_TBL ? (uintptr_t)PPCRecompiler_GetTBL : (uintptr_t)PPCRecompiler_GetTBU, IMLREG_INVALID, IMLREG_INVALID, IMLREG_INVALID, resultReg);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
if (spr == 268 || spr == 269)
|
||||
{
|
||||
// TBL / TBU
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue