136 lines · plain
1//===-- xray_trampoline_mips64.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 XRay, a dynamic runtime instrumentation system.10//11// This implements the MIPS64-specific assembler for the trampolines.12//13//===----------------------------------------------------------------------===//14 15 .text16 .file "xray_trampoline_mips64.S"17 .globl __xray_FunctionEntry18 .p2align 219 .type __xray_FunctionEntry,@function20__xray_FunctionEntry:21 .cfi_startproc22 // Save argument registers before doing any actual work.23 .cfi_def_cfa_offset 14424 daddiu $sp, $sp, -14425 sd $ra, 136($sp)26 .cfi_offset 31, -827 sd $gp, 128($sp)28 sd $a7, 120($sp)29 sd $a6, 112($sp)30 sd $a5, 104($sp)31 sd $a4, 96($sp)32 sd $a3, 88($sp)33 sd $a2, 80($sp)34 sd $a1, 72($sp)35 sd $a0, 64($sp)36 sdc1 $f19, 56($sp)37 sdc1 $f18, 48($sp)38 sdc1 $f17, 40($sp)39 sdc1 $f16, 32($sp)40 sdc1 $f15, 24($sp)41 sdc1 $f14, 16($sp)42 sdc1 $f13, 8($sp)43 sdc1 $f12, 0($sp)44 45 lui $gp, %hi(%neg(%gp_rel(__xray_FunctionEntry)))46 daddu $gp, $gp, $t947 daddiu $gp ,$gp, %lo(%neg(%gp_rel(__xray_FunctionEntry)))48 49 dla $t9, _ZN6__xray19XRayPatchedFunctionE50 ld $t9, 0($t9)51 52 beqz $t9, FunctionEntry_restore53 54 // a1=0 means that we are tracing an entry event55 move $a1, $zero56 // Function ID is in t0 (the first parameter).57 move $a0, $t058 jalr $t959 60FunctionEntry_restore:61 // Restore argument registers62 ldc1 $f12, 0($sp)63 ldc1 $f13, 8($sp)64 ldc1 $f14, 16($sp)65 ldc1 $f15, 24($sp)66 ldc1 $f16, 32($sp)67 ldc1 $f17, 40($sp)68 ldc1 $f18, 48($sp)69 ldc1 $f19, 56($sp)70 ld $a0, 64($sp)71 ld $a1, 72($sp)72 ld $a2, 80($sp)73 ld $a3, 88($sp)74 ld $a4, 96($sp)75 ld $a5, 104($sp)76 ld $a6, 112($sp)77 ld $a7, 120($sp)78 ld $gp, 128($sp)79 ld $ra, 136($sp)80 daddiu $sp, $sp, 14481 jr $ra82FunctionEntry_end:83 .size __xray_FunctionEntry, FunctionEntry_end-__xray_FunctionEntry84 .cfi_endproc85 86 .text87 .globl __xray_FunctionExit88 .p2align 289 .type __xray_FunctionExit,@function90__xray_FunctionExit:91 .cfi_startproc92 // Save return registers before doing any actual work.93 .cfi_def_cfa_offset 6494 daddiu $sp, $sp, -6495 sd $ra, 56($sp)96 .cfi_offset 31, -897 sd $gp, 48($sp)98 sd $a0, 40($sp)99 sd $v1, 32($sp)100 sd $v0, 24($sp)101 sdc1 $f2, 16($sp)102 sdc1 $f1, 8($sp)103 sdc1 $f0, 0($sp)104 105 lui $gp, %hi(%neg(%gp_rel(__xray_FunctionExit)))106 daddu $gp, $gp, $t9107 daddiu $gp ,$gp, %lo(%neg(%gp_rel(__xray_FunctionExit)))108 109 dla $t9, _ZN6__xray19XRayPatchedFunctionE110 ld $t9, 0($t9)111 112 beqz $t9, FunctionExit_restore113 114 // a1=1 means that we are tracing an exit event115 li $a1, 1116 // Function ID is in t0 (the first parameter).117 move $a0, $t0118 jalr $t9119 120FunctionExit_restore:121 // Restore return registers122 ldc1 $f0, 0($sp)123 ldc1 $f1, 8($sp)124 ldc1 $f2, 16($sp)125 ld $v0, 24($sp)126 ld $v1, 32($sp)127 ld $a0, 40($sp)128 ld $gp, 48($sp)129 ld $ra, 56($sp)130 daddiu $sp, $sp, 64131 jr $ra132 133FunctionExit_end:134 .size __xray_FunctionExit, FunctionExit_end-__xray_FunctionExit135 .cfi_endproc136