This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: RFC: Should x86-64 support arbitrary calling conventions?


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.


r~


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