From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: gdb-patches@sourceware.org
Cc: hjl.tools@gmail.com
Subject: Re: x32 ABI Support (committed)
Date: Wed, 13 Jun 2012 20:29:00 -0000 [thread overview]
Message-ID: <201206132029.q5DKTau7004406@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <201206122123.q5CLNS3D002137@glazunov.sibelius.xs4all.nl> (message from Mark Kettenis on Tue, 12 Jun 2012 23:23:28 +0200 (CEST))
> Date: Tue, 12 Jun 2012 23:23:28 +0200 (CEST)
> From: Mark Kettenis <mark.kettenis@xs4all.nl>
>
> > Date: Mon, 11 Jun 2012 06:42:32 -0700
> > From: "H.J. Lu" <hjl.tools@gmail.com>
> >
> > It works with the following patch. Can you check it in?
>
> Started working on that tonight but got sidetracked. Will do my
> utmost best to get this committed tomorrow.
Ended up splitting out the Linux-specific bits from the generic bits.
Generic bits go first.
2012-06-13 Mark Kettenis <kettenis@gnu.org>
H.J. Lu <hongjiu.lu@intel.com>
* i386-tdep.h (i386_pseudo_register_name): New prototype.
* i386-tdep.c (i386_pseudo_register_name): Make public.
* amd64-tdep.h (amd64_x32_init_abi): New prototype.
* amd64-tdep.c (amd64_dword_names): Add "eip".
(amd64_x32_pseudo_register_type): New function
(amd64_x32_init_abi): New function.
Index: amd64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-tdep.c,v
retrieving revision 1.105
diff -u -p -r1.105 amd64-tdep.c
--- amd64-tdep.c 16 May 2012 14:35:02 -0000 1.105
+++ amd64-tdep.c 13 Jun 2012 20:24:54 -0000
@@ -258,7 +258,8 @@ static const char *amd64_word_names[] =
static const char *amd64_dword_names[] =
{
"eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp",
- "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
+ "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d",
+ "eip"
};
/* Return the name of register REGNUM. */
@@ -2729,6 +2730,43 @@ amd64_init_abi (struct gdbarch_info info
set_gdbarch_stap_parse_special_token (gdbarch,
i386_stap_parse_special_token);
}
+\f
+
+static struct type *
+amd64_x32_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ switch (regnum - tdep->eax_regnum)
+ {
+ case AMD64_RBP_REGNUM: /* %ebp */
+ case AMD64_RSP_REGNUM: /* %esp */
+ return builtin_type (gdbarch)->builtin_data_ptr;
+ case AMD64_RIP_REGNUM: /* %eip */
+ return builtin_type (gdbarch)->builtin_func_ptr;
+ }
+
+ return i386_pseudo_register_type (gdbarch, regnum);
+}
+
+void
+amd64_x32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ const struct target_desc *tdesc = info.target_desc;
+
+ amd64_init_abi (info, gdbarch);
+
+ if (! tdesc_has_registers (tdesc))
+ tdesc = tdesc_x32;
+ tdep->tdesc = tdesc;
+
+ tdep->num_dword_regs = 17;
+ set_tdesc_pseudo_register_type (gdbarch, amd64_x32_pseudo_register_type);
+
+ set_gdbarch_long_bit (gdbarch, 32);
+ set_gdbarch_ptr_bit (gdbarch, 32);
+}
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_amd64_tdep (void);
Index: amd64-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/amd64-tdep.h,v
retrieving revision 1.21
diff -u -p -r1.21 amd64-tdep.h
--- amd64-tdep.h 4 Jan 2012 08:16:56 -0000 1.21
+++ amd64-tdep.h 13 Jun 2012 20:24:54 -0000
@@ -80,6 +80,8 @@ extern void amd64_displaced_step_fixup (
struct regcache *regs);
extern void amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
+extern void amd64_x32_init_abi (struct gdbarch_info info,
+ struct gdbarch *gdbarch);
/* Fill register REGNUM in REGCACHE with the appropriate
floating-point or SSE register value from *FXSAVE. If REGNUM is
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.351
diff -u -p -r1.351 i386-tdep.c
--- i386-tdep.c 18 May 2012 21:02:48 -0000 1.351
+++ i386-tdep.c 13 Jun 2012 20:24:57 -0000
@@ -2780,7 +2780,7 @@ i386_mmx_type (struct gdbarch *gdbarch)
/* Return the GDB type object for the "standard" data type of data in
register REGNUM. */
-static struct type *
+struct type *
i386_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
{
if (i386_mmx_regnum_p (gdbarch, regnum))
Index: i386-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.h,v
retrieving revision 1.78
diff -u -p -r1.78 i386-tdep.h
--- i386-tdep.h 27 Apr 2012 20:47:54 -0000 1.78
+++ i386-tdep.h 13 Jun 2012 20:24:57 -0000
@@ -309,6 +309,8 @@ extern int i386_ymm_regnum_p (struct gdb
extern const char *i386_pseudo_register_name (struct gdbarch *gdbarch,
int regnum);
+extern struct type *i386_pseudo_register_type (struct gdbarch *gdbarch,
+ int regnum);
extern void i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
struct regcache *regcache,
next prev parent reply other threads:[~2012-06-13 20:29 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-11 18:17 Three weeks to branching (gdb 7.5 release) Joel Brobecker
2012-05-11 18:43 ` H.J. Lu
2012-05-14 14:45 ` Joel Brobecker
2012-05-20 15:40 ` H.J. Lu
2012-05-20 20:44 ` Mark Kettenis
2012-05-20 21:25 ` H.J. Lu
2012-05-20 21:39 ` Mark Kettenis
2012-05-20 22:49 ` H.J. Lu
2012-05-25 16:52 ` H.J. Lu
2012-05-28 20:26 ` x32 ABI Support (was Re: Three weeks to branching (gdb 7.5 release)) Mark Kettenis
2012-05-28 21:18 ` H.J. Lu
2012-05-31 18:18 ` H.J. Lu
2012-06-05 12:58 ` H.J. Lu
2012-06-05 13:16 ` Mark Kettenis
2012-06-09 14:30 ` H.J. Lu
2012-06-10 21:52 ` Mark Kettenis
2012-06-11 13:42 ` H.J. Lu
2012-06-12 21:23 ` Mark Kettenis
2012-06-13 20:29 ` Mark Kettenis [this message]
2012-06-13 20:41 ` x32 ABI Support (committed) Mark Kettenis
2012-05-12 15:26 ` Three weeks to branching (gdb 7.5 release) Doug Evans
2012-05-20 14:59 ` Doug Evans
2012-06-11 15:35 ` Branching time + 1 week (was: "Re: Three weeks to branching (gdb 7.5 release)") Joel Brobecker
2012-06-11 15:52 ` Doug Evans
2012-06-11 16:00 ` Joel Brobecker
2012-06-21 20:20 ` Joel Brobecker
2012-06-21 20:25 ` Doug Evans
2012-06-22 14:47 ` Jan Kratochvil
2012-06-22 16:32 ` Joel Brobecker
2012-06-22 16:41 ` Jan Kratochvil
2012-06-22 17:38 ` Branching time + 1 week Tom Tromey
2012-06-22 20:31 ` Branching time + 1 week (was: "Re: Three weeks to branching (gdb 7.5 release)") Joel Brobecker
2012-06-24 9:14 ` [commit] gnulib update [Re: Branching time + 1 week] Jan Kratochvil
2012-06-22 16:42 ` Branching time + 1 week (was: "Re: Three weeks to branching (gdb 7.5 release)") H.J. Lu
2012-06-11 15:59 ` H.J. Lu
2012-06-11 16:11 ` Joel Brobecker
2012-06-11 16:20 ` H.J. Lu
2012-05-29 17:17 ` Three weeks to branching (gdb 7.5 release) Jan Kratochvil
2012-05-30 22:04 ` Joel Brobecker
2012-06-07 19:36 ` Maciej W. Rozycki
2012-06-11 14:58 ` Joel Brobecker
2012-06-12 15:39 ` Maciej W. Rozycki
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=201206132029.q5DKTau7004406@glazunov.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=gdb-patches@sourceware.org \
--cc=hjl.tools@gmail.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