aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/processor.h
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2020-08-18 17:19:15 +0000
committerMichael Ellerman <mpe@ellerman.id.au>2020-12-04 01:01:11 +1100
commite009fa433542cd09d6279e361b767a1f44ffd29a (patch)
tree291d6f3afec1187096cf0b22e92d480b90367f4a /arch/powerpc/include/asm/processor.h
parentpowerpc/ptrace: Move declaration of ptrace_get_reg() and ptrace_set_reg() (diff)
downloadlinux-e009fa433542cd09d6279e361b767a1f44ffd29a.tar.gz
linux-e009fa433542cd09d6279e361b767a1f44ffd29a.zip
powerpc/ptrace: Consolidate reg index calculation
Today we have: #ifdef CONFIG_PPC32 index = addr >> 2; if ((addr & 3) || child->thread.regs == NULL) #else index = addr >> 3; if ((addr & 7)) #endif sizeof(long) has value 4 for PPC32 and value 8 for PPC64. Dividing by 4 is equivalent to >> 2 and dividing by 8 is equivalent to >> 3. And 3 and 7 are respectively (sizeof(long) - 1). Use sizeof(long) to get rid of the #ifdef CONFIG_PPC32 and consolidate the calculation and checking. thread.regs have to be not NULL on both PPC32 and PPC64 so adding that test on PPC64 is harmless. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/3cd1e284e93c60db981659585e18d1f6bb73ed2f.1597770847.git.christophe.leroy@csgroup.eu
Diffstat (limited to 'arch/powerpc/include/asm/processor.h')
0 files changed, 0 insertions, 0 deletions