mirror of
https://github.com/hedge-dev/XenonRecomp.git
synced 2025-06-06 01:02:08 +00:00
Convert calls to indirect calls for the time being.
This commit is contained in:
parent
27f6604072
commit
9db7909bbd
@ -174,21 +174,9 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_BL:
|
case PPC_INST_BL:
|
||||||
{
|
|
||||||
std::string targetName = "";
|
|
||||||
auto targetSymbol = image.symbols.find(insn.operands[0]);
|
|
||||||
if (targetSymbol != image.symbols.end() && targetSymbol->type == Symbol_Function)
|
|
||||||
{
|
|
||||||
targetName = targetSymbol->name;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
targetName = std::format("sub_{:X}", insn.operands[0]);
|
|
||||||
}
|
|
||||||
std::println(f, "\tctx.lr = 0x{:X};", base);
|
std::println(f, "\tctx.lr = 0x{:X};", base);
|
||||||
std::println(f, "\t{}(ctx, base);", targetName);
|
std::println(f, "\tctx.fn[0x{:X}](ctx, base);", base / 4);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case PPC_INST_BLE:
|
case PPC_INST_BLE:
|
||||||
std::println(f, "\tif (!ctx.cr{}.gt) goto loc_{:X};", insn.operands[0], insn.operands[1]);
|
std::println(f, "\tif (!ctx.cr{}.gt) goto loc_{:X};", insn.operands[0], insn.operands[1]);
|
||||||
@ -279,7 +267,7 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_CNTLZW:
|
case PPC_INST_CNTLZW:
|
||||||
std::println(f, "\tctx.r{}.u64 = __lzcnt32(ctx.r{}.u32);", insn.operands[0], insn.operands[1]);
|
std::println(f, "\tctx.r{}.u64 = __lzcnt(ctx.r{}.u32);", insn.operands[0], insn.operands[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_DB16CYC:
|
case PPC_INST_DB16CYC:
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#define _byteswap_ushort __builtin_bswap16
|
#define _byteswap_ushort __builtin_bswap16
|
||||||
#define _byteswap_ulong __builtin_bswap32
|
#define _byteswap_ulong __builtin_bswap32
|
||||||
#define _byteswap_uint64 __builtin_bswap64
|
#define _byteswap_uint64 __builtin_bswap64
|
||||||
|
#define isnan __builtin_isnan
|
||||||
#define PPC_FUNC __attribute__((weak,noinline))
|
#define PPC_FUNC __attribute__((weak,noinline))
|
||||||
#else
|
#else
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
@ -25,6 +26,8 @@
|
|||||||
#define PPC_STORE_U32(x, y) *(uint32_t*)(base + (x)) = _byteswap_ulong(y)
|
#define PPC_STORE_U32(x, y) *(uint32_t*)(base + (x)) = _byteswap_ulong(y)
|
||||||
#define PPC_STORE_U64(x, y) *(uint64_t*)(base + (x)) = _byteswap_uint64(y)
|
#define PPC_STORE_U64(x, y) *(uint64_t*)(base + (x)) = _byteswap_uint64(y)
|
||||||
|
|
||||||
|
typedef void PPCFunc(struct PPCContext& __restrict ctx, uint8_t* base);
|
||||||
|
|
||||||
struct PPCRegister
|
struct PPCRegister
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
@ -82,6 +85,7 @@ typedef float float128[4];
|
|||||||
|
|
||||||
struct PPCContext
|
struct PPCContext
|
||||||
{
|
{
|
||||||
|
PPCFunc** fn;
|
||||||
uint64_t lr;
|
uint64_t lr;
|
||||||
uint64_t ctr;
|
uint64_t ctr;
|
||||||
PPCXERRegister xer;
|
PPCXERRegister xer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user