This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi 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: [SPARC v8] Make ffi compatible with Solaris Studio aggregate return ABI


Hi Anthony,

I just found I missed to use "flush" to sync the instruction cache on v8.
It may cause problems in rare cases.
Attached is a follow-up patch for this issue.

Thanks,

Ginn

Attachment: sparc_v8_flush.diff
Description: Binary data



On Feb 8, 2011, at 11:45 PM, Anthony Green wrote:

> Ginn Chen <ginn.chen@oracle.com> writes:
> 
>> SPARC V8 Manual has:
>> "When a procedure expecting an aggregate return value from a called function is
>> compiled, an UNIMP instruction is placed after the delay-slot instruction
>> following the CALL to the function in question. The immediate field in this
>> UNIMP instruction contains the low-order twelve bits of the size (in bytes) of
>> the area allocated by the caller for the aggregate value expected to be
>> returned."
>> 
>> The function compiled by gcc doesn't check the UNIMP instruction, it simply copy the returning struct and jump to %i7+12.
>> The same function compiled by Solaris Studio, checks the struct size in UNIMP instruction, if it matches the returning struct it will copy the value and jump to %i7+12,
>> if not it will do nothing and jump to %i7+8.
>> 
>> So simply adding a nop in v8.S doesn't work with libraries compiled by Solaris Studio.
>> e.g. if I compile testsuite/cls_8byte.c with Solaris Studio, it will not pass the test.
>> 
>> I have a patch to alloc some executable space and make the call with exact struct size there.
>> The patch is at:
>> https://bugzilla.mozilla.org/show_bug.cgi?id=583206
>> 
>> I have tested it on Solaris with both gcc and Solaris Studio.
>> 
>> Please review it.
> 
> Thanks Ginn.  This looks good to me.  I've committed it to libffi.
> 
> AG
> 
> 
>> 
>> Thanks,
>> 
>> Ginn  


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