RFC: Should x86-64 support arbitrary calling conventions?
H.J. Lu
hjl.tools@gmail.com
Fri Mar 24 15:26:00 GMT 2017
On Thu, Mar 23, 2017 at 4:14 PM, Richard Henderson <rth@twiddle.net> wrote:
> On 03/24/2017 01:41 AM, H.J. Lu wrote:
>>
>> +# ifdef STATE_SAVE_MASK
>> + movl $STATE_SAVE_MASK, %eax
>> + xorl %edx, %edx
>> + # Clear the XSAVE Header.
>> + movq $0, (STATE_SAVE_OFFSET + 512)(%rsp)
>> + movq $0, (STATE_SAVE_OFFSET + 512 + 8)(%rsp)
>> + movq $0, (STATE_SAVE_OFFSET + 512 + 8 * 2)(%rsp)
>> + movq $0, (STATE_SAVE_OFFSET + 512 + 8 * 3)(%rsp)
>> + movq $0, (STATE_SAVE_OFFSET + 512 + 8 * 4)(%rsp)
>> + movq $0, (STATE_SAVE_OFFSET + 512 + 8 * 5)(%rsp)
>> + movq $0, (STATE_SAVE_OFFSET + 512 + 8 * 6)(%rsp)
>> + movq $0, (STATE_SAVE_OFFSET + 512 + 8 * 7)(%rsp)
>> # endif
>
>
> You've just cleared %rdx. Use that instead of 8*4 bytes of immediate zeros.
>
> Given that you have to ifdef this code into place, isn't it somewhat
> pointless to hide xsave behind a macro in the next line?
>
>> + STATE_SAVE STATE_SAVE_OFFSET(%rsp)
>
>
> I think it would be clearer to inline the two save instructions instead.
>
>
Good ideas. Here is the updated patch.
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-X86-64-Use-fxsave-xsave-in-_dl_runtime_resolve.patch
Type: text/x-patch
Size: 23530 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20170324/670ee2af/attachment.bin>
More information about the Libc-alpha
mailing list