summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-02-22 15:50:35 +0100
committerLennart Poettering <lennart@poettering.net>2016-02-22 23:23:06 +0100
commitf2d1736c60e6df3760545dedfa04d0d72b4451b1 (patch)
treed67451d3ad4eed203028fa25f4ca3bd816c33b0d
parent6e5f1b5742f3902469123af29502d06a4515f6b9 (diff)
util-lib: support various ppc archs in personality logic
-rw-r--r--src/basic/process-util.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 5c7530ffa0..f45e4ca338 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -710,6 +710,37 @@ unsigned long personality_from_string(const char *p) {
if (architecture == ARCHITECTURE_S390)
return PER_LINUX;
+
+#elif defined(__powerpc64__)
+# if __BYTE_ORDER == __BIG_ENDIAN
+
+ if (architecture == ARCHITECTURE_PPC_LE)
+ return PER_LINUX32;
+
+ if (architecture == ARCHITECTURE_PPC64_LE)
+ return PER_LINUX;
+
+# else
+
+ if (architecture == ARCHITECTURE_PPC)
+ return PER_LINUX32;
+
+ if (architecture == ARCHITECTURE_PPC64)
+ return PER_LINUX;
+
+# endif
+#elif defined(__powerpc__)
+# if __BYTE_ORDER == __BIG_ENDIAN
+
+ if (architecture == ARCHITECTURE_PPC)
+ return PER_LINUX;
+
+# else
+
+ if (architecture == ARCHITECTURE_PPC_LE)
+ return PER_LINUX;
+
+# endif
#endif
return PERSONALITY_INVALID;
@@ -742,6 +773,34 @@ const char* personality_to_string(unsigned long p) {
if (p == PER_LINUX)
architecture = ARCHITECTURE_S390;
+#elif defined(__powerpc64__)
+# if __BYTE_ORDER == __BIG_ENDIAN
+
+ if (p == PER_LINUX)
+ architecture = ARCHITECTURE_PPC64;
+ else if (p == PER_LINUX32)
+ architecture = ARCHITECTURE_PPC;
+
+# else
+
+ if (p == PER_LINUX)
+ architecture = ARCHITECTURE_PPC64_LE;
+ else if (p == PER_LINUX32)
+ architecture = ARCHITECTURE_PPC_LE;
+
+# endif
+#elif defined(__powerpc__)
+# if __BYTE_ORDER == __BIG_ENDIAN
+
+ if (p == PER_LINUX)
+ architecture = ARCHITECTURE_PPC;
+
+# else
+
+ if (p == PER_LINUX)
+ architecture = ARCHITECTURE_PPC_LE;
+
+# endif
#endif
if (architecture < 0)