Load function pointers from the base pointer.

This commit is contained in:
Skyth 2025-01-02 14:32:34 +03:00
parent 4650dc69fb
commit de2840970f

View File

@ -105,8 +105,12 @@
#define PPC_CALL_FUNC(x) x(ctx, base)
#endif
#define PPC_MEMORY_SIZE 0x100000000ull
#define PPC_FUNC_TABLE_OFFSET PPC_MEMORY_SIZE
#define PPC_FUNC_TABLE_SIZE 0x200000000ull
#ifndef PPC_CALL_INDIRECT_FUNC
#define PPC_CALL_INDIRECT_FUNC(x) (*(PPCFunc**)(ctx.fn + uint64_t(x) * 2))(ctx, base)
#define PPC_CALL_INDIRECT_FUNC(x) (*(PPCFunc**)(base + PPC_FUNC_TABLE_OFFSET + (uint64_t(x) * 2)))(ctx, base)
#endif
typedef void PPCFunc(struct PPCContext& __restrict__ ctx, uint8_t* base);
@ -309,7 +313,6 @@ struct PPCContext
PPCRegister r31;
#endif
uint8_t* fn;
#ifndef PPC_CONFIG_SKIP_LR
uint64_t lr;
#endif