[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 006/118] target-ppc: gdbstub allow byte swapping for re
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PULL 006/118] target-ppc: gdbstub allow byte swapping for reading/writing registers |
Date: |
Wed, 4 Jun 2014 14:43:07 +0200 |
From: Thomas Falcon <address@hidden>
This patch allows registers to be properly read from and written to
when using the gdbstub to debug a ppc guest running in little
endian mode.
Reviewed-by: Andreas Färber <address@hidden>
Signed-off-by: Thomas Falcon <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
target-ppc/gdbstub.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/target-ppc/gdbstub.c b/target-ppc/gdbstub.c
index 0740af8..381a3c7 100644
--- a/target-ppc/gdbstub.c
+++ b/target-ppc/gdbstub.c
@@ -59,6 +59,17 @@ static int ppc_gdb_register_len(int n)
}
+static void ppc_gdb_swap_register(uint8_t *mem_buf, int n, int len)
+{
+ if (len == 4) {
+ bswap32s((uint32_t *)mem_buf);
+ } else if (len == 8) {
+ bswap64s((uint64_t *)mem_buf);
+ } else {
+ g_assert_not_reached();
+ }
+}
+
/* Old gdb always expects FP registers. Newer (xml-aware) gdb only
* expects whatever the target description contains. Due to a
* historical mishap the FP registers appear in between core integer
@@ -114,6 +125,10 @@ int ppc_cpu_gdb_read_register(CPUState *cs, uint8_t
*mem_buf, int n)
break;
}
}
+ if (msr_le) {
+ /* If cpu is in LE mode, convert memory contents to LE. */
+ ppc_gdb_swap_register(mem_buf, n, r);
+ }
return r;
}
@@ -126,6 +141,10 @@ int ppc_cpu_gdb_write_register(CPUState *cs, uint8_t
*mem_buf, int n)
if (!r) {
return r;
}
+ if (msr_le) {
+ /* If cpu is in LE mode, convert memory contents to LE. */
+ ppc_gdb_swap_register(mem_buf, n, r);
+ }
if (n < 32) {
/* gprs */
env->gpr[n] = ldtul_p(mem_buf);
--
1.8.1.4
- [Qemu-ppc] [PULL 037/118] target-ppc: Introduce DFP Test Data Group, (continued)
- [Qemu-ppc] [PULL 037/118] target-ppc: Introduce DFP Test Data Group, Alexander Graf, 2014/06/04
- [Qemu-ppc] [PULL 023/118] libdecnumber: Introduce decNumberFrom[U]Int64, Alexander Graf, 2014/06/04
- [Qemu-ppc] [PULL 033/118] target-ppc: Introduce DFP Multiply, Alexander Graf, 2014/06/04
- [Qemu-ppc] [PULL 060/118] PPC: e500: some pci related cleanup, Alexander Graf, 2014/06/04
- [Qemu-ppc] [PULL 022/118] target-ppc: Enable Building of libdecnumber, Alexander Graf, 2014/06/04
- [Qemu-ppc] [PULL 026/118] target-ppc: Define FPR Pointer Type for Helpers, Alexander Graf, 2014/06/04
- [Qemu-ppc] [PULL 020/118] libdecnumber: Eliminate redundant declarations, Alexander Graf, 2014/06/04
- [Qemu-ppc] [PULL 069/118] PPC: Add dcbtls emulation, Alexander Graf, 2014/06/04
- [Qemu-ppc] [PULL 017/118] libdecnumber: Prepare libdecnumber for QEMU include structure, Alexander Graf, 2014/06/04
- [Qemu-ppc] [PULL 030/118] target-ppc: Introduce DFP Post Processor Utilities, Alexander Graf, 2014/06/04
- [Qemu-ppc] [PULL 006/118] target-ppc: gdbstub allow byte swapping for reading/writing registers,
Alexander Graf <=
- [Qemu-ppc] [PULL 012/118] target-ppc: Eliminate Magic Number MSR Masks, Alexander Graf, 2014/06/04
- Re: [Qemu-ppc] [Qemu-devel] [PULL 00/118] ppc patch queue 2014-06-04, Peter Maydell, 2014/06/05