From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: Aldy Hernandez <aldyh@redhat.com>, qemu-ppc@nongnu.org, agraf@suse.de
Subject: [Qemu-devel] [PATCH 2/2] target-ppc: Fix gdbstub for ppc64le-linux-user
Date: Sat, 28 Jun 2014 09:45:28 -0700 [thread overview]
Message-ID: <1403973928-9717-3-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1403973928-9717-1-git-send-email-rth@twiddle.net>
The bswap that's needed for system mode isn't required for
user mode, and in fact breaks debugging.
Cc: Aldy Hernandez <aldyh@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
target-ppc/gdbstub.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/target-ppc/gdbstub.c b/target-ppc/gdbstub.c
index 381a3c7..7a01e62 100644
--- a/target-ppc/gdbstub.c
+++ b/target-ppc/gdbstub.c
@@ -58,16 +58,24 @@ static int ppc_gdb_register_len(int n)
}
}
-
-static void ppc_gdb_swap_register(uint8_t *mem_buf, int n, int len)
+/* We need to present the registers to gdb in the "current" memory ordering.
+ For user-only mode we get this for free; TARGET_WORDS_BIGENDIAN is set to
+ the proper ordering for the binary, and cannot be changed.
+ For system mode, TARGET_WORDS_BIGENDIAN is always set, and we must check
+ the current mode of the chip to see if we're running in little-endian. */
+static void maybe_bswap_register(CPUPPCState *env, uint8_t *mem_buf, int len)
{
- if (len == 4) {
+#ifndef CONFIG_USER_ONLY
+ if (!msr_le) {
+ /* do nothing */
+ } else if (len == 4) {
bswap32s((uint32_t *)mem_buf);
} else if (len == 8) {
bswap64s((uint64_t *)mem_buf);
} else {
g_assert_not_reached();
}
+#endif
}
/* Old gdb always expects FP registers. Newer (xml-aware) gdb only
@@ -125,10 +133,7 @@ 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);
- }
+ maybe_bswap_register(env, mem_buf, r);
return r;
}
@@ -141,10 +146,7 @@ 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);
- }
+ maybe_bswap_register(env, mem_buf, r);
if (n < 32) {
/* gprs */
env->gpr[n] = ldtul_p(mem_buf);
--
1.9.3
next prev parent reply other threads:[~2014-06-28 16:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-28 16:45 [Qemu-devel] [PATCH 0/2] ppc64le-linux-user fixes Richard Henderson
2014-06-28 16:45 ` [Qemu-devel] [PATCH 1/2] target-ppc: Change default cpu for ppc64le-linux-user Richard Henderson
2014-06-28 16:50 ` Alexander Graf
2014-06-28 18:42 ` Richard Henderson
2014-06-30 12:08 ` Tom Musta
2014-06-30 12:17 ` Alexander Graf
2014-06-28 16:45 ` Richard Henderson [this message]
2014-06-30 12:20 ` [Qemu-devel] [PATCH 2/2] target-ppc: Fix gdbstub " Alexander Graf
2014-06-30 12:20 ` [Qemu-devel] [PATCH 0/2] ppc64le-linux-user fixes Alexander Graf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1403973928-9717-3-git-send-email-rth@twiddle.net \
--to=rth@twiddle.net \
--cc=agraf@suse.de \
--cc=aldyh@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).