[PATCH] D23051: [compiler-rt][XRay] Stash xmm registers in the trampolines
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 1 22:43:38 PDT 2016
dberris created this revision.
dberris added reviewers: rSerge, eugenis, echristo, rnk.
dberris added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.
We now stash and restore the xmm registers in the trampolines so that
log handlers don't need to worry about clobbering these registers.
In response to comments in D21612.
https://reviews.llvm.org/D23051
Files:
lib/xray/xray_trampoline_x86.S
Index: lib/xray/xray_trampoline_x86.S
===================================================================
--- lib/xray/xray_trampoline_x86.S
+++ lib/xray/xray_trampoline_x86.S
@@ -24,7 +24,15 @@
// Save caller provided registers before doing any actual work.
pushq %rbp
.cfi_def_cfa_offset 16
- subq $72, %rsp
+ subq $200, %rsp
+ movupd %xmm0, 184(%rsp)
+ movupd %xmm1, 168(%rsp)
+ movupd %xmm2, 152(%rsp)
+ movupd %xmm3, 136(%rsp)
+ movupd %xmm4, 120(%rsp)
+ movupd %xmm5, 104(%rsp)
+ movupd %xmm6, 88(%rsp)
+ movupd %xmm7, 72(%rsp)
movq %rdi, 64(%rsp)
movq %rax, 56(%rsp)
movq %rdx, 48(%rsp)
@@ -45,14 +53,22 @@
callq *%rax
.Ltmp0:
// restore the registers
+ movupd 184(%rsp), %xmm0
+ movupd 168(%rsp), %xmm1
+ movupd 152(%rsp), %xmm2
+ movupd 136(%rsp), %xmm3
+ movupd 120(%rsp), %xmm4
+ movupd 104(%rsp), %xmm5
+ movupd 88(%rsp) , %xmm6
+ movupd 72(%rsp) , %xmm7
movq 64(%rsp), %rdi
movq 56(%rsp), %rax
movq 48(%rsp), %rdx
movq 40(%rsp), %rsi
movq 32(%rsp), %rcx
movq 24(%rsp), %r8
movq 16(%rsp), %r9
- addq $72, %rsp
+ addq $200, %rsp
popq %rbp
retq
.Ltmp1:
@@ -67,11 +83,18 @@
// Save the important registers first. Since we're assuming that this
// function is only jumped into, we only preserve the registers for
// returning.
- // FIXME: Figure out whether this is sufficient.
pushq %rbp
.cfi_def_cfa_offset 16
- subq $24, %rsp
+ subq $152, %rsp
.cfi_def_cfa_offset 32
+ movupd %xmm0, 136(%rsp)
+ movupd %xmm1, 120(%rsp)
+ movupd %xmm2, 104(%rsp)
+ movupd %xmm3, 88(%rsp)
+ movupd %xmm4, 72(%rsp)
+ movupd %xmm5, 56(%rsp)
+ movupd %xmm6, 40(%rsp)
+ movupd %xmm7, 24(%rsp)
movq %rax, 16(%rsp)
movq %rdx, 8(%rsp)
movq _ZN6__xray19XRayPatchedFunctionE(%rip), %rax
@@ -83,6 +106,14 @@
callq *%rax
.Ltmp2:
// Restore the important registers.
+ movupd 136(%rsp), %xmm0
+ movupd 120(%rsp), %xmm1
+ movupd 104(%rsp), %xmm2
+ movupd 88(%rsp), %xmm3
+ movupd 72(%rsp), %xmm4
+ movupd 56(%rsp), %xmm5
+ movupd 40(%rsp), %xmm6
+ movupd 24(%rsp), %xmm7
movq 16(%rsp), %rax
movq 8(%rsp), %rdx
addq $24, %rsp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23051.66428.patch
Type: text/x-patch
Size: 2075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160802/bbb14a5f/attachment.bin>
More information about the llvm-commits
mailing list