[Skiboot] [PATCH v3 3/7] libpore: Add GLIBC style endianness detection

Akshay Adiga akshay.adiga at linux.vnet.ibm.com
Wed Aug 23 18:47:58 AEST 2017


p9_stop_api expects glibc style endianness check. Adding glibc style
endianness in endian.h under libpore.

Signed-off-by: Akshay Adiga <akshay.adiga at linux.vnet.ibm.com>
---
 libpore/endian.h       | 29 +++++++++++++++++++++++++++++
 libpore/p9_stop_util.H |  4 +---
 2 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100644 libpore/endian.h

diff --git a/libpore/endian.h b/libpore/endian.h
new file mode 100644
index 0000000..22a12cf
--- /dev/null
+++ b/libpore/endian.h
@@ -0,0 +1,29 @@
+/* Copyright 2017 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *	http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Adding GLIBC style endianness check required for p9_stop_api
+ */
+
+#include <ccan/endian/endian.h>
+
+#ifndef __BYTE_ORDER
+#define	__LITTLE_ENDIAN	1234
+#define	__BIG_ENDIAN	4321
+
+/* Support Glibc style endianness check */
+#define __BYTE_ORDER __BIG_ENDIAN
+#endif /* __BYTE_ORDER */
diff --git a/libpore/p9_stop_util.H b/libpore/p9_stop_util.H
index 3266fde..a649648 100644
--- a/libpore/p9_stop_util.H
+++ b/libpore/p9_stop_util.H
@@ -27,10 +27,8 @@
 
 #ifdef _AIX
     #define __BYTE_ORDER __BIG_ENDIAN
-#elif __SKIBOOT__
-    #include <skiboot.h>
 #else
-    #include <endian.h>
+    #include "endian.h"
 #endif
 
 #ifndef __PPE_PLAT
-- 
2.5.5



More information about the Skiboot mailing list