Check the binary is built for 64-bit PPC at runtime,
removing the need for TARGET_PPC64 #ifdef'ry.

Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
 hw/ppc/fdt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/ppc/fdt.c b/hw/ppc/fdt.c
index 0828ad72548..bae269c72ac 100644
--- a/hw/ppc/fdt.c
+++ b/hw/ppc/fdt.c
@@ -8,12 +8,12 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/legacy_binary_info.h"
 #include "target/ppc/cpu.h"
 #include "target/ppc/mmu-hash64.h"
 
 #include "hw/ppc/fdt.h"
 
-#if defined(TARGET_PPC64)
 size_t ppc_create_page_sizes_prop(PowerPCCPU *cpu, uint32_t *prop,
                                   size_t maxsize)
 {
@@ -21,6 +21,8 @@ size_t ppc_create_page_sizes_prop(PowerPCCPU *cpu, uint32_t 
*prop,
     int i, j, count;
     uint32_t *p = prop;
 
+    assert(legacy_binary_is_64bit());
+
     for (i = 0; i < PPC_PAGE_SIZES_MAX_SZ; i++) {
         PPCHash64SegmentPageSizes *sps = &cpu->hash64_opts->sps[i];
 
@@ -46,4 +48,3 @@ size_t ppc_create_page_sizes_prop(PowerPCCPU *cpu, uint32_t 
*prop,
 
     return (p - prop) * sizeof(uint32_t);
 }
-#endif
-- 
2.47.1


Reply via email to