db34050364
CVE-2016-1981: infinite loop in e1000 (bz #1299995) Fix Out-of-bounds read in usb-ehci (bz #1300234, bz #1299455) CVE-2016-2197: ahci: null pointer dereference (bz #1302952) Fix gdbstub for VSX registers for ppc64 (bz #1304377) Fix qemu-img vmdk images to work with VMware (bz #1299185)
80 lines
2.6 KiB
Diff
80 lines
2.6 KiB
Diff
From: Greg Kurz <gkurz@linux.vnet.ibm.com>
|
|
Date: Fri, 15 Jan 2016 16:00:31 +0100
|
|
Subject: [PATCH] target-ppc: gdbstub: introduce avr_need_swap()
|
|
|
|
This helper will be used to support Altivec registers in little-endian guests.
|
|
This patch does not change functionnality.
|
|
|
|
Note: I had to put the helper some lines away from the gdb_*_avr_reg()
|
|
routines to get a more readable patch.
|
|
|
|
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
|
|
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
(cherry picked from commit 87601e2d5c22d9c1fef0e09978d377f46336c1db)
|
|
---
|
|
target-ppc/translate_init.c | 37 +++++++++++++++++++++++--------------
|
|
1 file changed, 23 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
|
|
index 51fa03c..c1d2db6 100644
|
|
--- a/target-ppc/translate_init.c
|
|
+++ b/target-ppc/translate_init.c
|
|
@@ -8754,6 +8754,15 @@ static void dump_ppc_insns (CPUPPCState *env)
|
|
}
|
|
#endif
|
|
|
|
+static bool avr_need_swap(CPUPPCState *env)
|
|
+{
|
|
+#ifdef HOST_WORDS_BIGENDIAN
|
|
+ return false;
|
|
+#else
|
|
+ return true;
|
|
+#endif
|
|
+}
|
|
+
|
|
static int gdb_get_float_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
|
|
{
|
|
if (n < 32) {
|
|
@@ -8787,13 +8796,13 @@ static int gdb_set_float_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
|
|
static int gdb_get_avr_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
|
|
{
|
|
if (n < 32) {
|
|
-#ifdef HOST_WORDS_BIGENDIAN
|
|
- stq_p(mem_buf, env->avr[n].u64[0]);
|
|
- stq_p(mem_buf+8, env->avr[n].u64[1]);
|
|
-#else
|
|
- stq_p(mem_buf, env->avr[n].u64[1]);
|
|
- stq_p(mem_buf+8, env->avr[n].u64[0]);
|
|
-#endif
|
|
+ if (!avr_need_swap(env)) {
|
|
+ stq_p(mem_buf, env->avr[n].u64[0]);
|
|
+ stq_p(mem_buf+8, env->avr[n].u64[1]);
|
|
+ } else {
|
|
+ stq_p(mem_buf, env->avr[n].u64[1]);
|
|
+ stq_p(mem_buf+8, env->avr[n].u64[0]);
|
|
+ }
|
|
return 16;
|
|
}
|
|
if (n == 32) {
|
|
@@ -8810,13 +8819,13 @@ 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) {
|
|
-#ifdef HOST_WORDS_BIGENDIAN
|
|
- env->avr[n].u64[0] = ldq_p(mem_buf);
|
|
- env->avr[n].u64[1] = ldq_p(mem_buf+8);
|
|
-#else
|
|
- env->avr[n].u64[1] = ldq_p(mem_buf);
|
|
- env->avr[n].u64[0] = ldq_p(mem_buf+8);
|
|
-#endif
|
|
+ if (!avr_need_swap(env)) {
|
|
+ env->avr[n].u64[0] = ldq_p(mem_buf);
|
|
+ env->avr[n].u64[1] = ldq_p(mem_buf+8);
|
|
+ } else {
|
|
+ env->avr[n].u64[1] = ldq_p(mem_buf);
|
|
+ env->avr[n].u64[0] = ldq_p(mem_buf+8);
|
|
+ }
|
|
return 16;
|
|
}
|
|
if (n == 32) {
|