Path: blob/main/contrib/llvm-project/compiler-rt/lib/xray/xray_trampoline_mips.S
35263 views
//===-- xray_trampoline_mips.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 XRay, a dynamic runtime instrumentation system.9//10// This implements the MIPS-specific assembler for the trampolines.11//12//===----------------------------------------------------------------------===//1314.text15.file "xray_trampoline_mips.S"16.globl __xray_FunctionEntry17.p2align 218.type __xray_FunctionEntry,@function19__xray_FunctionEntry:20.cfi_startproc21.set noreorder22.cpload $t923.set reorder24// Save argument registers before doing any actual work25.cfi_def_cfa_offset 3626addiu $sp, $sp, -3627sw $ra, 32($sp)28.cfi_offset 31, -429sw $a3, 28($sp)30sw $a2, 24($sp)31sw $a1, 20($sp)32sw $a0, 16($sp)33sdc1 $f14, 8($sp)34sdc1 $f12, 0($sp)3536la $t9, _ZN6__xray19XRayPatchedFunctionE37lw $t9, 0($t9)3839beqz $t9, FunctionEntry_restore4041// a1=0 means that we are tracing an entry event42move $a1, $zero43// Function ID is in t0 (the first parameter).44move $a0, $t045jalr $t94647FunctionEntry_restore:48// Restore argument registers49ldc1 $f12, 0($sp)50ldc1 $f14, 8($sp)51lw $a0, 16($sp)52lw $a1, 20($sp)53lw $a2, 24($sp)54lw $a3, 28($sp)55lw $ra, 32($sp)56addiu $sp, $sp, 3657jr $ra58FunctionEntry_end:59.size __xray_FunctionEntry, FunctionEntry_end-__xray_FunctionEntry60.cfi_endproc6162.text63.globl __xray_FunctionExit64.p2align 265.type __xray_FunctionExit,@function66__xray_FunctionExit:67.cfi_startproc68.set noreorder69.cpload $t970.set reorder71// Save return registers before doing any actual work.72.cfi_def_cfa_offset 3673addiu $sp, $sp, -3674sw $ra, 32($sp)75.cfi_offset 31, -476sw $a1, 28($sp)77sw $a0, 24($sp)78sw $v1, 20($sp)79sw $v0, 16($sp)80sdc1 $f2, 8($sp)81sdc1 $f0, 0($sp)8283la $t9, _ZN6__xray19XRayPatchedFunctionE84lw $t9, 0($t9)8586beqz $t9, FunctionExit_restore8788// a1=1 means that we are tracing an exit event89li $a1, 190// Function ID is in t0 (the first parameter).91move $a0, $t092jalr $t99394FunctionExit_restore:95// Restore return registers96ldc1 $f0, 0($sp)97ldc1 $f2, 8($sp)98lw $v0, 16($sp)99lw $v1, 20($sp)100lw $a0, 24($sp)101lw $a1, 28($sp)102lw $ra, 32($sp)103addiu $sp, $sp, 36104jr $ra105106FunctionExit_end:107.size __xray_FunctionExit, FunctionExit_end-__xray_FunctionExit108.cfi_endproc109110111