1 //===-- xray_trampoline_x86.s -----------------------------------*- ASM -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file is a part of XRay, a dynamic runtime instrumentation system.
12 // This implements the X86-specific assembler for the trampolines.
14 //===----------------------------------------------------------------------===//
18 movupd %xmm0, 184(%rsp)
19 movupd %xmm1, 168(%rsp)
20 movupd %xmm2, 152(%rsp)
21 movupd %xmm3, 136(%rsp)
22 movupd %xmm4, 120(%rsp)
23 movupd %xmm5, 104(%rsp)
24 movupd %xmm6, 88(%rsp)
25 movupd %xmm7, 72(%rsp)
35 .macro RESTORE_REGISTERS
36 movupd 184(%rsp), %xmm0
37 movupd 168(%rsp), %xmm1
38 movupd 152(%rsp), %xmm2
39 movupd 136(%rsp), %xmm3
40 movupd 120(%rsp), %xmm4
41 movupd 104(%rsp), %xmm5
42 movupd 88(%rsp) , %xmm6
43 movupd 72(%rsp) , %xmm7
55 .file "xray_trampoline_x86.S"
56 .globl __xray_FunctionEntry
58 .type __xray_FunctionEntry,@function
63 .cfi_def_cfa_offset 16
66 // This load has to be atomic, it's concurrent with __xray_patch().
67 // On x86/amd64, a simple (type-aligned) MOV instruction is enough.
68 movq _ZN6__xray19XRayPatchedFunctionE(%rip), %rax
72 // The patched function prolog puts its xray_instr_map index into %r10d.
81 .size __xray_FunctionEntry, .Ltmp1-__xray_FunctionEntry
84 .globl __xray_FunctionExit
86 .type __xray_FunctionExit,@function
89 // Save the important registers first. Since we're assuming that this
90 // function is only jumped into, we only preserve the registers for
93 .cfi_def_cfa_offset 16
95 .cfi_def_cfa_offset 32
96 movupd %xmm0, 40(%rsp)
97 movupd %xmm1, 24(%rsp)
100 movq _ZN6__xray19XRayPatchedFunctionE(%rip), %rax
108 // Restore the important registers.
109 movupd 40(%rsp), %xmm0
110 movupd 24(%rsp), %xmm1
117 .size __xray_FunctionExit, .Ltmp3-__xray_FunctionExit
120 .global __xray_FunctionTailExit
122 .type __xray_FunctionTailExit,@function
123 __xray_FunctionTailExit:
125 // Save the important registers as in the entry trampoline, but indicate that
126 // this is an exit. In the future, we will introduce a new entry type that
127 // differentiates between a normal exit and a tail exit, but we'd have to do
128 // this and increment the version number for the header.
130 .cfi_def_cfa_offset 16
133 movq _ZN6__xray19XRayPatchedFunctionE(%rip), %rax
146 .size __xray_FunctionTailExit, .Ltmp5-__xray_FunctionTailExit