Path: blob/master/tools/perf/arch/arm/tests/regs_load.S
26296 views
/* SPDX-License-Identifier: GPL-2.0 */1#include <linux/linkage.h>23#define R0 0x004#define R1 0x085#define R2 0x106#define R3 0x187#define R4 0x208#define R5 0x289#define R6 0x3010#define R7 0x3811#define R8 0x4012#define R9 0x4813#define SL 0x5014#define FP 0x5815#define IP 0x6016#define SP 0x6817#define LR 0x7018#define PC 0x781920/*21* Implementation of void perf_regs_load(u64 *regs);22*23* This functions fills in the 'regs' buffer from the actual registers values,24* in the way the perf built-in unwinding test expects them:25* - the PC at the time at the call to this function. Since this function26* is called using a bl instruction, the PC value is taken from LR.27* The built-in unwinding test then unwinds the call stack from the dwarf28* information in unwind__get_entries.29*30* Notes:31* - the 8 bytes stride in the registers offsets comes from the fact32* that the registers are stored in an u64 array (u64 *regs),33* - the regs buffer needs to be zeroed before the call to this function,34* in this case using a calloc in dwarf-unwind.c.35*/3637.text38.type perf_regs_load,%function39SYM_FUNC_START(perf_regs_load)40str r0, [r0, #R0]41str r1, [r0, #R1]42str r2, [r0, #R2]43str r3, [r0, #R3]44str r4, [r0, #R4]45str r5, [r0, #R5]46str r6, [r0, #R6]47str r7, [r0, #R7]48str r8, [r0, #R8]49str r9, [r0, #R9]50str sl, [r0, #SL]51str fp, [r0, #FP]52str ip, [r0, #IP]53str sp, [r0, #SP]54str lr, [r0, #LR]55str lr, [r0, #PC] // store pc as lr in order to skip the call56// to this function57mov pc, lr58SYM_FUNC_END(perf_regs_load)596061