diff --git a/target-ppc/arch_dump.c b/target-ppc/arch_dump.c
index 9dccf1a..a85c872 100644
--- a/target-ppc/arch_dump.c
+++ b/target-ppc/arch_dump.c
@@ -80,93 +80,95 @@ typedef struct noteStruct {
 } QEMU_PACKED Note;
 
 
-static void ppc64_write_elf64_prstatus(Note *note, PowerPCCPU *cpu)
+static void ppc64_write_elf64_prstatus(Note *note, PowerPCCPU *cpu, int endian)
 {
     int i;
     uint64_t cr;
     struct PPC64ElfPrstatus *prstatus;
     struct PPC64UserRegStruct *reg;
 
-    note->hdr.n_type = cpu_to_be32(NT_PRSTATUS);
+    note->hdr.n_type = cpu_convert_to_target32(NT_PRSTATUS, endian);
 
     prstatus = &note->contents.prstatus;
     memset(prstatus, 0, sizeof(*prstatus));
     reg = &prstatus->pr_reg;
 
     for (i = 0; i < 32; i++) {
-        reg->gpr[i] = cpu_to_be64(cpu->env.gpr[i]);
+        reg->gpr[i] = cpu_convert_to_target64(cpu->env.gpr[i], endian);
     }
-    reg->nip = cpu_to_be64(cpu->env.nip);
-    reg->msr = cpu_to_be64(cpu->env.msr);
-    reg->ctr = cpu_to_be64(cpu->env.ctr);
-    reg->link = cpu_to_be64(cpu->env.lr);
-    reg->xer = cpu_to_be64(cpu_read_xer(&cpu->env));
+    reg->nip = cpu_convert_to_target64(cpu->env.nip, endian);
+    reg->msr = cpu_convert_to_target64(cpu->env.msr, endian);
+    reg->ctr = cpu_convert_to_target64(cpu->env.ctr, endian);
+    reg->link = cpu_convert_to_target64(cpu->env.lr, endian);
+    reg->xer = cpu_convert_to_target64(cpu_read_xer(&cpu->env), endian);
 
     cr = 0;
     for (i = 0; i < 8; i++) {
         cr |= (cpu->env.crf[i] & 15) << (4 * (7 - i));
     }
-    reg->ccr = cpu_to_be64(cr);
+    reg->ccr = cpu_convert_to_target64(cr, endian);
 }
 
-static void ppc64_write_elf64_fpregset(Note *note, PowerPCCPU *cpu)
+static void ppc64_write_elf64_fpregset(Note *note, PowerPCCPU *cpu, int endian)
 {
     int i;
     struct PPC64ElfFpregset  *fpregset;
 
-    note->hdr.n_type = cpu_to_be32(NT_PRFPREG);
+    note->hdr.n_type = cpu_convert_to_target32(NT_PRFPREG, endian);
 
     fpregset = &note->contents.fpregset;
     memset(fpregset, 0, sizeof(*fpregset));
 
     for (i = 0; i < 32; i++) {
-        fpregset->fpr[i] = cpu_to_be64(cpu->env.fpr[i]);
+        fpregset->fpr[i] = cpu_convert_to_target64(cpu->env.fpr[i], endian);
     }
-    fpregset->fpscr = cpu_to_be64(cpu->env.fpscr);
+    fpregset->fpscr = cpu_convert_to_target64(cpu->env.fpscr, endian);
 }
 
-static void ppc64_write_elf64_vmxregset(Note *note, PowerPCCPU *cpu)
+static void ppc64_write_elf64_vmxregset(Note *note, PowerPCCPU *cpu, int endian)
 {
     int i;
     struct PPC64ElfVmxregset *vmxregset;
 
-    note->hdr.n_type = cpu_to_be32(NT_PPC_VMX);
+    note->hdr.n_type = cpu_convert_to_target32(NT_PPC_VMX, endian);
     vmxregset = &note->contents.vmxregset;
     memset(vmxregset, 0, sizeof(*vmxregset));
 
     for (i = 0; i < 32; i++) {
-        vmxregset->avr[i].u64[0] = cpu_to_be64(cpu->env.avr[i].u64[0]);
-        vmxregset->avr[i].u64[1] = cpu_to_be64(cpu->env.avr[i].u64[1]);
+        vmxregset->avr[i].u64[0] =
+            cpu_convert_to_target64(cpu->env.avr[i].u64[0], endian);
+        vmxregset->avr[i].u64[1] =
+            cpu_convert_to_target64(cpu->env.avr[i].u64[1], endian);
     }
-    vmxregset->vscr.u32[3] = cpu_to_be32(cpu->env.vscr);
+    vmxregset->vscr.u32[3] = cpu_convert_to_target32(cpu->env.vscr, endian);
 }
-static void ppc64_write_elf64_vsxregset(Note *note, PowerPCCPU *cpu)
+static void ppc64_write_elf64_vsxregset(Note *note, PowerPCCPU *cpu, int endian)
 {
     int i;
     struct PPC64ElfVsxregset *vsxregset;
 
-    note->hdr.n_type = cpu_to_be32(NT_PPC_VSX);
+    note->hdr.n_type = cpu_convert_to_target32(NT_PPC_VSX, endian);
     vsxregset = &note->contents.vsxregset;
     memset(vsxregset, 0, sizeof(*vsxregset));
 
     for (i = 0; i < 32; i++) {
-        vsxregset->vsr[i] = cpu_to_be64(cpu->env.vsr[i]);
+        vsxregset->vsr[i] = cpu_convert_to_target64(cpu->env.vsr[i], endian);
     }
 }
-static void ppc64_write_elf64_speregset(Note *note, PowerPCCPU *cpu)
+static void ppc64_write_elf64_speregset(Note *note, PowerPCCPU *cpu, int endian)
 {
     struct PPC64ElfSperegset *speregset;
-    note->hdr.n_type = cpu_to_be32(NT_PPC_SPE);
+    note->hdr.n_type = cpu_convert_to_target32(NT_PPC_SPE, endian);
     speregset = &note->contents.speregset;
     memset(speregset, 0, sizeof(*speregset));
 
-    speregset->spe_acc = cpu_to_be64(cpu->env.spe_acc);
-    speregset->spe_fscr = cpu_to_be32(cpu->env.spe_fscr);
+    speregset->spe_acc = cpu_convert_to_target64(cpu->env.spe_acc, endian);
+    speregset->spe_fscr = cpu_convert_to_target32(cpu->env.spe_fscr, endian);
 }
 
 static const struct NoteFuncDescStruct {
     int contents_size;
-    void (*note_contents_func)(Note *note, PowerPCCPU *cpu);
+    void (*note_contents_func)(Note *note, PowerPCCPU *cpu, int endian);
 } note_func[] = {
     {sizeof(((Note *)0)->contents.prstatus),  ppc64_write_elf64_prstatus},
     {sizeof(((Note *)0)->contents.fpregset),  ppc64_write_elf64_fpregset},
@@ -222,13 +224,15 @@ static int ppc64_write_all_elf64_notes(const char *note_name,
     int ret = -1;
     int note_size;
     const NoteFuncDesc *nf;
+    DumpState *s = opaque;
+    int endian = s->dump_info.d_endian;
 
     for (nf = note_func; nf->note_contents_func; nf++) {
-        note.hdr.n_namesz = cpu_to_be32(sizeof(note.name));
-        note.hdr.n_descsz = cpu_to_be32(nf->contents_size);
+        note.hdr.n_namesz = cpu_convert_to_target32(sizeof(note.name), endian);
+        note.hdr.n_descsz = cpu_convert_to_target32(nf->contents_size, endian);
         strncpy(note.name, note_name, sizeof(note.name));
 
-        (*nf->note_contents_func)(&note, cpu);
+        (*nf->note_contents_func)(&note, cpu, endian);
 
         note_size = sizeof(note) - sizeof(note.contents) + nf->contents_size;
         ret = f(&note, note_size, opaque);
