powerpc: Use set_trap() and avoid open-coding trap masking
authorNicholas Piggin <npiggin@gmail.com>
Thu, 7 May 2020 12:13:30 +0000 (22:13 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 15 May 2020 01:58:54 +0000 (11:58 +1000)
commitdb30144b5c9cfb09c6b8b2fa7a9c351c94aa3433
treed67d0125490c89315fc451b45897ae2a7263d759
parentfeb9df3462e688d073848d85c8bb132fe8fd9ae5
powerpc: Use set_trap() and avoid open-coding trap masking

The pt_regs.trap field keeps 4 low bits for some metadata about the
trap or how it was handled, which is masked off in order to test the
architectural trap number.

Add a set_trap() accessor to set this, equivalent to TRAP() for
returning it. This is actually not quite the equivalent of TRAP()
because it always clears the low bits, which may be harmless if
it can only be updated via ptrace syscall, but it seems dangerous.

In fact settting TRAP from ptrace doesn't seem like a great idea
so maybe it's better deleted.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Make it a static inline rather than a shouty macro]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200507121332.2233629-2-mpe@ellerman.id.au
arch/powerpc/include/asm/ptrace.h
arch/powerpc/kernel/ptrace/ptrace-tm.c
arch/powerpc/kernel/ptrace/ptrace-view.c
arch/powerpc/xmon/xmon.c