]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc: Wrap register number correctly for string load/store instructions
authorPaul Mackerras <paulus@ozlabs.org>
Thu, 31 Aug 2017 23:51:23 +0000 (09:51 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 1 Sep 2017 06:42:44 +0000 (16:42 +1000)
commitc06343b595d93966894d9020e3d36679148f13af
treeabb9bde370db927e3870d8cf9ccd7cb317212a85
parent4e3d772a4aa2aaa4b0e4d78a2d8c4419312f6885
powerpc: Wrap register number correctly for string load/store instructions

Michael Ellerman reported that emulate_loadstore() was trying to
access element 32 of regs->gpr[], which doesn't exist, when
emulating a string store instruction.  This is because the string
load and store instructions (lswi, lswx, stswi and stswx) are
defined to wrap around from register 31 to register 0 if the number
of bytes being loaded or stored is sufficiently large.  This wrapping
was not implemented in the emulation code.  To fix it, we mask the
register number after incrementing it.

Reported-by: Michael Ellerman <mpe@ellerman.id.au>
Fixes: 409a4deddf61 ("powerpc: Implement emulation of string loads and stores")
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/lib/sstep.c