From: "Kris Warkentin" <kewarken@qnx.com>
To: "Kris Warkentin" <kewarken@qnx.com>,
"Daniel Jacobowitz" <drow@mvista.com>
Cc: <gdb@sources.redhat.com>
Subject: Re: long long considered harmful?
Date: Wed, 23 Apr 2003 21:44:00 -0000 [thread overview]
Message-ID: <0cbf01c309e1$8bb32190$0202040a@catdog> (raw)
In-Reply-To: <0ca901c309de$a262f5d0$0202040a@catdog>
Inquiry:
All of our register structures in debug.h are unioned with basic arrays
guaranteed to be of sufficient size for storage. Would it be acceptable to
leave the structures with all the registers in them so that others can look
and see how things are structured in Neutrino as long as the
<arch>-nto-tdep.c files do what I do below with the offsets? That way
debug.h still matches our system headers but there is no code actually
relying on how the compiler organizes those structures.
Kris
> > Was that really so hard? And it's a lot clearer.
>
> Well, it's not really that hard. I'm just being grumpy because it's
snowing
> outside and I really want to get this stuff committed one of these days.
> I'd already done that to our i386 stuff both to remove the dependency on
the
> structure and to account for our weird ordering of registers. See snippet
> below:
>
> Kris
>
> /* Why 13? Look in our debug.h header at the x86_cpu_registers structure
> and you'll see an 'exx' junk register that is just filler. Don't ask
> me, ask the kernel guys. */
> #define NUM_GPREGS 13
>
> /* Map a GDB register number to an offset in the reg structure. */
> static int regmap[] = {
> (7 * 4), /* %eax */
> (6 * 4), /* %ecx */
> (5 * 4), /* %edx */
> (4 * 4), /* %ebx */
> (11 * 4), /* %esp */
> (2 * 4), /* %epb */
> (1 * 4), /* %esi */
> (0 * 4), /* %edi */
> (8 * 4), /* %eip */
> (10 * 4), /* %eflags */
> (9 * 4), /* %cs */
> (12 * 4), /* %ss */
> (-1 * 4) /* filler */
> };
>
> /* Perform mapping of gdb registers onto Neutrino registers.
> Actually works in reverse too which is why we make sure to
> return -1 if we're out of range. */
> int
> gdb_to_os (int regno)
> {
> return (regno >= 0 && regno < NUM_GPREGS) ? regmap[regno] >> 2 : -1;
> }
>
> void
> nto_supply_gregset (char *gpregs)
> {
> unsigned regno;
>
> for (regno = 0; regno < NUM_GPREGS - 1; regno++)
> {
> supply_register (regno, gpregs + regmap[regno]);
> }
> }
>
>
>
next prev parent reply other threads:[~2003-04-23 21:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-22 17:39 Kris Warkentin
2003-04-22 17:45 ` Daniel Jacobowitz
2003-04-22 18:08 ` Kris Warkentin
2003-04-22 18:21 ` Daniel Jacobowitz
2003-04-22 18:41 ` Kris Warkentin
2003-04-22 19:31 ` Daniel Jacobowitz
2003-04-22 19:12 ` Kris Warkentin
2003-04-22 19:25 ` Kris Warkentin
2003-04-22 19:30 ` Daniel Jacobowitz
2003-04-23 13:39 ` Kris Warkentin
2003-04-23 21:17 ` Daniel Jacobowitz
2003-04-23 21:23 ` Kris Warkentin
2003-04-23 21:44 ` Kris Warkentin [this message]
2003-04-23 21:47 ` Daniel Jacobowitz
2003-04-23 22:09 ` Kris Warkentin
2003-04-23 22:11 ` Daniel Jacobowitz
2003-04-23 22:17 ` Kris Warkentin
2003-04-24 21:05 ` Andrew Cagney
2003-04-24 23:51 ` Kris Warkentin
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='0cbf01c309e1$8bb32190$0202040a@catdog' \
--to=kewarken@qnx.com \
--cc=drow@mvista.com \
--cc=gdb@sources.redhat.com \
/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