From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20416 invoked by alias); 7 Oct 2003 16:43:11 -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 20393 invoked from network); 7 Oct 2003 16:43:10 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 7 Oct 2003 16:43:10 -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 h97Gh8102307 for ; Tue, 7 Oct 2003 12:43:08 -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 h97GgxD23580 for ; Tue, 7 Oct 2003 12:42:59 -0400 Received: from cygbert.vinschen.de (vpn50-11.rdu.redhat.com [172.16.50.11]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id h97Ggww21091 for ; Tue, 7 Oct 2003 09:42:58 -0700 Received: by cygbert.vinschen.de (Postfix, from userid 500) id 9C21B58044; Tue, 7 Oct 2003 18:42:56 +0200 (CEST) Date: Tue, 07 Oct 2003 16:43:00 -0000 From: Corinna Vinschen To: gdb-patches@sources.redhat.com Subject: [RFA] sh-tdep.c: Fix little endian problem with doubles Message-ID: <20031007164256.GO29063@cygbert.vinschen.de> Reply-To: gdb-patches@sources.redhat.com Mail-Followup-To: gdb-patches@sources.redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2003-10/txt/msg00170.txt.bz2 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.