add build support for ppc64/ppc64le
classilla opened this issue · 4 comments
It works pretty much out of the box with this POWER9 Linux machine in little-endian mode (haven't tested big-endian yet), just needed defines for SYS_CPU
and sysFtrNumProcessorPPC64LE
. Do these values seem good to you? If so, I'll make a pull request.
diff --git a/src/PalmOS/Core/System/SystemMgr.h b/src/PalmOS/Core/System/SystemMgr.h
index 643a098..8c8696a 100644
--- a/src/PalmOS/Core/System/SystemMgr.h
+++ b/src/PalmOS/Core/System/SystemMgr.h
@@ -753,16 +753,18 @@ typedef struct SysExtPrefsType {
#define sysFtrNumProcessorARM920T 0x00120000 // ARM920T
#define sysFtrNumProcessorARM922T 0x00130000 // ARM922T
#define sysFtrNumProcessorARM925 0x00140000 // ARM925
#define sysFtrNumProcessorStrongARM 0x00150000 // StrongARM
#define sysFtrNumProcessorXscale 0x00160000 // Xscale
#define sysFtrNumProcessorARM710A 0x00170000 // ARM710A
#define sysFtrNumProcessorARM925T 0x00180000 // ARM925T
#define sysFtrNumProcessorx86 0x01000000 // Intel CPU (Palm Simulator)
+#define sysFtrNumProcessorPPC64LE 0x02000000 // PowerPC64 in little-endian mode
+#define sysFtrNumProcessorPPC64 0x02100000 // PowerPC64 in big-endian mode (NYI)
// The following sysFtrNumProcessorIs68K(x) and sysFtrNumProcessorIsARM(x)
// macros are intended to be used to test the value returned from a call to
// FtrGet(sysFtrCreator, sysFtrNumProcessorID, &value);
// in order to determine if the code being executed is running on a 68K or ARM processor.
#define sysFtrNumProcessor68KIfZero 0xFFF00000 // 68K if zero; not 68K if non-zero
#define sysFtrNumProcessorIs68K(x) (((x&sysFtrNumProcessor68KIfZero)==0)? true : false)
diff --git a/src/common.mak b/src/common.mak
index 864a121..937e920 100644
--- a/src/common.mak
+++ b/src/common.mak
@@ -31,16 +31,19 @@ else ifeq ($(MACHINE),x86_32)
SYS_ENDIAN=LITTLE_ENDIAN
SYS_CPU=2
else ifeq ($(MACHINE),i686)
SYS_ENDIAN=LITTLE_ENDIAN
SYS_CPU=2
else ifeq ($(MACHINE),i386)
SYS_ENDIAN=LITTLE_ENDIAN
SYS_CPU=2
+else ifeq ($(MACHINE),ppc64le)
+SYS_ENDIAN=LITTLE_ENDIAN
+SYS_CPU=3
else
$(error Unknown CPU $(MACHINE))
endif
HOSTCC=gcc
ifeq ($(OSNAME),)
OSNAME := $(shell uname -o)
diff --git a/src/libpumpkin/FeatureMgr.c b/src/libpumpkin/FeatureMgr.c
index 65d53ca..d279a91 100644
--- a/src/libpumpkin/FeatureMgr.c
+++ b/src/libpumpkin/FeatureMgr.c
@@ -70,16 +70,19 @@ Err FtrGet(UInt32 creator, UInt16 featureNum, UInt32 *valueP) {
break;
case sysFtrNumProcessorID:
#if SYS_CPU == 1
*valueP = sysFtrNumProcessorARM720T;
err = errNone;
#elif SYS_CPU == 2
*valueP = sysFtrNumProcessorx86;
err = errNone;
+#elif SYS_CPU == 3
+ *valueP = sysFtrNumProcessorPPC64LE;
+ err = errNone;
#endif
break;
case sysFtrNumLanguage:
*valueP = lEnglish;
err = errNone;
break;
case sysFtrNumNotifyMgrVersion:
*valueP = sysNotifyVersionNum;
Unrelated to this, probably: Bejeweled! runs great, but I tried running Plua2RT and OverbitePalm and it actually crashes the emulator (Plua2RT says trap EncDigestMD5 not implemented
; OverbitePalm says Fatal alert storage.c, getdb, Line:866: invalid db
and/or segfaults the emulator). But it's still a lot of fun to play in.
The changes you propose seem good. Nice to know it works on a completely different CPU! You may proceed with your pull request.
Plua2 does not run on PumpkinOS yet (but PumpkinOS has built-in Lua support, so it kind of compensate for that). I don't know OverbitePalm, I will take a look when time permits.
Overbite Palm is my Plua2 gopher client, https://github.com/classilla/overbitepalm
It might have something to do with the runtime not working, so it's not a huge deal right now, but it would be fun to test the networking with it.
Closing, since this seems to work fine.