110 lines · plain
1//===-- xray_trampoline_mips.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 MIPS-specific assembler for the trampolines.12//13//===----------------------------------------------------------------------===//14 15 .text16 .file "xray_trampoline_mips.S"17 .globl __xray_FunctionEntry18 .p2align 219 .type __xray_FunctionEntry,@function20__xray_FunctionEntry:21 .cfi_startproc22 .set noreorder23 .cpload $t924 .set reorder25 // Save argument registers before doing any actual work26 .cfi_def_cfa_offset 3627 addiu $sp, $sp, -3628 sw $ra, 32($sp)29 .cfi_offset 31, -430 sw $a3, 28($sp)31 sw $a2, 24($sp)32 sw $a1, 20($sp)33 sw $a0, 16($sp)34 sdc1 $f14, 8($sp)35 sdc1 $f12, 0($sp)36 37 la $t9, _ZN6__xray19XRayPatchedFunctionE38 lw $t9, 0($t9)39 40 beqz $t9, FunctionEntry_restore41 42 // a1=0 means that we are tracing an entry event43 move $a1, $zero44 // Function ID is in t0 (the first parameter).45 move $a0, $t046 jalr $t947 48FunctionEntry_restore:49 // Restore argument registers50 ldc1 $f12, 0($sp)51 ldc1 $f14, 8($sp)52 lw $a0, 16($sp)53 lw $a1, 20($sp)54 lw $a2, 24($sp)55 lw $a3, 28($sp)56 lw $ra, 32($sp)57 addiu $sp, $sp, 3658 jr $ra59FunctionEntry_end:60 .size __xray_FunctionEntry, FunctionEntry_end-__xray_FunctionEntry61 .cfi_endproc62 63 .text64 .globl __xray_FunctionExit65 .p2align 266 .type __xray_FunctionExit,@function67__xray_FunctionExit:68 .cfi_startproc69 .set noreorder70 .cpload $t971 .set reorder72 // Save return registers before doing any actual work.73 .cfi_def_cfa_offset 3674 addiu $sp, $sp, -3675 sw $ra, 32($sp)76 .cfi_offset 31, -477 sw $a1, 28($sp)78 sw $a0, 24($sp)79 sw $v1, 20($sp)80 sw $v0, 16($sp)81 sdc1 $f2, 8($sp)82 sdc1 $f0, 0($sp)83 84 la $t9, _ZN6__xray19XRayPatchedFunctionE85 lw $t9, 0($t9)86 87 beqz $t9, FunctionExit_restore88 89 // a1=1 means that we are tracing an exit event90 li $a1, 191 // Function ID is in t0 (the first parameter).92 move $a0, $t093 jalr $t994 95FunctionExit_restore:96 // Restore return registers97 ldc1 $f0, 0($sp)98 ldc1 $f2, 8($sp)99 lw $v0, 16($sp)100 lw $v1, 20($sp)101 lw $a0, 24($sp)102 lw $a1, 28($sp)103 lw $ra, 32($sp)104 addiu $sp, $sp, 36105 jr $ra106 107FunctionExit_end:108 .size __xray_FunctionExit, FunctionExit_end-__xray_FunctionExit109 .cfi_endproc110