Skip to content

Instantly share code, notes, and snippets.

@ice799
Created May 11, 2010 17:46
Show Gist options
  • Save ice799/397590 to your computer and use it in GitHub Desktop.
Save ice799/397590 to your computer and use it in GitHub Desktop.
2010-05-11 Joe Damato <[email protected]>
* 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
cfi_startproc
_dl_runtime_resolve:
- 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.
cfi_endproc
.size _dl_runtime_resolve, .-_dl_runtime_resolve
--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment