Path: blob/main/contrib/llvm-project/compiler-rt/lib/orc/sysv_reenter.arm64.S
213766 views
//===-- sysv_reenter.arm64.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 arm64-only13#if defined(__arm64__) || defined(__aarch64__)1415.text1617// Saves GPRs, calls __orc_rt_resolve18.globl __orc_rt_sysv_reenter19__orc_rt_sysv_reenter:20// Save register state, set up new stack frome.21stp x27, x28, [sp, #-16]!22stp x25, x26, [sp, #-16]!23stp x23, x24, [sp, #-16]!24stp x21, x22, [sp, #-16]!25stp x19, x20, [sp, #-16]!26stp x14, x15, [sp, #-16]!27stp x12, x13, [sp, #-16]!28stp x10, x11, [sp, #-16]!29stp x8, x9, [sp, #-16]!30stp x6, x7, [sp, #-16]!31stp x4, x5, [sp, #-16]!32stp x2, x3, [sp, #-16]!33stp x0, x1, [sp, #-16]!34stp q30, q31, [sp, #-32]!35stp q28, q29, [sp, #-32]!36stp q26, q27, [sp, #-32]!37stp q24, q25, [sp, #-32]!38stp q22, q23, [sp, #-32]!39stp q20, q21, [sp, #-32]!40stp q18, q19, [sp, #-32]!41stp q16, q17, [sp, #-32]!42stp q14, q15, [sp, #-32]!43stp q12, q13, [sp, #-32]!44stp q10, q11, [sp, #-32]!45stp q8, q9, [sp, #-32]!46stp q6, q7, [sp, #-32]!47stp q4, q5, [sp, #-32]!48stp q2, q3, [sp, #-32]!49stp q0, q1, [sp, #-32]!5051// Look up the return address and subtract 8 from it (on the assumption52// that it's a standard arm64 reentry trampoline) to get back the53// trampoline's address.54sub x0, x30, #85556// Call __orc_rt_resolve to look up the implementation corresponding to57// the calling stub, then store this in x17 (which we'll return to58// below).59#if !defined(__APPLE__)60bl __orc_rt_resolve61#else62bl ___orc_rt_resolve63#endif64mov x17, x06566// Restore the register state.67ldp q0, q1, [sp], #3268ldp q2, q3, [sp], #3269ldp q4, q5, [sp], #3270ldp q6, q7, [sp], #3271ldp q8, q9, [sp], #3272ldp q10, q11, [sp], #3273ldp q12, q13, [sp], #3274ldp q14, q15, [sp], #3275ldp q16, q17, [sp], #3276ldp q18, q19, [sp], #3277ldp q20, q21, [sp], #3278ldp q22, q23, [sp], #3279ldp q24, q25, [sp], #3280ldp q26, q27, [sp], #3281ldp q28, q29, [sp], #3282ldp q30, q31, [sp], #3283ldp x0, x1, [sp], #1684ldp x2, x3, [sp], #1685ldp x4, x5, [sp], #1686ldp x6, x7, [sp], #1687ldp x8, x9, [sp], #1688ldp x10, x11, [sp], #1689ldp x12, x13, [sp], #1690ldp x14, x15, [sp], #1691ldp x19, x20, [sp], #1692ldp x21, x22, [sp], #1693ldp x23, x24, [sp], #1694ldp x25, x26, [sp], #1695ldp x27, x28, [sp], #1696ldp x29, x30, [sp], #169798// Return to the function implementation (rather than the stub).99ret x17100101#endif // defined(__arm64__) || defined(__aarch64__)102103104