Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFA] sh-tdep.c: Fix little endian problem with doubles
Date: Thu, 09 Oct 2003 00:39:00 -0000	[thread overview]
Message-ID: <3F84AE2F.4050208@redhat.com> (raw)
In-Reply-To: <20031007164256.GO29063@cygbert.vinschen.de>

Corinna Vinschen wrote:
> 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

Giving an independent non-maintainer nod to this code...
I encountered the same issue earlier, and I think what
you're doing is right.  In fact, I thought I had done it.
Memory fails me...

Michael

> 
> 	* 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);
> 



  reply	other threads:[~2003-10-09  0:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-07 16:43 Corinna Vinschen
2003-10-09  0:39 ` Michael Snyder [this message]
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

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=3F84AE2F.4050208@redhat.com \
    --to=msnyder@redhat.com \
    --cc=gdb-patches@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