From: Jan Kiszka <jan.kiszka@siemens.com>
To: Jason Wessel <jason.wessel@windriver.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kgdb-bugreport@lists.sourceforge.net"
<kgdb-bugreport@lists.sourceforge.net>
Subject: Re: [PATCH 1/4] kgdb: x86: Return all segment registers also in 64-bit mode
Date: Mon, 19 Mar 2012 14:52:32 +0100 [thread overview]
Message-ID: <4F673A20.9020505@siemens.com> (raw)
In-Reply-To: <4F636307.1050404@windriver.com>
On 2012-03-16 16:57, Jason Wessel wrote:
> On 03/16/2012 07:17 AM, Jan Kiszka wrote:
>> Even if the content is always 0, gdb expects us to return also ds,
>> es, fs, and gs while in x86-64 mode. Do this to avoid ugly errors on
>> "info registers".
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>> arch/x86/include/asm/kgdb.h | 6 +++++-
>> arch/x86/kernel/kgdb.c | 6 ++++--
>> 2 files changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/kgdb.h b/arch/x86/include/asm/kgdb.h
>> index 77e95f5..e857f1a 100644
>> --- a/arch/x86/include/asm/kgdb.h
>> +++ b/arch/x86/include/asm/kgdb.h
>> @@ -64,9 +64,13 @@ enum regnames {
>> GDB_PS, /* 17 */
>> GDB_CS, /* 18 */
>> GDB_SS, /* 19 */
>> + GDB_DS, /* 20 */
>> + GDB_ES, /* 21 */
>> + GDB_FS, /* 22 */
>> + GDB_GS, /* 23 */
>> };
>> #define GDB_ORIG_AX 57
>> -#define DBG_MAX_REG_NUM 20
>> +#define DBG_MAX_REG_NUM 24
>> /* 17 64 bit regs and 3 32 bit regs */
>> #define NUMREGBYTES ((17 * 8) + (3 * 4))
>
> You bumped the register numbers correctly, but you also need to add the correct padding to the NUMREGBYTES or you might not get a large enough memory block for the register struct.
>
> You added 2 32 bit regs, so it should change to:
>
> /* 17 64 bit regs and 5 32 bit regs */
> #define NUMREGBYTES ((17 * 8) + (5 * 4))
>
Oops. Most probably explains the random gs content I saw these days in a
64-bit debugging session.
>
> The rest should be fine. I can test this and add it to the merge queue with the NUMREGBYTES change, unless you disagree.
I don't disagree. :)
Thanks,
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2012-03-19 13:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-16 12:17 [PATCH 0/4] kgdb: Small usability improvements for x86 Jan Kiszka
2012-03-16 12:17 ` [PATCH 1/4] kgdb: x86: Return all segment registers also in 64-bit mode Jan Kiszka
2012-03-16 15:57 ` Jason Wessel
2012-03-19 13:52 ` Jan Kiszka [this message]
2012-03-19 20:52 ` Jason Wessel
2012-03-16 12:17 ` [PATCH 2/4] kgdb: Make gdbstub_exit a nop unless gdb is attached Jan Kiszka
2012-03-16 16:04 ` Jason Wessel
2012-03-16 12:17 ` [PATCH 3/4] kgdb: Respect that flush op is optional Jan Kiszka
2012-03-16 12:46 ` Jason Wessel
2012-03-16 12:53 ` Jan Kiszka
2012-03-16 16:16 ` Jason Wessel
2012-03-16 12:17 ` [PATCH 4/4] kgdb: x86: Detach gdb if machine shuts down or reboots Jan Kiszka
2012-03-16 15:36 ` Jason Wessel
2012-03-19 13:49 ` Jan Kiszka
2012-03-20 1:00 ` Jason Wessel
2012-03-20 11:18 ` [Kgdb-bugreport] " Sergei Shtylyov
2012-03-20 11:46 ` Jason Wessel
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=4F673A20.9020505@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=jason.wessel@windriver.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.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