s390: generate register offsets into pt_regs automatically
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 23 May 2022 12:42:40 +0000 (14:42 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Wed, 25 May 2022 09:46:02 +0000 (11:46 +0200)
Use asm offsets method to generate register offsets into pt_regs,
instead of open-coding at several places.

Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/kernel/asm-offsets.c
arch/s390/kernel/earlypgm.S
arch/s390/kernel/entry.S

index 7c74f0e..1e37cad 100644 (file)
@@ -32,6 +32,22 @@ int main(void)
        /* pt_regs offsets */
        OFFSET(__PT_PSW, pt_regs, psw);
        OFFSET(__PT_GPRS, pt_regs, gprs);
+       OFFSET(__PT_R0, pt_regs, gprs[0]);
+       OFFSET(__PT_R1, pt_regs, gprs[1]);
+       OFFSET(__PT_R2, pt_regs, gprs[2]);
+       OFFSET(__PT_R3, pt_regs, gprs[3]);
+       OFFSET(__PT_R4, pt_regs, gprs[4]);
+       OFFSET(__PT_R5, pt_regs, gprs[5]);
+       OFFSET(__PT_R6, pt_regs, gprs[6]);
+       OFFSET(__PT_R7, pt_regs, gprs[7]);
+       OFFSET(__PT_R8, pt_regs, gprs[8]);
+       OFFSET(__PT_R9, pt_regs, gprs[9]);
+       OFFSET(__PT_R10, pt_regs, gprs[10]);
+       OFFSET(__PT_R11, pt_regs, gprs[11]);
+       OFFSET(__PT_R12, pt_regs, gprs[12]);
+       OFFSET(__PT_R13, pt_regs, gprs[13]);
+       OFFSET(__PT_R14, pt_regs, gprs[14]);
+       OFFSET(__PT_R15, pt_regs, gprs[15]);
        OFFSET(__PT_ORIG_GPR2, pt_regs, orig_gpr2);
        OFFSET(__PT_FLAGS, pt_regs, flags);
        OFFSET(__PT_CR1, pt_regs, cr1);
index fbc7d2d..f521c6d 100644 (file)
@@ -7,9 +7,6 @@
 #include <linux/linkage.h>
 #include <asm/asm-offsets.h>
 
-__PT_R0 = __PT_GPRS
-__PT_R8 = __PT_GPRS + 64
-
 ENTRY(early_pgm_check_handler)
        stmg    %r8,%r15,__LC_SAVE_AREA_SYNC
        aghi    %r15,-(STACK_FRAME_OVERHEAD+__PT_SIZE)
index df41132..82faf4d 100644 (file)
 #include <asm/export.h>
 #include <asm/nospec-insn.h>
 
-__PT_R0      = __PT_GPRS
-__PT_R1      = __PT_GPRS + 8
-__PT_R2      = __PT_GPRS + 16
-__PT_R3      = __PT_GPRS + 24
-__PT_R4      = __PT_GPRS + 32
-__PT_R5      = __PT_GPRS + 40
-__PT_R6      = __PT_GPRS + 48
-__PT_R7      = __PT_GPRS + 56
-__PT_R8      = __PT_GPRS + 64
-__PT_R9      = __PT_GPRS + 72
-__PT_R10     = __PT_GPRS + 80
-__PT_R11     = __PT_GPRS + 88
-__PT_R12     = __PT_GPRS + 96
-__PT_R13     = __PT_GPRS + 104
-__PT_R14     = __PT_GPRS + 112
-__PT_R15     = __PT_GPRS + 120
-
 STACK_SHIFT = PAGE_SHIFT + THREAD_SIZE_ORDER
 STACK_SIZE  = 1 << STACK_SHIFT
 STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE