cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

regs_load.S (1560B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#include <linux/linkage.h>
      3
      4/* Offset is based on macros from arch/powerpc/include/uapi/asm/ptrace.h. */
      5#define R0	 0
      6#define R1	 1 * 8
      7#define R2	 2 * 8
      8#define R3	 3 * 8
      9#define R4	 4 * 8
     10#define R5	 5 * 8
     11#define R6	 6 * 8
     12#define R7	 7 * 8
     13#define R8	 8 * 8
     14#define R9	 9 * 8
     15#define R10	10 * 8
     16#define R11	11 * 8
     17#define R12	12 * 8
     18#define R13	13 * 8
     19#define R14	14 * 8
     20#define R15	15 * 8
     21#define R16	16 * 8
     22#define R17	17 * 8
     23#define R18	18 * 8
     24#define R19	19 * 8
     25#define R20	20 * 8
     26#define R21	21 * 8
     27#define R22	22 * 8
     28#define R23	23 * 8
     29#define R24	24 * 8
     30#define R25	25 * 8
     31#define R26	26 * 8
     32#define R27	27 * 8
     33#define R28	28 * 8
     34#define R29	29 * 8
     35#define R30	30 * 8
     36#define R31	31 * 8
     37#define NIP	32 * 8
     38#define CTR	35 * 8
     39#define LINK	36 * 8
     40#define XER	37 * 8
     41
     42.globl perf_regs_load
     43perf_regs_load:
     44	std 0, R0(3)
     45	std 1, R1(3)
     46	std 2, R2(3)
     47	std 3, R3(3)
     48	std 4, R4(3)
     49	std 5, R5(3)
     50	std 6, R6(3)
     51	std 7, R7(3)
     52	std 8, R8(3)
     53	std 9, R9(3)
     54	std 10, R10(3)
     55	std 11, R11(3)
     56	std 12, R12(3)
     57	std 13, R13(3)
     58	std 14, R14(3)
     59	std 15, R15(3)
     60	std 16, R16(3)
     61	std 17, R17(3)
     62	std 18, R18(3)
     63	std 19, R19(3)
     64	std 20, R20(3)
     65	std 21, R21(3)
     66	std 22, R22(3)
     67	std 23, R23(3)
     68	std 24, R24(3)
     69	std 25, R25(3)
     70	std 26, R26(3)
     71	std 27, R27(3)
     72	std 28, R28(3)
     73	std 29, R29(3)
     74	std 30, R30(3)
     75	std 31, R31(3)
     76
     77	/* store NIP */
     78	mflr 4
     79	std 4, NIP(3)
     80
     81	/* Store LR */
     82	std 4, LINK(3)
     83
     84	/* Store XER */
     85	mfxer 4
     86	std 4, XER(3)
     87
     88	/* Store CTR */
     89	mfctr 4
     90	std 4, CTR(3)
     91
     92	/* Restore original value of r4 */
     93	ld 4, R4(3)
     94
     95	blr