Skip to content

Commit de28409

Browse files
Load function pointers from the base pointer.
1 parent 4650dc6 commit de28409

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

PowerUtils/ppc_context.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,12 @@
105105
#define PPC_CALL_FUNC(x) x(ctx, base)
106106
#endif
107107

108+
#define PPC_MEMORY_SIZE 0x100000000ull
109+
#define PPC_FUNC_TABLE_OFFSET PPC_MEMORY_SIZE
110+
#define PPC_FUNC_TABLE_SIZE 0x200000000ull
111+
108112
#ifndef PPC_CALL_INDIRECT_FUNC
109-
#define PPC_CALL_INDIRECT_FUNC(x) (*(PPCFunc**)(ctx.fn + uint64_t(x) * 2))(ctx, base)
113+
#define PPC_CALL_INDIRECT_FUNC(x) (*(PPCFunc**)(base + PPC_FUNC_TABLE_OFFSET + (uint64_t(x) * 2)))(ctx, base)
110114
#endif
111115

112116
typedef void PPCFunc(struct PPCContext& __restrict__ ctx, uint8_t* base);
@@ -309,7 +313,6 @@ struct PPCContext
309313
PPCRegister r31;
310314
#endif
311315

312-
uint8_t* fn;
313316
#ifndef PPC_CONFIG_SKIP_LR
314317
uint64_t lr;
315318
#endif

0 commit comments

Comments
 (0)