]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/ptrace: Make user_mode() common to PPC32 and PPC64
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Tue, 17 Aug 2021 16:00:14 +0000 (16:00 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 25 Aug 2021 03:35:49 +0000 (13:35 +1000)
commit89c8667659c75eff3a79f62152216c7d2b1bb940
tree33fd4267b9b9cd92f068f6bc49cfe70140c8ecb8
parente48318e2a24eb24bce75bbf3e76acf64fdca7a47
powerpc/ptrace: Make user_mode() common to PPC32 and PPC64

Today we have:

#ifdef __powerpc64__
#define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1)
#else
#define user_mode(regs) (((regs)->msr & MSR_PR) != 0)
#endif

With ppc64_defconfig, we get:

if (!user_mode(regs))
    14b4: e9 3e 01 08  ld      r9,264(r30)
    14b8: 71 29 40 00  andi.   r9,r9,16384
    14bc: 41 82 07 a4  beq     1c60 <.emulate_instruction+0x7d0>

If taking the ppc32 definition of user_mode(), the exact same code
is generated for ppc64_defconfig.

So, only keep one version of user_mode(), preferably the one not
using MSR_PR_LG which should be kept internal to reg.h.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/000a28c51808bbd802b505af42d2cb316c2be7d3.1629216000.git.christophe.leroy@csgroup.eu
arch/powerpc/include/asm/ptrace.h