xref: /freebsd/contrib/llvm-project/compiler-rt/lib/orc/elfnix_tls.x86-64.S (revision 349cc55c9796c4596a5b9904cd3281af295f878f)
1*349cc55cSDimitry Andric
2*349cc55cSDimitry Andric//===-- orc_rt_elfnix_tls_x86-64.s -------------------------------*- ASM -*-===//
3*349cc55cSDimitry Andric//
4*349cc55cSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*349cc55cSDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
6*349cc55cSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*349cc55cSDimitry Andric//
8*349cc55cSDimitry Andric//===----------------------------------------------------------------------===//
9*349cc55cSDimitry Andric//
10*349cc55cSDimitry Andric// This file is a part of the ORC runtime support library.
11*349cc55cSDimitry Andric//
12*349cc55cSDimitry Andric//===----------------------------------------------------------------------===//
13*349cc55cSDimitry Andric
14*349cc55cSDimitry Andric// The content of this file is x86_64-only
15*349cc55cSDimitry Andric#if defined(__x86_64__)
16*349cc55cSDimitry Andric
17*349cc55cSDimitry Andric#define REGISTER_SAVE_SPACE_SIZE        512
18*349cc55cSDimitry Andric
19*349cc55cSDimitry Andric        .text
20*349cc55cSDimitry Andric
21*349cc55cSDimitry Andric	// returns address of TLV in %rax, all other registers preserved
22*349cc55cSDimitry Andric	.globl ___orc_rt_elfnix_tls_get_addr
23*349cc55cSDimitry Andric___orc_rt_elfnix_tls_get_addr:
24*349cc55cSDimitry Andric        pushq           %rbp
25*349cc55cSDimitry Andric        movq            %rsp,        %rbp
26*349cc55cSDimitry Andric        subq            $REGISTER_SAVE_SPACE_SIZE, %rsp
27*349cc55cSDimitry Andric        movq            %rcx,    -16(%rbp)
28*349cc55cSDimitry Andric        movq            %rdx,    -24(%rbp)
29*349cc55cSDimitry Andric        movq            %rsi,    -32(%rbp)
30*349cc55cSDimitry Andric        movq            %rdi,    -40(%rbp)
31*349cc55cSDimitry Andric        movq            %r8,     -48(%rbp)
32*349cc55cSDimitry Andric        movq            %r9,     -56(%rbp)
33*349cc55cSDimitry Andric        movq            %r10,    -64(%rbp)
34*349cc55cSDimitry Andric        movq            %r11,    -72(%rbp)
35*349cc55cSDimitry Andric	movdqa          %xmm0,  -128(%rbp)
36*349cc55cSDimitry Andric	movdqa          %xmm1,  -144(%rbp)
37*349cc55cSDimitry Andric	movdqa          %xmm2,  -160(%rbp)
38*349cc55cSDimitry Andric	movdqa          %xmm3,  -176(%rbp)
39*349cc55cSDimitry Andric	movdqa          %xmm4,  -192(%rbp)
40*349cc55cSDimitry Andric	movdqa          %xmm5,  -208(%rbp)
41*349cc55cSDimitry Andric	movdqa          %xmm6,  -224(%rbp)
42*349cc55cSDimitry Andric	movdqa          %xmm7,  -240(%rbp)
43*349cc55cSDimitry Andric        call           __orc_rt_elfnix_tls_get_addr_impl
44*349cc55cSDimitry Andric        movq            -16(%rbp),      %rcx
45*349cc55cSDimitry Andric        movq            -24(%rbp),      %rdx
46*349cc55cSDimitry Andric        movq            -32(%rbp),      %rsi
47*349cc55cSDimitry Andric        movq            -40(%rbp),      %rdi
48*349cc55cSDimitry Andric        movq            -48(%rbp),      %r8
49*349cc55cSDimitry Andric        movq            -56(%rbp),      %r9
50*349cc55cSDimitry Andric        movq            -64(%rbp),      %r10
51*349cc55cSDimitry Andric        movq            -72(%rbp),      %r11
52*349cc55cSDimitry Andric  movdqa          -128(%rbp),     %xmm0
53*349cc55cSDimitry Andric	movdqa          -144(%rbp),     %xmm1
54*349cc55cSDimitry Andric	movdqa          -160(%rbp),     %xmm2
55*349cc55cSDimitry Andric	movdqa          -176(%rbp),     %xmm3
56*349cc55cSDimitry Andric	movdqa          -192(%rbp),     %xmm4
57*349cc55cSDimitry Andric	movdqa          -208(%rbp),     %xmm5
58*349cc55cSDimitry Andric	movdqa          -224(%rbp),     %xmm6
59*349cc55cSDimitry Andric	movdqa          -240(%rbp),     %xmm7
60*349cc55cSDimitry Andric        addq            $REGISTER_SAVE_SPACE_SIZE, %rsp
61*349cc55cSDimitry Andric        popq            %rbp
62*349cc55cSDimitry Andric        ret
63*349cc55cSDimitry Andric
64*349cc55cSDimitry Andric#endif // defined(__x86_64__)
65