From: Andrew Cagney <ac131313@redhat.com>
To: Mark Kettenis <kettenis@chello.nl>
Cc: drow@mvista.com, gdb-patches@sources.redhat.com
Subject: Re: [patch rfc rfa:i386] Add i386 specific register groups
Date: Fri, 08 Nov 2002 16:00:00 -0000 [thread overview]
Message-ID: <3DCC503C.1020102@redhat.com> (raw)
In-Reply-To: <200211082314.gA8NEOLL015059@elgar.kettenis.dyndns.org>
[-- Attachment #1: Type: text/plain, Size: 262 bytes --]
I've checked in the attached.
Andrew
> Date: Fri, 08 Nov 2002 18:09:46 -0500
> From: Andrew Cagney <ac131313@redhat.com>
>
> How does the attached look then?
>
> Great! Please go ahead and check in the code that produced this output.
>
> Mark
>
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 5494 bytes --]
2002-11-08 Andrew Cagney <ac131313@redhat.com>
* i386-linux-tdep.c: Include "reggroups.h".
(i386_linux_register_reggroup_p): New function.
(i386_linux_init_abi): Set register_reggroup_p to
i386_linux_register_reggroup_p.
* i386-tdep.h (i386_register_reggroup_p): Declare.
* i386-tdep.c: Include "reggroups.h".
(i386_init_reggroups): New function.
(i386_add_reggroups): New function.
(i386_register_reggroup_p): New function.
(i386_sse_reggroup, i386_mmx_reggroup): New variables.
(_initialize_i386_tdep): Call i386_init_reggroups.
(i386_gdbarch_init): Set register_reggroup_p and add in the i386
specific reggroups.
Index: i386-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-tdep.c,v
retrieving revision 1.18
diff -u -r1.18 i386-linux-tdep.c
--- i386-linux-tdep.c 31 Oct 2002 20:51:15 -0000 1.18
+++ i386-linux-tdep.c 8 Nov 2002 23:57:43 -0000
@@ -25,6 +25,7 @@
#include "value.h"
#include "regcache.h"
#include "inferior.h"
+#include "reggroups.h"
/* For i386_linux_skip_solib_resolver. */
#include "symtab.h"
@@ -47,6 +48,20 @@
return i386_register_name (reg);
}
+
+/* Return non-zero, when the register is in the corresponding register
+ group. Put the LINUX_ORIG_EAX register in the system group. */
+static int
+i386_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+ struct reggroup *group)
+{
+ if (regnum == I386_LINUX_ORIG_EAX_REGNUM)
+ return (group == system_reggroup
+ || group == save_reggroup
+ || group == restore_reggroup);
+ return i386_register_reggroup_p (gdbarch, regnum, group);
+}
+
\f
/* Recognizing signal handler frames. */
@@ -442,6 +457,7 @@
set_gdbarch_write_pc (gdbarch, i386_linux_write_pc);
set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS + 1);
set_gdbarch_register_name (gdbarch, i386_linux_register_name);
+ set_gdbarch_register_reggroup_p (gdbarch, i386_linux_register_reggroup_p);
set_gdbarch_register_bytes (gdbarch, I386_SSE_SIZEOF_REGS + 4);
tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.93
diff -u -r1.93 i386-tdep.c
--- i386-tdep.c 8 Nov 2002 17:34:31 -0000 1.93
+++ i386-tdep.c 8 Nov 2002 23:57:43 -0000
@@ -37,6 +37,7 @@
#include "doublest.h"
#include "value.h"
#include "gdb_assert.h"
+#include "reggroups.h"
#include "i386-tdep.h"
#include "i387-tdep.h"
@@ -1443,6 +1444,56 @@
}
\f
+/* i386 register groups. In addition to the normal groups, add "mmx"
+ and "sse". */
+
+static struct reggroup *i386_sse_reggroup;
+static struct reggroup *i386_mmx_reggroup;
+
+static void
+i386_init_reggroups (void)
+{
+ i386_sse_reggroup = reggroup_new ("sse", USER_REGGROUP);
+ i386_mmx_reggroup = reggroup_new ("mmx", USER_REGGROUP);
+}
+
+static void
+i386_add_reggroups (struct gdbarch *gdbarch)
+{
+ reggroup_add (gdbarch, i386_sse_reggroup);
+ reggroup_add (gdbarch, i386_mmx_reggroup);
+ reggroup_add (gdbarch, general_reggroup);
+ reggroup_add (gdbarch, float_reggroup);
+ reggroup_add (gdbarch, all_reggroup);
+ reggroup_add (gdbarch, save_reggroup);
+ reggroup_add (gdbarch, restore_reggroup);
+ reggroup_add (gdbarch, vector_reggroup);
+ reggroup_add (gdbarch, system_reggroup);
+}
+
+int
+i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+ struct reggroup *group)
+{
+ int sse_regnum_p = (i386_sse_regnum_p (regnum)
+ || i386_mxcsr_regnum_p (regnum));
+ int fp_regnum_p = (i386_fp_regnum_p (regnum)
+ || i386_fpc_regnum_p (regnum));
+ int mmx_regnum_p = (i386_mmx_regnum_p (regnum));
+ if (group == i386_mmx_reggroup)
+ return mmx_regnum_p;
+ if (group == i386_sse_reggroup)
+ return sse_regnum_p;
+ if (group == vector_reggroup)
+ return (mmx_regnum_p || sse_regnum_p);
+ if (group == float_reggroup)
+ return fp_regnum_p;
+ if (group == general_reggroup)
+ return (!fp_regnum_p && !mmx_regnum_p && !sse_regnum_p);
+ return default_register_reggroup_p (gdbarch, regnum, group);
+}
+
+\f
static struct gdbarch *
i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
@@ -1601,6 +1652,10 @@
set_gdbarch_print_insn (gdbarch, i386_print_insn);
+ /* Add the i386 register groups. */
+ i386_add_reggroups (gdbarch);
+ set_gdbarch_register_reggroup_p (gdbarch, i386_register_reggroup_p);
+
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch, osabi);
@@ -1671,4 +1726,7 @@
i386_go32_init_abi);
gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETWARE,
i386_nw_init_abi);
+
+ /* Initialize the i386 specific register groups. */
+ i386_init_reggroups ();
}
Index: i386-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.h,v
retrieving revision 1.18
diff -u -r1.18 i386-tdep.h
--- i386-tdep.h 8 Nov 2002 23:35:14 -0000 1.18
+++ i386-tdep.h 8 Nov 2002 23:57:43 -0000
@@ -167,6 +167,10 @@
/* Return the name of register REG. */
extern char const *i386_register_name (int reg);
+/* Return non-zero if REGNUM is a member of the specified group. */
+extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+ struct reggroup *group);
+
/* Initialize a basic ELF architecture variant. */
extern void i386_elf_init_abi (struct gdbarch_info, struct gdbarch *);
prev parent reply other threads:[~2002-11-09 0:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-08 9:53 Andrew Cagney
2002-11-08 12:21 ` Mark Kettenis
2002-11-08 12:32 ` Andrew Cagney
2002-11-08 12:34 ` Daniel Jacobowitz
2002-11-08 12:43 ` Andrew Cagney
2002-11-08 12:51 ` Daniel Jacobowitz
2002-11-08 12:56 ` Mark Kettenis
2002-11-08 15:09 ` Andrew Cagney
2002-11-08 15:14 ` Mark Kettenis
2002-11-08 16:00 ` Andrew Cagney [this message]
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=3DCC503C.1020102@redhat.com \
--to=ac131313@redhat.com \
--cc=drow@mvista.com \
--cc=gdb-patches@sources.redhat.com \
--cc=kettenis@chello.nl \
/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