From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32040 invoked by alias); 10 Oct 2003 21:36:10 -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 31940 invoked from network); 10 Oct 2003 21:36:09 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 10 Oct 2003 21:36:09 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h9ALa9M17104 for ; Fri, 10 Oct 2003 17:36:09 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h9ALa9c08046 for ; Fri, 10 Oct 2003 17:36:09 -0400 Received: from localhost.redhat.com (devserv.devel.redhat.com [172.16.58.1]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id h9ALa895012761 for ; Fri, 10 Oct 2003 17:36:09 -0400 Received: by localhost.redhat.com (Postfix, from userid 469) id 1C45B2CCB7; Fri, 10 Oct 2003 17:47:21 -0400 (EDT) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16263.10472.942634.557769@localhost.redhat.com> Date: Fri, 10 Oct 2003 21:36:00 -0000 To: gdb-patches@sources.redhat.com Subject: Re: [RFA] sh-tdep.c: Fix little endian problem with doubles In-Reply-To: <20031007164256.GO29063@cygbert.vinschen.de> References: <20031007164256.GO29063@cygbert.vinschen.de> X-SW-Source: 2003-10/txt/msg00385.txt.bz2 Corinna Vinschen writes: > 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); > + } I'd prefer if there is an 'else if' clause just for the doubles. I.e. don't use len in the test, but TYPE_LENGTH(type). This is too confusing. > 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); > this one is fine. elena > -- > Corinna Vinschen > Cygwin Developer > Red Hat, Inc.