CONSOLE: Handle P64, GPR64, TOC* and PPE (PS3) in PPC interpreter.

PS3 build command: make HOST_CC="gcc -m32" CROSS=ppu-lv2-
This commit is contained in:
Mike Pall 2012-06-13 02:32:24 +02:00
parent 4f9db0fbc3
commit ca6bf2d9a4
5 changed files with 456 additions and 184 deletions

View File

@ -404,8 +404,11 @@ ifeq (ppc,$(TARGET_LJARCH))
ifneq (,$(findstring LJ_ARCH_ROUND 1,$(TARGET_TESTARCH))) ifneq (,$(findstring LJ_ARCH_ROUND 1,$(TARGET_TESTARCH)))
DASM_AFLAGS+= -D ROUND DASM_AFLAGS+= -D ROUND
endif endif
ifneq (,$(findstring LJ_ARCH_PPC64 1,$(TARGET_TESTARCH)))
DASM_AFLAGS+= -D GPR64
endif
ifeq (PS3,$(TARGET_SYS)) ifeq (PS3,$(TARGET_SYS))
DASM_AFLAGS+= -D PS3 DASM_AFLAGS+= -D PPE -D TOC
endif endif
endif endif
endif endif

View File

@ -108,11 +108,16 @@ static void emit_asm_wordreloc(BuildCtx *ctx, uint8_t *p, int n,
exit(1); exit(1);
} }
#elif LJ_TARGET_PPC || LJ_TARGET_PPCSPE #elif LJ_TARGET_PPC || LJ_TARGET_PPCSPE
#if LJ_TARGET_PS3
#define TOCPREFIX "."
#else
#define TOCPREFIX ""
#endif
if ((ins >> 26) == 16) { if ((ins >> 26) == 16) {
fprintf(ctx->fp, "\t%s %d, %d, %s\n", fprintf(ctx->fp, "\t%s %d, %d, " TOCPREFIX "%s\n",
(ins & 1) ? "bcl" : "bc", (ins >> 21) & 31, (ins >> 16) & 31, sym); (ins & 1) ? "bcl" : "bc", (ins >> 21) & 31, (ins >> 16) & 31, sym);
} else if ((ins >> 26) == 18) { } else if ((ins >> 26) == 18) {
fprintf(ctx->fp, "\t%s %s\n", (ins & 1) ? "bl" : "b", sym); fprintf(ctx->fp, "\t%s " TOCPREFIX "%s\n", (ins & 1) ? "bl" : "b", sym);
} else { } else {
fprintf(stderr, fprintf(stderr,
"Error: unsupported opcode %08x for %s symbol relocation.\n", "Error: unsupported opcode %08x for %s symbol relocation.\n",

View File

@ -174,7 +174,11 @@
#elif LUAJIT_TARGET == LUAJIT_ARCH_PPC #elif LUAJIT_TARGET == LUAJIT_ARCH_PPC
#define LJ_ARCH_NAME "ppc" #define LJ_ARCH_NAME "ppc"
#if _LP64
#define LJ_ARCH_BITS 64
#else
#define LJ_ARCH_BITS 32 #define LJ_ARCH_BITS 32
#endif
#define LJ_ARCH_ENDIAN LUAJIT_BE #define LJ_ARCH_ENDIAN LUAJIT_BE
#define LJ_ARCH_HASFPU 1 #define LJ_ARCH_HASFPU 1
#define LJ_TARGET_PPC 1 #define LJ_TARGET_PPC 1
@ -200,6 +204,7 @@
#endif #endif
#if __PPC64__ || __powerpc64__ || LJ_TARGET_XBOX360 #if __PPC64__ || __powerpc64__ || LJ_TARGET_XBOX360
#define LJ_ARCH_PPC64 1 #define LJ_ARCH_PPC64 1
#define LJ_ARCH_NOFFI 1
#endif #endif
#if _ARCH_PPCSQ #if _ARCH_PPCSQ
#define LJ_ARCH_SQRT 1 #define LJ_ARCH_SQRT 1

View File

@ -100,6 +100,16 @@ enum {
#define CFRAME_SIZE 64 #define CFRAME_SIZE 64
#define CFRAME_SHIFT_MULTRES 3 #define CFRAME_SHIFT_MULTRES 3
#elif LJ_TARGET_PPC #elif LJ_TARGET_PPC
#if LJ_ARCH_PPC64
#define CFRAME_OFS_ERRF 472
#define CFRAME_OFS_NRES 468
#define CFRAME_OFS_PREV 448
#define CFRAME_OFS_L 464
#define CFRAME_OFS_PC 460
#define CFRAME_OFS_MULTRES 456
#define CFRAME_SIZE 400
#define CFRAME_SHIFT_MULTRES 3
#else
#define CFRAME_OFS_ERRF 48 #define CFRAME_OFS_ERRF 48
#define CFRAME_OFS_NRES 44 #define CFRAME_OFS_NRES 44
#define CFRAME_OFS_PREV 40 #define CFRAME_OFS_PREV 40
@ -108,6 +118,7 @@ enum {
#define CFRAME_OFS_MULTRES 28 #define CFRAME_OFS_MULTRES 28
#define CFRAME_SIZE 272 #define CFRAME_SIZE 272
#define CFRAME_SHIFT_MULTRES 3 #define CFRAME_SHIFT_MULTRES 3
#endif
#elif LJ_TARGET_PPCSPE #elif LJ_TARGET_PPCSPE
#define CFRAME_OFS_ERRF 28 #define CFRAME_OFS_ERRF 28
#define CFRAME_OFS_NRES 24 #define CFRAME_OFS_NRES 24

File diff suppressed because it is too large Load Diff