]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit828849e5186ee5c12b11d42692cd86014f8f8825
treed67d0125490c89315fc451b45897ae2a7263d759
parentfa8384acd3804aa451ed808e29e9868306ea0fe1
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