Path: blob/main/contrib/llvm-project/compiler-rt/lib/xray/xray_trampoline_mips64.S
35264 views
//===-- xray_trampoline_mips64.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 MIPS64-specific assembler for the trampolines.11//12//===----------------------------------------------------------------------===//1314.text15.file "xray_trampoline_mips64.S"16.globl __xray_FunctionEntry17.p2align 218.type __xray_FunctionEntry,@function19__xray_FunctionEntry:20.cfi_startproc21// Save argument registers before doing any actual work.22.cfi_def_cfa_offset 14423daddiu $sp, $sp, -14424sd $ra, 136($sp)25.cfi_offset 31, -826sd $gp, 128($sp)27sd $a7, 120($sp)28sd $a6, 112($sp)29sd $a5, 104($sp)30sd $a4, 96($sp)31sd $a3, 88($sp)32sd $a2, 80($sp)33sd $a1, 72($sp)34sd $a0, 64($sp)35sdc1 $f19, 56($sp)36sdc1 $f18, 48($sp)37sdc1 $f17, 40($sp)38sdc1 $f16, 32($sp)39sdc1 $f15, 24($sp)40sdc1 $f14, 16($sp)41sdc1 $f13, 8($sp)42sdc1 $f12, 0($sp)4344lui $gp, %hi(%neg(%gp_rel(__xray_FunctionEntry)))45daddu $gp, $gp, $t946daddiu $gp ,$gp, %lo(%neg(%gp_rel(__xray_FunctionEntry)))4748dla $t9, _ZN6__xray19XRayPatchedFunctionE49ld $t9, 0($t9)5051beqz $t9, FunctionEntry_restore5253// a1=0 means that we are tracing an entry event54move $a1, $zero55// Function ID is in t0 (the first parameter).56move $a0, $t057jalr $t95859FunctionEntry_restore:60// Restore argument registers61ldc1 $f12, 0($sp)62ldc1 $f13, 8($sp)63ldc1 $f14, 16($sp)64ldc1 $f15, 24($sp)65ldc1 $f16, 32($sp)66ldc1 $f17, 40($sp)67ldc1 $f18, 48($sp)68ldc1 $f19, 56($sp)69ld $a0, 64($sp)70ld $a1, 72($sp)71ld $a2, 80($sp)72ld $a3, 88($sp)73ld $a4, 96($sp)74ld $a5, 104($sp)75ld $a6, 112($sp)76ld $a7, 120($sp)77ld $gp, 128($sp)78ld $ra, 136($sp)79daddiu $sp, $sp, 14480jr $ra81FunctionEntry_end:82.size __xray_FunctionEntry, FunctionEntry_end-__xray_FunctionEntry83.cfi_endproc8485.text86.globl __xray_FunctionExit87.p2align 288.type __xray_FunctionExit,@function89__xray_FunctionExit:90.cfi_startproc91// Save return registers before doing any actual work.92.cfi_def_cfa_offset 6493daddiu $sp, $sp, -6494sd $ra, 56($sp)95.cfi_offset 31, -896sd $gp, 48($sp)97sd $a0, 40($sp)98sd $v1, 32($sp)99sd $v0, 24($sp)100sdc1 $f2, 16($sp)101sdc1 $f1, 8($sp)102sdc1 $f0, 0($sp)103104lui $gp, %hi(%neg(%gp_rel(__xray_FunctionExit)))105daddu $gp, $gp, $t9106daddiu $gp ,$gp, %lo(%neg(%gp_rel(__xray_FunctionExit)))107108dla $t9, _ZN6__xray19XRayPatchedFunctionE109ld $t9, 0($t9)110111beqz $t9, FunctionExit_restore112113// a1=1 means that we are tracing an exit event114li $a1, 1115// Function ID is in t0 (the first parameter).116move $a0, $t0117jalr $t9118119FunctionExit_restore:120// Restore return registers121ldc1 $f0, 0($sp)122ldc1 $f1, 8($sp)123ldc1 $f2, 16($sp)124ld $v0, 24($sp)125ld $v1, 32($sp)126ld $a0, 40($sp)127ld $gp, 48($sp)128ld $ra, 56($sp)129daddiu $sp, $sp, 64130jr $ra131132FunctionExit_end:133.size __xray_FunctionExit, FunctionExit_end-__xray_FunctionExit134.cfi_endproc135136137