brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · 99615c0 Raw
83 lines · plain
1//===-- orc_rt_macho_tlv.x86-64.s -------------------------------*- ASM -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9// This file is a part of the ORC runtime support library.10//11//===----------------------------------------------------------------------===//12 13// The content of this file is x86_64-only14#if defined(__x86_64__)15.att_syntax16 17// Save all GRPS except %rsp.18// This value is also subtracted from %rsp below, despite the fact that %rbp19// has already been pushed, because we need %rsp to stay 16-byte aligned.20#define GPR_SAVE_SPACE_SIZE             15 * 821#define FXSAVE64_SAVE_SPACE_SIZE        51222#define REGISTER_SAVE_SPACE_SIZE        \23        GPR_SAVE_SPACE_SIZE + FXSAVE64_SAVE_SPACE_SIZE24 25        .text26 27        // returns address of TLV in %rax, all other registers preserved28        .globl __orc_rt_sysv_reenter29__orc_rt_sysv_reenter:30        pushq           %rbp31        movq            %rsp,        %rbp32        subq            $REGISTER_SAVE_SPACE_SIZE, %rsp33        movq            %rax,     -8(%rbp)34        movq            %rbx,    -16(%rbp)35        movq            %rcx,    -24(%rbp)36        movq            %rdx,    -32(%rbp)37        movq            %rsi,    -40(%rbp)38        movq            %rdi,    -48(%rbp)39        movq            %r8,     -56(%rbp)40        movq            %r9,     -64(%rbp)41        movq            %r10,    -72(%rbp)42        movq            %r11,    -80(%rbp)43        movq            %r12,    -88(%rbp)44        movq            %r13,    -96(%rbp)45        movq            %r14,   -104(%rbp)46        movq            %r15,   -112(%rbp)47        fxsave64        (%rsp)48        movq            8(%rbp), %rdi49 50        // Load return address and subtract five from it (on the assumption51        // that it's a call instruction).52        subq            $5, %rdi53 54        // Call __orc_rt_resolve to look up the implementation corresponding to55        // the calling stub, then store this in x17 (which we'll return to56        // below).57#if !defined(__APPLE__)58        call            __orc_rt_resolve59#else60        call            ___orc_rt_resolve61#endif62        movq            %rax,   8(%rbp)63        fxrstor64       (%rsp)64        movq            -112(%rbp),     %r1565        movq            -104(%rbp),     %r1466        movq            -96(%rbp),      %r1367        movq            -88(%rbp),      %r1268        movq            -80(%rbp),      %r1169        movq            -72(%rbp),      %r1070        movq            -64(%rbp),      %r971        movq            -56(%rbp),      %r872        movq            -48(%rbp),      %rdi73        movq            -40(%rbp),      %rsi74        movq            -32(%rbp),      %rdx75        movq            -24(%rbp),      %rcx76        movq            -16(%rbp),      %rbx77        movq            -8(%rbp),       %rax78        addq            $REGISTER_SAVE_SPACE_SIZE, %rsp79        popq            %rbp80        ret81 82#endif // defined(__x86_64__)83