Skip to content

Commit 998e780

Browse files
hcahcaVasily Gorbik
authored andcommitted
s390/traps: get rid of magic cast for per code
Add a proper union in lowcore to reflect architecture and get rid of a "magic" cast in order to read the full per code. Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent 52b739e commit 998e780

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

arch/s390/include/asm/lowcore.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,13 @@ struct lowcore {
4343
};
4444
__u32 data_exc_code; /* 0x0090 */
4545
__u16 mon_class_num; /* 0x0094 */
46-
__u8 per_code; /* 0x0096 */
47-
__u8 per_atmid; /* 0x0097 */
46+
union {
47+
struct {
48+
__u8 per_code; /* 0x0096 */
49+
__u8 per_atmid; /* 0x0097 */
50+
};
51+
__u16 per_code_combined;
52+
};
4853
__u64 per_address; /* 0x0098 */
4954
__u8 exc_access_id; /* 0x00a0 */
5055
__u8 per_access_id; /* 0x00a1 */

arch/s390/kernel/traps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ void noinstr __do_pgm_check(struct pt_regs *regs)
322322

323323
set_thread_flag(TIF_PER_TRAP);
324324
ev->address = S390_lowcore.per_address;
325-
ev->cause = *(u16 *)&S390_lowcore.per_code;
325+
ev->cause = S390_lowcore.per_code_combined;
326326
ev->paid = S390_lowcore.per_access_id;
327327
} else {
328328
/* PER event in kernel is kprobes */

0 commit comments

Comments
 (0)