chiark / gitweb /
util-lib: support various ppc archs in personality logic
authorLennart Poettering <lennart@poettering.net>
Mon, 22 Feb 2016 14:50:35 +0000 (15:50 +0100)
committerSven Eden <yamakuzure@gmx.net>
Fri, 16 Jun 2017 08:12:57 +0000 (10:12 +0200)
src/basic/process-util.c

index a50674e..69a41d9 100644 (file)
@@ -721,6 +721,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;
@@ -753,6 +784,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)