From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16687 invoked by alias); 9 Oct 2003 00:39:14 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 16680 invoked from network); 9 Oct 2003 00:39:13 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 9 Oct 2003 00:39:13 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h990dDM00568 for ; Wed, 8 Oct 2003 20:39:13 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h990dCD27369 for ; Wed, 8 Oct 2003 20:39:12 -0400 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id h990dBi15297 for ; Wed, 8 Oct 2003 17:39:11 -0700 Message-ID: <3F84AE2F.4050208@redhat.com> Date: Thu, 09 Oct 2003 00:39:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: Re: [RFA] sh-tdep.c: Fix little endian problem with doubles References: <20031007164256.GO29063@cygbert.vinschen.de> In-Reply-To: <20031007164256.GO29063@cygbert.vinschen.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-10/txt/msg00279.txt.bz2 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); >