diff --git a/src/Makefile b/src/Makefile index fb5fdcb7..9382b6c5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -450,7 +450,16 @@ ifeq (ppc,$(TARGET_LJARCH)) DASM_AFLAGS+= -D GPR64 endif ifeq (PS3,$(TARGET_SYS)) - DASM_AFLAGS+= -D PPE -D TOC + DASM_AFLAGS+= -D PPE + endif + ifneq (,$(findstring LJ_ARCH_PPC_TOC 1,$(TARGET_TESTARCH))) + DASM_AFLAGS+= -D TOC + endif + ifneq (,$(findstring LJ_ARCH_PPC_TOCENV 1,$(TARGET_TESTARCH))) + DASM_AFLAGS+= -D TOCENV + endif + ifneq (,$(findstring LJ_ARCH_PPC_ELFV2 1,$(TARGET_TESTARCH))) + DASM_AFLAGS+= -D ELFV2 endif ifneq (,$(findstring LJ_ARCH_PPC64 ,$(TARGET_TESTARCH))) DASM_ARCH= ppc64 diff --git a/src/lj_arch.h b/src/lj_arch.h index cc5a0a66..23817877 100644 --- a/src/lj_arch.h +++ b/src/lj_arch.h @@ -263,10 +263,19 @@ #if LJ_TARGET_CONSOLE #define LJ_ARCH_PPC32ON64 1 #define LJ_ARCH_NOFFI 1 +#if LJ_TARGET_PS3 +#define LJ_ARCH_PPC_TOC 1 +#endif #elif LJ_ARCH_BITS == 64 -#define LJ_ARCH_PPC64 1 -#define LJ_TARGET_GC64 1 +#define LJ_ARCH_PPC32ON64 1 #define LJ_ARCH_NOJIT 1 /* NYI */ +#define LJ_ARCH_NOFFI 1 /* NYI */ +#if _CALL_ELF == 2 +#define LJ_ARCH_PPC_ELFV2 1 +#else +#define LJ_ARCH_PPC_TOC 1 +#define LJ_ARCH_PPC_TOCENV 1 +#endif #endif #if _ARCH_PWR7 @@ -418,11 +427,11 @@ #if defined(_SOFT_FLOAT) || defined(_SOFT_DOUBLE) #error "No support for PowerPC CPUs without double-precision FPU" #endif -#if !LJ_ARCH_PPC64 && LJ_ARCH_ENDIAN == LUAJIT_LE -#error "No support for little-endian PPC32" +#if LJ_ARCH_ENDIAN == LUAJIT_LE +#error "No support for little-endian PPC" #endif -#if LJ_ARCH_PPC64 -#error "No support for PowerPC 64 bit mode (yet)" +#if LJ_ARCH_PPC_ELFV2 +#error "No support for PPC ELFv2" #endif #ifdef __NO_FPRS__ #error "No support for PPC/e500 anymore (use LuaJIT 2.0)" diff --git a/src/vm_ppc.dasc b/src/vm_ppc.dasc index da31c25f..18ac6530 100644 --- a/src/vm_ppc.dasc +++ b/src/vm_ppc.dasc @@ -25,12 +25,11 @@ |// TOC Need table of contents (64 bit or 32 bit variant, e.g. PS3). |// Function pointers are really a struct: code, TOC, env (optional). |// TOCENV Function pointers have an environment pointer, too (not on PS3). +|// ELFV2 The 64-bit ELF V2 ABI is in use. |// PPE Power Processor Element of Cell (PS3) or Xenon (Xbox 360). |// Must avoid (slow) micro-coded instructions. | |.if P64 -|.define TOC, 1 -|.define TOCENV, 1 |.macro lpx, a, b, c; ldx a, b, c; .endmacro |.macro lp, a, b; ld a, b; .endmacro |.macro stp, a, b; std a, b; .endmacro @@ -49,7 +48,7 @@ |// Convenience macros for TOC handling. |.if TOC |// Linker needs a TOC patch area for every external call relocation. -|.macro blex, target; bl extern target@plt; nop; .endmacro +|.macro blex, target; bl extern target; nop; .endmacro |.macro .toc, a, b; a, b; .endmacro |.if P64 |.define TOC_OFS, 8