From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH] Detect 64-bit-ness in PowerPC Book III-E
Date: Thu, 11 Dec 2014 11:15:00 -0000 [thread overview]
Message-ID: <1418296515-8689-1-git-send-email-yao@codesourcery.com> (raw)
This patch is to teach GDBServer to detect 64-bit inferior correctly.
We find a problem that GDBServer is unable to detect on an e5500 core
processor. Current GDBServer assumes that MSR is a 64-bit register,
but MSR is a 32-bit register in Book III-E. This patch is to fix this
problem by checking both bits in MSR, in order to handle both Book
III-S and Book III-E.
Is it OK?
gdb/gdbserver:
2014-12-11 Yao Qi <yao@codesourcery.com>
* linux-ppc-low.c (ppc_arch_setup) [__powerpc64__]: Change
variable msr to type 'unsigned long'. Check bit 63 or bit 31
is one.
---
gdb/gdbserver/linux-ppc-low.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
index 8fd4b38..0c0ced6 100644
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -401,7 +401,7 @@ ppc_arch_setup (void)
{
const struct target_desc *tdesc;
#ifdef __powerpc64__
- long msr;
+ unsigned long msr;
struct regcache *regcache;
/* On a 64-bit host, assume 64-bit inferior process with no
@@ -411,13 +411,17 @@ ppc_arch_setup (void)
current_process ()->tdesc = tdesc;
ppc_hwcap = 0;
- /* Only if the high bit of the MSR is set, we actually have
- a 64-bit inferior. */
+ /* We actually have a 64-bit inferior only if the certain bit of the
+ MSR is set. The PowerISA Book III-S MSR is different from the
+ PowerISA Book III-E MSR. The Book III-S MSR is 64 bits wide, and
+ its MSR[SF] is the bit 0 of a 64-bit value. Book III-E MSR is 32
+ bits wide, and its MSR[CM] is the bit 0 of a 32-bit value. We check
+ both here. */
regcache = new_register_cache (tdesc);
fetch_inferior_registers (regcache, find_regno (tdesc, "msr"));
collect_register_by_name (regcache, "msr", &msr);
free_register_cache (regcache);
- if (msr < 0)
+ if (msr & 0x8000000080000000)
{
ppc_get_hwcap (&ppc_hwcap);
if (ppc_hwcap & PPC_FEATURE_CELL)
--
1.9.3
next reply other threads:[~2014-12-11 11:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-11 11:15 Yao Qi [this message]
2014-12-11 15:31 ` Ulrich Weigand
2014-12-19 8:06 ` Yao Qi
2014-12-19 15:49 ` Ulrich Weigand
2015-01-11 8:27 ` [PATCH 0/2, V2] " Yao Qi
2015-01-11 8:27 ` [PATCH 1/2] Move some ppc macros to nat/ppc-linux.h Yao Qi
2015-01-13 16:57 ` Ulrich Weigand
2015-01-11 8:27 ` [PATCH 2/2] Detect 64-bit-ness in PowerPC Book III-E Yao Qi
2015-01-13 17:00 ` Ulrich Weigand
2015-01-14 2:54 ` Yao Qi
2015-01-14 12:47 ` Ulrich Weigand
2015-01-14 14:22 ` Yao Qi
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=1418296515-8689-1-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).