From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26132 invoked by alias); 15 Aug 2011 17:27:51 -0000 Received: (qmail 26122 invoked by uid 22791); 15 Aug 2011 17:27:50 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Aug 2011 17:27:36 +0000 Received: (qmail 13144 invoked from network); 15 Aug 2011 17:27:35 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 15 Aug 2011 17:27:35 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [patch] Handle return small struct in rs600 (size is not 4/8) Date: Mon, 15 Aug 2011 17:27:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-10-generic; KDE/4.7.0; x86_64; ; ) Cc: Yao Qi , Mark Kettenis References: <4E4939A9.70000@codesourcery.com> <201108151605.p7FG5F1Z004428@glazunov.sibelius.xs4all.nl> <4E494FA9.9000402@codesourcery.com> In-Reply-To: <4E494FA9.9000402@codesourcery.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201108151827.32058.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-08/txt/msg00303.txt.bz2 On Monday 15 August 2011 17:56:09, Yao Qi wrote: > I think the description "shall be returned in r3 and r4, as if they were > first stored in memory area and then the low-addressed word were loaded > in r3 ...." is not very clear on the length of data. In this case, > struct C variable is returned, and its content is 0x61 0x62 0x63. They > (3 bytes) are stored in memory, and (3 bytes) are loaded into r3. Since > 3 bytes, not 4, are loaded to r3, so I believe r3 should be 0x616263, > instead of 0x61626300. I agree with Mark's interpretation (FWIW). By my reading, for a 3-byte struct c, if the raw memory content of c stored at AS-IF-ADDRESS in memory is 0x616263XX, then, when you load the contents of the low-addressed word (4 bytes) starting at AS-IF-ADDRESS to r3, you get 0x616263XX in r3. For a 5-byte struct c, if the raw memory content of c at AS-IF-ADDRESS is 0x6162636465XXXXXX, then, when you load the contents of the low-addressed word starting at AS-IF-ADDRESS to r3, you get 0x61626364 in r3; and then loading the contents of high-word at AS-IF-ADDRESS gets you 0x65XXXXXX in r4. -- Pedro Alves