[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 23/39] target-ppc: gdbstub: fix altivec registers for l
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 23/39] target-ppc: gdbstub: fix altivec registers for little-endian guests |
Date: |
Fri, 29 Jan 2016 16:06:55 +1100 |
From: Greg Kurz <address@hidden>
Altivec registers are 128-bit wide. They are stored in memory as two
64-bit values that must be byteswapped when the guest is little-endian.
Let's reuse the ppc_maybe_bswap_register() helper for this.
We also need to fix the ordering of the 64-bit elements according to
the target endianness, for both system and user mode.
Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target-ppc/translate_init.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 41308c3..02734a2 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -8754,9 +8754,9 @@ static void dump_ppc_insns (CPUPPCState *env)
static bool avr_need_swap(CPUPPCState *env)
{
#ifdef HOST_WORDS_BIGENDIAN
- return false;
+ return msr_le;
#else
- return true;
+ return !msr_le;
#endif
}
@@ -8800,14 +8800,18 @@ static int gdb_get_avr_reg(CPUPPCState *env, uint8_t
*mem_buf, int n)
stq_p(mem_buf, env->avr[n].u64[1]);
stq_p(mem_buf+8, env->avr[n].u64[0]);
}
+ ppc_maybe_bswap_register(env, mem_buf, 8);
+ ppc_maybe_bswap_register(env, mem_buf + 8, 8);
return 16;
}
if (n == 32) {
stl_p(mem_buf, env->vscr);
+ ppc_maybe_bswap_register(env, mem_buf, 4);
return 4;
}
if (n == 33) {
stl_p(mem_buf, (uint32_t)env->spr[SPR_VRSAVE]);
+ ppc_maybe_bswap_register(env, mem_buf, 4);
return 4;
}
return 0;
@@ -8816,6 +8820,8 @@ static int gdb_get_avr_reg(CPUPPCState *env, uint8_t
*mem_buf, int n)
static int gdb_set_avr_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
{
if (n < 32) {
+ ppc_maybe_bswap_register(env, mem_buf, 8);
+ ppc_maybe_bswap_register(env, mem_buf + 8, 8);
if (!avr_need_swap(env)) {
env->avr[n].u64[0] = ldq_p(mem_buf);
env->avr[n].u64[1] = ldq_p(mem_buf+8);
@@ -8826,10 +8832,12 @@ static int gdb_set_avr_reg(CPUPPCState *env, uint8_t
*mem_buf, int n)
return 16;
}
if (n == 32) {
+ ppc_maybe_bswap_register(env, mem_buf, 4);
env->vscr = ldl_p(mem_buf);
return 4;
}
if (n == 33) {
+ ppc_maybe_bswap_register(env, mem_buf, 4);
env->spr[SPR_VRSAVE] = (target_ulong)ldl_p(mem_buf);
return 4;
}
--
2.5.0
- [Qemu-ppc] [PULL 06/39] cuda: add missing fields to VMStateDescription, (continued)
- [Qemu-ppc] [PULL 06/39] cuda: add missing fields to VMStateDescription, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 01/39] target-ppc: Use sensible POWER8/POWER8E versions, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 15/39] pseries: Clean up error handling in spapr_rtas_register(), David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 09/39] spapr: Remove abuse of rtas_ld() in h_client_architecture_support, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 11/39] ppc: Clean up error handling in ppc_set_compat(), David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 14/39] pseries: Clean up error handling in spapr_vga_init(), David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 27/39] cuda.c: return error for unknown commands, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 22/39] target-ppc: gdbstub: introduce avr_need_swap(), David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 13/39] pseries: Clean up error handling in spapr_validate_node_memory(), David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 26/39] pseries: Allow TCG h_enter to work with hotplugged memory, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 23/39] target-ppc: gdbstub: fix altivec registers for little-endian guests,
David Gibson <=
- [Qemu-ppc] [PULL 37/39] target-ppc: Helper to determine page size information from hpte alone, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 33/39] target-ppc: Use actual page size encodings from HPTE, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 25/39] target-ppc: gdbstub: Add VSX support, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 21/39] target-ppc: gdbstub: fix float registers for little-endian guests, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 28/39] uninorth.c: add support for UniNorth kMacRISCPCIAddressSelect (0x48) register, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 20/39] target-ppc: rename and export maybe_bswap_register(), David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 34/39] target-ppc: Remove unused mmu models from ppc_tlb_invalidate_one, David Gibson, 2016/01/29
- [Qemu-ppc] [PULL 32/39] target-ppc: Rework SLB page size lookup, David Gibson, 2016/01/29