[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v2 4/4] ppc64 dump: Set the correct endianness in ELF
From: |
Greg Kurz |
Subject: |
[Qemu-ppc] [PATCH v2 4/4] ppc64 dump: Set the correct endianness in ELF dump header |
Date: |
Wed, 30 Apr 2014 16:16:20 +0200 |
User-agent: |
StGit/0.16 |
From: Bharata B Rao <address@hidden>
Signed-off-by: Bharata B Rao <address@hidden>
[ use PowerPCCPUClass::interrupts_big_endian(),
Greg Kurz <address@hidden> ]
Signed-off-by: Greg Kurz <address@hidden>
---
Changes in v2:
- use PowerPCCPUClass::interrupts_big_endian()
target-ppc/arch_dump.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/target-ppc/arch_dump.c b/target-ppc/arch_dump.c
index f24290f..815ee97 100644
--- a/target-ppc/arch_dump.c
+++ b/target-ppc/arch_dump.c
@@ -198,12 +198,16 @@ typedef struct NoteFuncDescStruct NoteFuncDesc;
int cpu_get_dump_info(ArchDumpInfo *info,
const struct GuestPhysBlockList *guest_phys_blocks)
{
- /*
- * Currently only handling PPC64 big endian.
- */
+ PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
+ PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
+
info->d_machine = EM_PPC64;
- info->d_endian = ELFDATA2MSB;
info->d_class = ELFCLASS64;
+ if ((*pcc->interrupts_big_endian)(cpu)) {
+ info->d_endian = ELFDATA2MSB;
+ } else {
+ info->d_endian = ELFDATA2LSB;
+ }
return 0;
}