This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Handle return small struct in rs600 (size is not 4/8)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]