s390/traps: get rid of magic cast for program interruption code
authorHeiko Carstens <hca@linux.ibm.com>
Sun, 6 Mar 2022 10:15:27 +0000 (11:15 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Mon, 7 Mar 2022 23:33:01 +0000 (00:33 +0100)
Add a proper union in lowcore to reflect architecture and get rid of a
"magic" cast in order to read the full program interruption code.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/lowcore.h
arch/s390/kernel/traps.c

index 1262f50..28a2c6b 100644 (file)
@@ -34,8 +34,13 @@ struct lowcore {
                __u32 ext_int_code_addr;
        };
        __u32   svc_int_code;                   /* 0x0088 */
-       __u16   pgm_ilc;                        /* 0x008c */
-       __u16   pgm_code;                       /* 0x008e */
+       union {
+               struct {
+                       __u16   pgm_ilc;        /* 0x008c */
+                       __u16   pgm_code;       /* 0x008e */
+               };
+               __u32 pgm_int_code;
+       };
        __u32   data_exc_code;                  /* 0x0090 */
        __u16   mon_class_num;                  /* 0x0094 */
        __u8    per_code;                       /* 0x0096 */
index 7f0fadd..a3c94df 100644 (file)
@@ -297,7 +297,7 @@ void noinstr __do_pgm_check(struct pt_regs *regs)
        unsigned int trapnr;
        irqentry_state_t state;
 
-       regs->int_code = *(u32 *)&S390_lowcore.pgm_ilc;
+       regs->int_code = S390_lowcore.pgm_int_code;
        regs->int_parm_long = S390_lowcore.trans_exc_code;
 
        state = irqentry_enter(regs);