diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2012-07-27 04:31:12 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-07-30 05:03:12 -0400 |
commit | 7d25617597ff8dcfe4d0e1d0ac9214e7cc7ded92 (patch) | |
tree | 5195733687b3194e053be0687137f6f6b05472e0 /arch/s390/kernel/traps.c | |
parent | 37fe1d73a449bdebc4908d04e518f5852d6c453b (diff) |
s390: make use of user_mode() macro where possible
We use the user_mode() helper already at several places but also
have the open coded variant at other places.
Convert the code to always use the helper function.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/traps.c')
-rw-r--r-- | arch/s390/kernel/traps.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index af2421a0f315..01775c04a90e 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c | |||
@@ -185,7 +185,7 @@ void show_registers(struct pt_regs *regs) | |||
185 | { | 185 | { |
186 | char *mode; | 186 | char *mode; |
187 | 187 | ||
188 | mode = (regs->psw.mask & PSW_MASK_PSTATE) ? "User" : "Krnl"; | 188 | mode = user_mode(regs) ? "User" : "Krnl"; |
189 | printk("%s PSW : %p %p", | 189 | printk("%s PSW : %p %p", |
190 | mode, (void *) regs->psw.mask, | 190 | mode, (void *) regs->psw.mask, |
191 | (void *) regs->psw.addr); | 191 | (void *) regs->psw.addr); |
@@ -225,7 +225,7 @@ void show_regs(struct pt_regs *regs) | |||
225 | (void *) current->thread.ksp); | 225 | (void *) current->thread.ksp); |
226 | show_registers(regs); | 226 | show_registers(regs); |
227 | /* Show stack backtrace if pt_regs is from kernel mode */ | 227 | /* Show stack backtrace if pt_regs is from kernel mode */ |
228 | if (!(regs->psw.mask & PSW_MASK_PSTATE)) | 228 | if (!user_mode(regs)) |
229 | show_trace(NULL, (unsigned long *) regs->gprs[15]); | 229 | show_trace(NULL, (unsigned long *) regs->gprs[15]); |
230 | show_last_breaking_event(regs); | 230 | show_last_breaking_event(regs); |
231 | } | 231 | } |
@@ -300,7 +300,7 @@ static void __kprobes do_trap(struct pt_regs *regs, | |||
300 | regs->int_code, si_signo) == NOTIFY_STOP) | 300 | regs->int_code, si_signo) == NOTIFY_STOP) |
301 | return; | 301 | return; |
302 | 302 | ||
303 | if (regs->psw.mask & PSW_MASK_PSTATE) { | 303 | if (user_mode(regs)) { |
304 | info.si_signo = si_signo; | 304 | info.si_signo = si_signo; |
305 | info.si_errno = 0; | 305 | info.si_errno = 0; |
306 | info.si_code = si_code; | 306 | info.si_code = si_code; |
@@ -341,7 +341,7 @@ void __kprobes do_per_trap(struct pt_regs *regs) | |||
341 | 341 | ||
342 | static void default_trap_handler(struct pt_regs *regs) | 342 | static void default_trap_handler(struct pt_regs *regs) |
343 | { | 343 | { |
344 | if (regs->psw.mask & PSW_MASK_PSTATE) { | 344 | if (user_mode(regs)) { |
345 | report_user_fault(regs, SIGSEGV); | 345 | report_user_fault(regs, SIGSEGV); |
346 | do_exit(SIGSEGV); | 346 | do_exit(SIGSEGV); |
347 | } else | 347 | } else |
@@ -410,7 +410,7 @@ static void __kprobes illegal_op(struct pt_regs *regs) | |||
410 | 410 | ||
411 | location = get_psw_address(regs); | 411 | location = get_psw_address(regs); |
412 | 412 | ||
413 | if (regs->psw.mask & PSW_MASK_PSTATE) { | 413 | if (user_mode(regs)) { |
414 | if (get_user(*((__u16 *) opcode), (__u16 __user *) location)) | 414 | if (get_user(*((__u16 *) opcode), (__u16 __user *) location)) |
415 | return; | 415 | return; |
416 | if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) { | 416 | if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) { |
@@ -478,7 +478,7 @@ void specification_exception(struct pt_regs *regs) | |||
478 | 478 | ||
479 | location = (__u16 __user *) get_psw_address(regs); | 479 | location = (__u16 __user *) get_psw_address(regs); |
480 | 480 | ||
481 | if (regs->psw.mask & PSW_MASK_PSTATE) { | 481 | if (user_mode(regs)) { |
482 | get_user(*((__u16 *) opcode), location); | 482 | get_user(*((__u16 *) opcode), location); |
483 | switch (opcode[0]) { | 483 | switch (opcode[0]) { |
484 | case 0x28: /* LDR Rx,Ry */ | 484 | case 0x28: /* LDR Rx,Ry */ |
@@ -531,7 +531,7 @@ static void data_exception(struct pt_regs *regs) | |||
531 | asm volatile("stfpc %0" : "=m" (current->thread.fp_regs.fpc)); | 531 | asm volatile("stfpc %0" : "=m" (current->thread.fp_regs.fpc)); |
532 | 532 | ||
533 | #ifdef CONFIG_MATHEMU | 533 | #ifdef CONFIG_MATHEMU |
534 | else if (regs->psw.mask & PSW_MASK_PSTATE) { | 534 | else if (user_mode(regs)) { |
535 | __u8 opcode[6]; | 535 | __u8 opcode[6]; |
536 | get_user(*((__u16 *) opcode), location); | 536 | get_user(*((__u16 *) opcode), location); |
537 | switch (opcode[0]) { | 537 | switch (opcode[0]) { |
@@ -598,7 +598,7 @@ static void data_exception(struct pt_regs *regs) | |||
598 | static void space_switch_exception(struct pt_regs *regs) | 598 | static void space_switch_exception(struct pt_regs *regs) |
599 | { | 599 | { |
600 | /* Set user psw back to home space mode. */ | 600 | /* Set user psw back to home space mode. */ |
601 | if (regs->psw.mask & PSW_MASK_PSTATE) | 601 | if (user_mode(regs)) |
602 | regs->psw.mask |= PSW_ASC_HOME; | 602 | regs->psw.mask |= PSW_ASC_HOME; |
603 | /* Send SIGILL. */ | 603 | /* Send SIGILL. */ |
604 | do_trap(regs, SIGILL, ILL_PRVOPC, "space switch event"); | 604 | do_trap(regs, SIGILL, ILL_PRVOPC, "space switch event"); |