From de2840970ffc3161a4cb8743b10ddd4da93bdc9f Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Thu, 2 Jan 2025 14:32:34 +0300 Subject: [PATCH] Load function pointers from the base pointer. --- PowerUtils/ppc_context.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PowerUtils/ppc_context.h b/PowerUtils/ppc_context.h index 0930e88..2c6dd5c 100644 --- a/PowerUtils/ppc_context.h +++ b/PowerUtils/ppc_context.h @@ -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