This is the mail archive of the 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]

[PATCH] Save and restore SSE registers in _dl_runtime_resolve.


It seems that _dl_runtime_resolve should be saving and restoring the
SSE registers to comply with the amd64 ABI, unless I am reading it
incorrectly (and I very well could be).


2010-05-11  Joe Damato  <>

	* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve): Save and
	restore SSE registers.
 sysdeps/x86_64/dl-trampoline.S |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S
index 5564a11..44706d9 100644
--- a/sysdeps/x86_64/dl-trampoline.S
+++ b/sysdeps/x86_64/dl-trampoline.S
@@ -27,8 +27,10 @@
 	.align 16
-	subq $56,%rsp
-	cfi_adjust_cfa_offset(72) # Incorporate PLT
+	pushq %rbp
+	movq %rsp, %rbp
+	subq $192,%rsp
+	cfi_adjust_cfa_offset(216) # Incorporate PLT
 	movq %rax,(%rsp)	# Preserve registers otherwise clobbered.
 	movq %rcx, 8(%rsp)
 	movq %rdx, 16(%rsp)
@@ -36,19 +38,37 @@ _dl_runtime_resolve:
 	movq %rdi, 32(%rsp)
 	movq %r8, 40(%rsp)
 	movq %r9, 48(%rsp)
-	movq 64(%rsp), %rsi	# Copy args pushed by PLT in register.
-	movq 56(%rsp), %rdi	# %rdi: link_map, %rsi: reloc_index
+	movdqa %xmm0, 64(%rsp)
+	movdqa %xmm1, 80(%rsp)
+	movdqa %xmm2, 96(%rsp)
+	movdqa %xmm3, 112(%rsp)
+	movdqa %xmm4, 128(%rsp)
+	movdqa %xmm5, 144(%rsp)
+	movdqa %xmm6, 160(%rsp)
+	movdqa %xmm7, 176(%rsp)
+	movq 208(%rsp), %rsi	# Copy args pushed by PLT in register.
+	movq 200(%rsp), %rdi	# %rdi: link_map, %rsi: reloc_index
 	call _dl_fixup		# Call resolver.
 	movq %rax, %r11		# Save return value
-	movq 48(%rsp), %r9	# Get register content back.
+	movdqa 176(%rsp), %xmm7	# Get register content back.
+	movdqa 160(%rsp), %xmm6
+	movdqa 144(%rsp), %xmm5
+	movdqa 128(%rsp), %xmm4
+	movdqa 112(%rsp), %xmm3
+	movdqa 96(%rsp), %xmm2
+	movdqa 80(%rsp), %xmm1
+	movdqa 64(%rsp), %xmm0
+	movq 48(%rsp), %r9
 	movq 40(%rsp), %r8
 	movq 32(%rsp), %rdi
 	movq 24(%rsp), %rsi
 	movq 16(%rsp), %rdx
 	movq 8(%rsp), %rcx
 	movq (%rsp), %rax
-	addq $72, %rsp		# Adjust stack(PLT did 2 pushes)
-	cfi_adjust_cfa_offset(-72)
+	addq $192, %rsp
+	popq %rbp
+	addq $16, %rsp	# Adjust stack(PLT did 2 pushes)
+	cfi_adjust_cfa_offset(-216)
 	jmp *%r11		# Jump to function address.
 	.size _dl_runtime_resolve, .-_dl_runtime_resolve

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