Path: blob/main/contrib/llvm-project/compiler-rt/lib/orc/sysv_reenter.x86-64.S
213766 views
//===-- orc_rt_macho_tlv.x86-64.s -------------------------------*- ASM -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file is a part of the ORC runtime support library.9//10//===----------------------------------------------------------------------===//1112// The content of this file is x86_64-only13#if defined(__x86_64__)1415// Save all GRPS except %rsp.16// This value is also subtracted from %rsp below, despite the fact that %rbp17// has already been pushed, because we need %rsp to stay 16-byte aligned.18#define GPR_SAVE_SPACE_SIZE 15 * 819#define FXSAVE64_SAVE_SPACE_SIZE 51220#define REGISTER_SAVE_SPACE_SIZE \21GPR_SAVE_SPACE_SIZE + FXSAVE64_SAVE_SPACE_SIZE2223.text2425// returns address of TLV in %rax, all other registers preserved26.globl __orc_rt_sysv_reenter27__orc_rt_sysv_reenter:28pushq %rbp29movq %rsp, %rbp30subq $REGISTER_SAVE_SPACE_SIZE, %rsp31movq %rax, -8(%rbp)32movq %rbx, -16(%rbp)33movq %rcx, -24(%rbp)34movq %rdx, -32(%rbp)35movq %rsi, -40(%rbp)36movq %rdi, -48(%rbp)37movq %r8, -56(%rbp)38movq %r9, -64(%rbp)39movq %r10, -72(%rbp)40movq %r11, -80(%rbp)41movq %r12, -88(%rbp)42movq %r13, -96(%rbp)43movq %r14, -104(%rbp)44movq %r15, -112(%rbp)45fxsave64 (%rsp)46movq 8(%rbp), %rdi4748// Load return address and subtract five from it (on the assumption49// that it's a call instruction).50subq $5, %rdi5152// Call __orc_rt_resolve to look up the implementation corresponding to53// the calling stub, then store this in x17 (which we'll return to54// below).55#if !defined(__APPLE__)56call __orc_rt_resolve57#else58call ___orc_rt_resolve59#endif60movq %rax, 8(%rbp)61fxrstor64 (%rsp)62movq -112(%rbp), %r1563movq -104(%rbp), %r1464movq -96(%rbp), %r1365movq -88(%rbp), %r1266movq -80(%rbp), %r1167movq -72(%rbp), %r1068movq -64(%rbp), %r969movq -56(%rbp), %r870movq -48(%rbp), %rdi71movq -40(%rbp), %rsi72movq -32(%rbp), %rdx73movq -24(%rbp), %rcx74movq -16(%rbp), %rbx75movq -8(%rbp), %rax76addq $REGISTER_SAVE_SPACE_SIZE, %rsp77popq %rbp78ret7980#endif // defined(__x86_64__)818283