From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17053 invoked by alias); 11 Oct 2003 08:54:34 -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 17046 invoked from network); 11 Oct 2003 08:54:33 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 11 Oct 2003 08:54:33 -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 h9B8sXM12011 for ; Sat, 11 Oct 2003 04:54:33 -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 h9B8sWL19313 for ; Sat, 11 Oct 2003 04:54:32 -0400 Received: from cygbert.vinschen.de (vpn50-43.rdu.redhat.com [172.16.50.43]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id h9B8sUJ26398 for ; Sat, 11 Oct 2003 01:54:31 -0700 Received: by cygbert.vinschen.de (Postfix, from userid 500) id 416D458047; Sat, 11 Oct 2003 10:54:29 +0200 (CEST) Date: Sat, 11 Oct 2003 08:54:00 -0000 From: Corinna Vinschen To: gdb-patches@sources.redhat.com Subject: Re: [RFA] sh-tdep.c: Fix little endian problem with doubles Message-ID: <20031011085429.GA1981@cygbert.vinschen.de> Reply-To: gdb-patches@sources.redhat.com Mail-Followup-To: gdb-patches@sources.redhat.com References: <20031007164256.GO29063@cygbert.vinschen.de> <16263.10472.942634.557769@localhost.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16263.10472.942634.557769@localhost.redhat.com> User-Agent: Mutt/1.4.1i X-SW-Source: 2003-10/txt/msg00394.txt.bz2 On Fri, Oct 10, 2003 at 05:47:20PM -0400, Elena Zannoni wrote: > Corinna Vinschen writes: > > --- 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. Erm... sorry, I don't quite understand. An `else if' in conjuction with what `if'? Actually, the double case is handled normally in BE mode, it's only slightly different in LE mode in that the registers are swapped. The above code just makes the swap so I really don't see what the problem is. I see, however, that a TYPE_LENGTH(type) might be more readable than the `len' and even more correct, since len is modified in the loop. Yes, that makes sense. Back to the `else if'. Wouldn't it be better just to pump up the comment to explain what happens? Instead of A float type taking two registers must be handled differently in LE mode. better something along the lines In little endian mode, float types taking two registers (doubles on sh4, long doubles on sh2e, sh3e and sh4) must be stored swapped in the argument registers. The below code first writes the first 32 bits in the next but one register, increments the val and len values accordingly and then proceeds as normal by writing the second 32 bits in the next register. ? Corinna -- Corinna Vinschen Cygwin Developer Red Hat, Inc.