ReXGlue SDK
Loading...
Searching...
No Matches
codegen_macros.h File Reference

Macros that the generated precompiled header defines, listed for the reference. More...

Go to the source code of this file.

Macros

#define DECLARE_REX_FUNC(name)
#define DEFINE_REX_FUNC(name)
#define REX_FUNC_PROLOGUE()
#define REX_PHYS_HOST_OFFSET(addr)
#define REX_RAW_ADDR(x)
#define REX_LOAD_U8(x)
#define REX_LOAD_U16(x)
#define REX_LOAD_U32(x)
#define REX_LOAD_U64(x)
#define REX_LOAD_STRING(x, len)
#define REX_STORE_U8(x, y)
#define REX_STORE_U16(x, y)
#define REX_STORE_U32(x, y)
#define REX_STORE_U64(x, y)
#define REX_STACK_ADDR(x)
#define REX_STACK_LOAD_U8(x)
#define REX_STACK_LOAD_U16(x)
#define REX_STACK_LOAD_U32(x)
#define REX_STACK_LOAD_U64(x)
#define REX_STACK_STORE_U8(x, y)
#define REX_STACK_STORE_U16(x, y)
#define REX_STACK_STORE_U32(x, y)
#define REX_STACK_STORE_U64(x, y)
#define REX_GPU_LOAD32(addr)
#define REX_GPU_STORE32(addr, val)
#define REX_APU_LOAD32(addr)
#define REX_APU_STORE32(addr, val)
#define REX_MM_LOAD_U8(addr)
#define REX_MM_LOAD_U16(addr)
#define REX_MM_LOAD_U32(addr)
#define REX_MM_LOAD_U64(addr)
#define REX_MM_STORE_U8(addr, val)
#define REX_MM_STORE_U16(addr, val)
#define REX_MM_STORE_U32(addr, val)
#define REX_MM_STORE_U64(addr, val)
#define REX_CALL_FUNC(x)
#define REX_LOOKUP_FUNC(x, y)
#define REX_CALL_INDIRECT_FUNC(x)
#define REX_SET_FLUSH_MODE(enable)
#define REX_UNIMPLEMENTED(addr, opcode)
#define REX_QUERY_TIMEBASE()
#define ppc_setjmp(guest_buf_addr)
#define ppc_longjmp(guest_buf_addr, val)
#define ppc_trap(ctx, base, trap_type)

Detailed Description

Macros that the generated precompiled header defines, listed for the reference.

License
BSD 3-Clause License See LICENSE file in the project root for full license text.

Documentation only. rexglue codegen writes the real definitions into <p>_pch.h from the template codegen/pch_h.inja, and nothing includes this file.

Macro Definition Documentation

◆ DECLARE_REX_FUNC

#define DECLARE_REX_FUNC ( name)

Declares a recompiled function and its original entry point __imp__name.

Parameters
nameThe function name.

◆ DEFINE_REX_FUNC

#define DEFINE_REX_FUNC ( name)

Starts the body of a recompiled function. Defines __imp__name and makes name a weak alias of it, so a hook that defines a strong name replaces the function and the original stays reachable. The body is placed in the rexguest section.

Parameters
nameThe function name.

◆ ppc_longjmp

#define ppc_longjmp ( guest_buf_addr,
val )

Jumps back to a buffer that ppc_setjmp saved.

Parameters
guest_buf_addrThe guest address of the buffer.
valThe value ppc_setjmp returns.

◆ ppc_setjmp

#define ppc_setjmp ( guest_buf_addr)

Saves a guest jump buffer and returns 0, or the value that ppc_longjmp passes.

Parameters
guest_buf_addrThe guest address of the buffer.

◆ ppc_trap

#define ppc_trap ( ctx,
base,
trap_type )

Raises a guest trap.

Parameters
ctxThe guest context.
baseThe guest memory base.
trap_typeThe trap type.

◆ REX_APU_LOAD32

#define REX_APU_LOAD32 ( addr)

Reads a 32 bit APU register through the APU MMIO recipient.

Parameters
addrThe guest address.

◆ REX_APU_STORE32

#define REX_APU_STORE32 ( addr,
val )

Writes a 32 bit APU register through the APU MMIO recipient.

Parameters
addrThe guest address.
valThe value.

◆ REX_CALL_FUNC

#define REX_CALL_FUNC ( x)

Calls a recompiled function with the current ctx and base.

Parameters
xThe function name.

◆ REX_CALL_INDIRECT_FUNC

#define REX_CALL_INDIRECT_FUNC ( x)

Calls the function at a guest address. Reads the pointer from the table placed after the image and calls rex::ppc::ResolveFunction when the slot is empty or the target is out of range.

Parameters
xThe guest address.

◆ REX_FUNC_PROLOGUE

#define REX_FUNC_PROLOGUE ( )

Declares that base is 32 byte aligned. Every recompiled function starts with it.

◆ REX_GPU_LOAD32

#define REX_GPU_LOAD32 ( addr)

Reads a 32 bit GPU register through the GPU MMIO recipient.

Parameters
addrThe guest address.

◆ REX_GPU_STORE32

#define REX_GPU_STORE32 ( addr,
val )

Writes a 32 bit GPU register through the GPU MMIO recipient.

Parameters
addrThe guest address.
valThe value.

◆ REX_LOAD_STRING

#define REX_LOAD_STRING ( x,
len )

A std::string_view over guest memory.

Parameters
xThe guest address.
lenThe length in bytes.

◆ REX_LOAD_U16

#define REX_LOAD_U16 ( x)

A volatile 16 bit load at base + x, byte swapped.

Parameters
xThe guest address.

◆ REX_LOAD_U32

#define REX_LOAD_U32 ( x)

A volatile 32 bit load at base + x, byte swapped.

Parameters
xThe guest address.

◆ REX_LOAD_U64

#define REX_LOAD_U64 ( x)

A volatile 64 bit load at base + x, byte swapped.

Parameters
xThe guest address.

◆ REX_LOAD_U8

#define REX_LOAD_U8 ( x)

A volatile byte load at base + x.

Parameters
xThe guest address.

◆ REX_LOOKUP_FUNC

#define REX_LOOKUP_FUNC ( x,
y )

Looks up the host function pointer of a guest address in the table placed after the image.

Parameters
xThe base pointer.
yThe guest address.

◆ REX_MM_LOAD_U16

#define REX_MM_LOAD_U16 ( addr)

A 16 bit load that tests for an MMIO block first and uses the plain access otherwise.

Parameters
addrThe guest address.

◆ REX_MM_LOAD_U32

#define REX_MM_LOAD_U32 ( addr)

A 32 bit load that tests for an MMIO block first and uses the plain access otherwise.

Parameters
addrThe guest address.

◆ REX_MM_LOAD_U64

#define REX_MM_LOAD_U64 ( addr)

A 64 bit load that tests for an MMIO block first and uses the plain access otherwise.

Parameters
addrThe guest address.

◆ REX_MM_LOAD_U8

#define REX_MM_LOAD_U8 ( addr)

A byte load that tests for an MMIO block first and uses the plain access otherwise.

Parameters
addrThe guest address.

◆ REX_MM_STORE_U16

#define REX_MM_STORE_U16 ( addr,
val )

A 16 bit store that tests for an MMIO block first and uses the plain access otherwise.

Parameters
addrThe guest address.
valThe value.

◆ REX_MM_STORE_U32

#define REX_MM_STORE_U32 ( addr,
val )

A 32 bit store that tests for an MMIO block first and uses the plain access otherwise.

Parameters
addrThe guest address.
valThe value.

◆ REX_MM_STORE_U64

#define REX_MM_STORE_U64 ( addr,
val )

A 64 bit store that tests for an MMIO block first and uses the plain access otherwise.

Parameters
addrThe guest address.
valThe value.

◆ REX_MM_STORE_U8

#define REX_MM_STORE_U8 ( addr,
val )

A byte store that tests for an MMIO block first and uses the plain access otherwise.

Parameters
addrThe guest address.
valThe value.

◆ REX_PHYS_HOST_OFFSET

#define REX_PHYS_HOST_OFFSET ( addr)

The extra host offset of a guest address in the physical range from 0xE0000000, which is 0x1000 on Windows and macOS on arm64, where the host mapping rounds the offset away, and 0 elsewhere.

Parameters
addrThe guest address.

◆ REX_QUERY_TIMEBASE

#define REX_QUERY_TIMEBASE ( )

The guest timebase tick count.

◆ REX_RAW_ADDR

#define REX_RAW_ADDR ( x)

The host address of a guest address, with no MMIO test.

Parameters
xThe guest address.

◆ REX_SET_FLUSH_MODE

#define REX_SET_FLUSH_MODE ( enable)

Enables or disables flush to zero mode in ctx.fpscr.

Parameters
enableTrue to enable it.

◆ REX_STACK_ADDR

#define REX_STACK_ADDR ( x)

The host address of a stack access, checked to be below 0xE0000000 in debug builds.

Parameters
xThe guest address.

◆ REX_STACK_LOAD_U16

#define REX_STACK_LOAD_U16 ( x)

A 16 bit load from the guest stack, byte swapped.

Parameters
xThe guest address.

◆ REX_STACK_LOAD_U32

#define REX_STACK_LOAD_U32 ( x)

A 32 bit load from the guest stack, byte swapped.

Parameters
xThe guest address.

◆ REX_STACK_LOAD_U64

#define REX_STACK_LOAD_U64 ( x)

A 64 bit load from the guest stack, byte swapped.

Parameters
xThe guest address.

◆ REX_STACK_LOAD_U8

#define REX_STACK_LOAD_U8 ( x)

A byte load from the guest stack.

Parameters
xThe guest address.

◆ REX_STACK_STORE_U16

#define REX_STACK_STORE_U16 ( x,
y )

A 16 bit store to the guest stack, byte swapped.

Parameters
xThe guest address.
yThe value.

◆ REX_STACK_STORE_U32

#define REX_STACK_STORE_U32 ( x,
y )

A 32 bit store to the guest stack, byte swapped.

Parameters
xThe guest address.
yThe value.

◆ REX_STACK_STORE_U64

#define REX_STACK_STORE_U64 ( x,
y )

A 64 bit store to the guest stack, byte swapped.

Parameters
xThe guest address.
yThe value.

◆ REX_STACK_STORE_U8

#define REX_STACK_STORE_U8 ( x,
y )

A byte store to the guest stack.

Parameters
xThe guest address.
yThe value.

◆ REX_STORE_U16

#define REX_STORE_U16 ( x,
y )

A volatile 16 bit store at base + x, byte swapped.

Parameters
xThe guest address.
yThe value.

◆ REX_STORE_U32

#define REX_STORE_U32 ( x,
y )

A volatile 32 bit store at base + x, byte swapped.

Parameters
xThe guest address.
yThe value.

◆ REX_STORE_U64

#define REX_STORE_U64 ( x,
y )

A volatile 64 bit store at base + x, byte swapped.

Parameters
xThe guest address.
yThe value.

◆ REX_STORE_U8

#define REX_STORE_U8 ( x,
y )

A volatile byte store at base + x.

Parameters
xThe guest address.
yThe value.

◆ REX_UNIMPLEMENTED

#define REX_UNIMPLEMENTED ( addr,
opcode )

Reports an instruction that has no recompiled form.

Parameters
addrThe guest address.
opcodeThe instruction word.