brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · 61e58e5 Raw
105 lines · plain
1//===-- sysv_reenter.arm64.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 arm64-only14#if defined(__arm64__) || defined(__aarch64__)15 16#include "builtins/assembly.h"17 18        TEXT_SECTION19 20        // Saves GPRs, calls __orc_rt_resolve21        .globl __orc_rt_sysv_reenter22__orc_rt_sysv_reenter:23        // Save register state, set up new stack frome.24        stp  x27, x28, [sp, #-16]!25        stp  x25, x26, [sp, #-16]!26        stp  x23, x24, [sp, #-16]!27        stp  x21, x22, [sp, #-16]!28        stp  x19, x20, [sp, #-16]!29        stp  x14, x15, [sp, #-16]!30        stp  x12, x13, [sp, #-16]!31        stp  x10, x11, [sp, #-16]!32        stp   x8,  x9, [sp, #-16]!33        stp   x6,  x7, [sp, #-16]!34        stp   x4,  x5, [sp, #-16]!35        stp   x2,  x3, [sp, #-16]!36        stp   x0,  x1, [sp, #-16]!37        stp  q30, q31, [sp, #-32]!38        stp  q28, q29, [sp, #-32]!39        stp  q26, q27, [sp, #-32]!40        stp  q24, q25, [sp, #-32]!41        stp  q22, q23, [sp, #-32]!42        stp  q20, q21, [sp, #-32]!43        stp  q18, q19, [sp, #-32]!44        stp  q16, q17, [sp, #-32]!45        stp  q14, q15, [sp, #-32]!46        stp  q12, q13, [sp, #-32]!47        stp  q10, q11, [sp, #-32]!48        stp   q8,  q9, [sp, #-32]!49        stp   q6,  q7, [sp, #-32]!50        stp   q4,  q5, [sp, #-32]!51        stp   q2,  q3, [sp, #-32]!52        stp   q0,  q1, [sp, #-32]!53 54        // Look up the return address and subtract 8 from it (on the assumption55        // that it's a standard arm64 reentry trampoline) to get back the56	// trampoline's address.57        sub   x0, x30, #858 59        // Call __orc_rt_resolve to look up the implementation corresponding to60        // the calling stub, then store this in x17 (which we'll return to61	// below).62#if !defined(__APPLE__)63        bl    __orc_rt_resolve64#else65        bl    ___orc_rt_resolve66#endif67        mov   x17, x068 69        // Restore the register state.70        ldp   q0,  q1, [sp], #3271        ldp   q2,  q3, [sp], #3272        ldp   q4,  q5, [sp], #3273        ldp   q6,  q7, [sp], #3274        ldp   q8,  q9, [sp], #3275        ldp  q10, q11, [sp], #3276        ldp  q12, q13, [sp], #3277        ldp  q14, q15, [sp], #3278        ldp  q16, q17, [sp], #3279        ldp  q18, q19, [sp], #3280        ldp  q20, q21, [sp], #3281        ldp  q22, q23, [sp], #3282        ldp  q24, q25, [sp], #3283        ldp  q26, q27, [sp], #3284        ldp  q28, q29, [sp], #3285        ldp  q30, q31, [sp], #3286        ldp   x0,  x1, [sp], #1687        ldp   x2,  x3, [sp], #1688        ldp   x4,  x5, [sp], #1689        ldp   x6,  x7, [sp], #1690        ldp   x8,  x9, [sp], #1691        ldp  x10, x11, [sp], #1692        ldp  x12, x13, [sp], #1693        ldp  x14, x15, [sp], #1694        ldp  x19, x20, [sp], #1695        ldp  x21, x22, [sp], #1696        ldp  x23, x24, [sp], #1697        ldp  x25, x26, [sp], #1698        ldp  x27, x28, [sp], #1699        ldp  x29, x30, [sp], #16100 101        // Return to the function implementation (rather than the stub).102        ret  x17103 104#endif // defined(__arm64__) || defined(__aarch64__)105