Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA/i386]: Enable default support for SSE registers
@ 2003-07-22 18:43 Kevin Buettner
  2003-07-29 15:49 ` Kevin Buettner
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Buettner @ 2003-07-22 18:43 UTC (permalink / raw)
  To: gdb-patches

I recently proposed enabling default support for SSE registers:

    http://sources.redhat.com/ml/gdb/2003-07/msg00159.html

No one raised any issues, so here's a patch.

Okay?

	* i386-tdep.c (i386_gdbarch_init): Enable default support for
	SSE registers.

Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.162
diff -u -p -r1.162 i386-tdep.c
--- i386-tdep.c	18 Jul 2003 21:31:50 -0000	1.162
+++ i386-tdep.c	22 Jul 2003 18:31:28 -0000
@@ -1716,10 +1716,23 @@ i386_gdbarch_init (struct gdbarch_info i
   tdep = XMALLOC (struct gdbarch_tdep);
   gdbarch = gdbarch_alloc (&info, tdep);
 
-  /* The i386 default settings don't include the SSE registers.
+  /* The i386 default settings now include the SSE registers.
+     I386_NUM_XREGS includes mxcsr, and we don't want to count
+     this as one of the xmm regs -- which is why we subtract one.
+
+     Note: kevinb/2003-07-14: Whatever Mark's concerns are about the
+     FPU registers in the FIXME below apply to the SSE registers as well.
+     The only problem that I see is that these registers will show up
+     in "info all-registers" even on CPUs where they don't exist.  IMO,
+     however, if it's a choice between printing them always (even when
+     they don't exist) or never showing them to the user (even when they
+     do exist), I prefer the former over the latter.  Ideally, of course,
+     we'd somehow autodetect that we have them (or not) and display them
+     when we have them and suppress them when we don't.
+
      FIXME: kettenis/20020614: They do include the FPU registers for
      now, which probably is not quite right.  */
-  tdep->num_xmm_regs = 0;
+  tdep->num_xmm_regs = I386_NUM_XREGS - 1;
 
   tdep->jb_pc_offset = -1;
   tdep->struct_return = pcc_struct_return;
@@ -1741,9 +1754,9 @@ i386_gdbarch_init (struct gdbarch_info i
      alignment.  */
   set_gdbarch_long_double_bit (gdbarch, 96);
 
-  /* The default ABI includes general-purpose registers and
-     floating-point registers.  */
-  set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS);
+  /* The default ABI includes general-purpose registers, 
+     floating-point registers, and the SSE registers.  */
+  set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS);
   set_gdbarch_register_name (gdbarch, i386_register_name);
   set_gdbarch_register_type (gdbarch, i386_register_type);
 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA/i386]: Enable default support for SSE registers
  2003-07-22 18:43 [RFA/i386]: Enable default support for SSE registers Kevin Buettner
@ 2003-07-29 15:49 ` Kevin Buettner
  2003-08-12 15:36   ` Mark Kettenis
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Buettner @ 2003-07-29 15:49 UTC (permalink / raw)
  To: Kevin Buettner, gdb-patches

Ping?

--- Forwarded mail from Kevin Buettner <kevinb@redhat.com>

Date: Tue, 22 Jul 2003 11:43:05 -0700
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA/i386]: Enable default support for SSE registers

I recently proposed enabling default support for SSE registers:

    http://sources.redhat.com/ml/gdb/2003-07/msg00159.html

No one raised any issues, so here's a patch.

Okay?

	* i386-tdep.c (i386_gdbarch_init): Enable default support for
	SSE registers.

Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.162
diff -u -p -r1.162 i386-tdep.c
--- i386-tdep.c	18 Jul 2003 21:31:50 -0000	1.162
+++ i386-tdep.c	22 Jul 2003 18:31:28 -0000
@@ -1716,10 +1716,23 @@ i386_gdbarch_init (struct gdbarch_info i
   tdep = XMALLOC (struct gdbarch_tdep);
   gdbarch = gdbarch_alloc (&info, tdep);
 
-  /* The i386 default settings don't include the SSE registers.
+  /* The i386 default settings now include the SSE registers.
+     I386_NUM_XREGS includes mxcsr, and we don't want to count
+     this as one of the xmm regs -- which is why we subtract one.
+
+     Note: kevinb/2003-07-14: Whatever Mark's concerns are about the
+     FPU registers in the FIXME below apply to the SSE registers as well.
+     The only problem that I see is that these registers will show up
+     in "info all-registers" even on CPUs where they don't exist.  IMO,
+     however, if it's a choice between printing them always (even when
+     they don't exist) or never showing them to the user (even when they
+     do exist), I prefer the former over the latter.  Ideally, of course,
+     we'd somehow autodetect that we have them (or not) and display them
+     when we have them and suppress them when we don't.
+
      FIXME: kettenis/20020614: They do include the FPU registers for
      now, which probably is not quite right.  */
-  tdep->num_xmm_regs = 0;
+  tdep->num_xmm_regs = I386_NUM_XREGS - 1;
 
   tdep->jb_pc_offset = -1;
   tdep->struct_return = pcc_struct_return;
@@ -1741,9 +1754,9 @@ i386_gdbarch_init (struct gdbarch_info i
      alignment.  */
   set_gdbarch_long_double_bit (gdbarch, 96);
 
-  /* The default ABI includes general-purpose registers and
-     floating-point registers.  */
-  set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS);
+  /* The default ABI includes general-purpose registers, 
+     floating-point registers, and the SSE registers.  */
+  set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS);
   set_gdbarch_register_name (gdbarch, i386_register_name);
   set_gdbarch_register_type (gdbarch, i386_register_type);
 

--- End of forwarded mail from Kevin Buettner <kevinb@redhat.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA/i386]: Enable default support for SSE registers
  2003-07-29 15:49 ` Kevin Buettner
@ 2003-08-12 15:36   ` Mark Kettenis
  2003-08-12 16:39     ` Kevin Buettner
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Kettenis @ 2003-08-12 15:36 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

Kevin Buettner <kevinb@redhat.com> writes:

> Ping?

Sorry, I've been on a vacation, and didn't read your message until
yesterday.  There is one more concern that I do have: If we include
the SSE registers, we somehow should also set their values to
something sensible for targets that don't support them.  We already do
this for Linux, but it makes more sense to add some code to
i387_supply_fsave().

Go ahead and check this in on mainline.  Do you want it on the 6.0
branch too?

Mark


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA/i386]: Enable default support for SSE registers
  2003-08-12 15:36   ` Mark Kettenis
@ 2003-08-12 16:39     ` Kevin Buettner
  2003-08-12 17:06       ` Mark Kettenis
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Buettner @ 2003-08-12 16:39 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

On Aug 12,  5:36pm, Mark Kettenis wrote:

> There is one more concern that I do have: If we include
> the SSE registers, we somehow should also set their values to
> something sensible for targets that don't support them.  We already do
> this for Linux, but it makes more sense to add some code to
> i387_supply_fsave().

I just took a quick look at this.  It's not obvious to me what you have
in mind.  Would you mind taking care of this?

Also... I just noticed the following bit of code in i387-tdep.c:

    i387_supply_register (int regnum, char *fsave)
    {
      if (fsave == NULL)
	{
	  supply_register (regnum, NULL);
	  return;
	}

Calling supply_register() with NULL will end up calling memcpy() with
NULL as the second argument.  If memcpy() is told to copy a non-zero
number of characters, it'll SEGV.

> Go ahead and check this in on mainline.

It's in.

> Do you want it on the 6.0 branch too?

It's not critical, but it'd be nice.

Kevin


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA/i386]: Enable default support for SSE registers
  2003-08-12 16:39     ` Kevin Buettner
@ 2003-08-12 17:06       ` Mark Kettenis
  2003-08-12 17:39         ` Kevin Buettner
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Kettenis @ 2003-08-12 17:06 UTC (permalink / raw)
  To: kevinb; +Cc: gdb-patches

   Date: Tue, 12 Aug 2003 09:39:37 -0700
   From: Kevin Buettner <kevinb@redhat.com>

   On Aug 12,  5:36pm, Mark Kettenis wrote:

   > There is one more concern that I do have: If we include
   > the SSE registers, we somehow should also set their values to
   > something sensible for targets that don't support them.  We already do
   > this for Linux, but it makes more sense to add some code to
   > i387_supply_fsave().

   I just took a quick look at this.  It's not obvious to me what you have
   in mind.  Would you mind taking care of this?

I'll take care of it.

   Also... I just noticed the following bit of code in i387-tdep.c:

       i387_supply_register (int regnum, char *fsave)
       {
	 if (fsave == NULL)
	   {
	     supply_register (regnum, NULL);
	     return;
	   }

   Calling supply_register() with NULL will end up calling memcpy() with
   NULL as the second argument.  If memcpy() is told to copy a non-zero
   number of characters, it'll SEGV.

Huh, If you call support_register() with NULL, it will use memset() to
initialize the register with all zeroes.

   > Do you want it on the 6.0 branch too?

   It's not critical, but it'd be nice.

I'll see.  At the very least I'll wait a few days and see whether
someone complains about the changed behaviour.

Mark


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA/i386]: Enable default support for SSE registers
  2003-08-12 17:06       ` Mark Kettenis
@ 2003-08-12 17:39         ` Kevin Buettner
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Buettner @ 2003-08-12 17:39 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

On Aug 12,  7:06pm, Mark Kettenis wrote:

>    Also... I just noticed the following bit of code in i387-tdep.c:
> 
>        i387_supply_register (int regnum, char *fsave)
>        {
> 	 if (fsave == NULL)
> 	   {
> 	     supply_register (regnum, NULL);
> 	     return;
> 	   }
> 
>    Calling supply_register() with NULL will end up calling memcpy() with
>    NULL as the second argument.  If memcpy() is told to copy a non-zero
>    number of characters, it'll SEGV.
> 
> Huh, If you call support_register() with NULL, it will use memset() to
> initialize the register with all zeroes.

My mistake.  The "tags" feature in my editor showed me the version in
gdbserver/regcache.c.

Kevin


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-08-12 17:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-22 18:43 [RFA/i386]: Enable default support for SSE registers Kevin Buettner
2003-07-29 15:49 ` Kevin Buettner
2003-08-12 15:36   ` Mark Kettenis
2003-08-12 16:39     ` Kevin Buettner
2003-08-12 17:06       ` Mark Kettenis
2003-08-12 17:39         ` Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox