[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v2 4/4] tests/rtas-test.c: fix Apple endian.h include
From: |
Daniel Henrique Barboza |
Subject: |
[Qemu-ppc] [PATCH v2 4/4] tests/rtas-test.c: fix Apple endian.h include |
Date: |
Tue, 31 Oct 2017 18:43:30 -0200 |
Recent rtas-test.c changes added a call to 'be32toh', a function
from the header 'endian.h' in Linux. This caused QEMU Travis build
to break because be32toh is undefined in Mac OS (even using the
machine/endian.h header).
This patch makes a conditional code to include the proper header
file if we're compiling in an __APPLE__ env.
Signed-off-by: Daniel Henrique Barboza <address@hidden>
---
tests/rtas-test.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tests/rtas-test.c b/tests/rtas-test.c
index b3538bf878..511980ad17 100644
--- a/tests/rtas-test.c
+++ b/tests/rtas-test.c
@@ -5,6 +5,17 @@
#include "libqos/libqos-spapr.h"
#include "libqos/rtas.h"
+#if defined(__APPLE__)
+# include <libkern/OSByteOrder.h>
+
+# define be32toh(x) OSSwapBigToHostInt32(x)
+# define __BYTE_ORDER BYTE_ORDER
+# define __BIG_ENDIAN BIG_ENDIAN
+# define __LITTLE_ENDIAN LITTLE_ENDIAN
+#else
+# include <endian.h>
+#endif
+
#define EVENT_MASK_EPOW (1 << 30)
#define EVENT_LOG_LEN 2048
--
2.13.6