Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] sh-tdep.c: Fix little endian problem with doubles
@ 2003-10-07 16:43 Corinna Vinschen
  2003-10-09  0:39 ` Michael Snyder
  2003-10-10 21:36 ` Elena Zannoni
  0 siblings, 2 replies; 8+ messages in thread
From: Corinna Vinschen @ 2003-10-07 16:43 UTC (permalink / raw)
  To: gdb-patches

Hi,

I missed to get little endian mode right when it comes to passing
doubles in registers on FPU CPUs.  The below patch fixes that.
It's against the two patches I sent on Saturday.

Corinna

	* sh-tdep.c (sh_push_dummy_call_fpu): Accomodate double passing
	in little endian mode.
	(sh3e_sh4_extract_return_value): Ditto.

--- sh-tdep.c.INTERIM	2003-10-04 13:22:01.000000000 +0200
+++ sh-tdep.c	2003-10-07 18:42:13.000000000 +0200
@@ -846,6 +846,17 @@ sh_push_dummy_call_fpu (struct gdbarch *
 	      /* Argument goes in a float argument register.  */
 	      reg_size = register_size (gdbarch, flt_argreg);
 	      regval = extract_unsigned_integer (val, reg_size);
+	      /* A float type taking two registers must be handled
+	         differently in LE mode.  */
+	      if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE
+	          && len == 2 * reg_size)
+	        {
+		  regcache_cooked_write_unsigned (regcache, flt_argreg + 1,
+						  regval);
+		  val += reg_size;
+		  len -= reg_size;
+		  regval = extract_unsigned_integer (val, reg_size);
+		}
 	      regcache_cooked_write_unsigned (regcache, flt_argreg++, regval);
 	    }
 	  else if (!treat_as_flt && argreg <= ARGLAST_REGNUM)
@@ -978,7 +989,10 @@ sh3e_sh4_extract_return_value (struct ty
       int len = TYPE_LENGTH (type);
       int i, regnum = FP0_REGNUM;
       for (i = 0; i < len; i += 4)
-	regcache_raw_read (regcache, regnum++, (char *) valbuf + i);
+	if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE)
+	  regcache_raw_read (regcache, regnum++, (char *) valbuf + len - 4 - i);
+	else
+	  regcache_raw_read (regcache, regnum++, (char *) valbuf + i);
     }
   else
     sh_default_extract_return_value (type, regcache, valbuf);

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.


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

end of thread, other threads:[~2003-10-14 15:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-07 16:43 [RFA] sh-tdep.c: Fix little endian problem with doubles Corinna Vinschen
2003-10-09  0:39 ` Michael Snyder
2003-10-10 21:36 ` Elena Zannoni
2003-10-11  8:54   ` Corinna Vinschen
2003-10-13 14:07     ` Elena Zannoni
2003-10-14 13:06       ` Corinna Vinschen
2003-10-14 14:36         ` Elena Zannoni
2003-10-14 15:36           ` Corinna Vinschen

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