1#include <linux/linkage.h> 2 3#define R0 0x00 4#define R1 0x08 5#define R2 0x10 6#define R3 0x18 7#define R4 0x20 8#define R5 0x28 9#define R6 0x30 10#define R7 0x38 11#define R8 0x40 12#define R9 0x48 13#define SL 0x50 14#define FP 0x58 15#define IP 0x60 16#define SP 0x68 17#define LR 0x70 18#define PC 0x78 19 20/* 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 function 26 * 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 dwarf 28 * information in unwind__get_entries. 29 * 30 * Notes: 31 * - the 8 bytes stride in the registers offsets comes from the fact 32 * 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 */ 36 37.text 38.type perf_regs_load,%function 39ENTRY(perf_regs_load) 40 str r0, [r0, #R0] 41 str r1, [r0, #R1] 42 str r2, [r0, #R2] 43 str r3, [r0, #R3] 44 str r4, [r0, #R4] 45 str r5, [r0, #R5] 46 str r6, [r0, #R6] 47 str r7, [r0, #R7] 48 str r8, [r0, #R8] 49 str r9, [r0, #R9] 50 str sl, [r0, #SL] 51 str fp, [r0, #FP] 52 str ip, [r0, #IP] 53 str sp, [r0, #SP] 54 str lr, [r0, #LR] 55 str lr, [r0, #PC] // store pc as lr in order to skip the call 56 // to this function 57 mov pc, lr 58ENDPROC(perf_regs_load) 59