Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/sstep: Fix incorrect return from analyze_instr()

We currently just percolate the return value from analyze_instr()
to the caller of emulate_step(), especially if it is a -1.

For one particular case (opcode = 4) for instructions that aren't
currently emulated, we are returning 'should not be single-stepped'
while we should have returned 0 which says 'did not emulate, may
have to single-step'.

Fixes: 930d6288a26787 ("powerpc: sstep: Add support for maddhd, maddhdu, maddld instructions")
Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.ibm.com>
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: Sandipan Das <sandipan@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/161157999039.64773.14950289716779364766.stgit@thinktux.local

authored by

Ananth N Mavinakayanahalli and committed by
Michael Ellerman
718aae91 8813ff49

+6 -1
+6 -1
arch/powerpc/lib/sstep.c
··· 1445 1445 1446 1446 #ifdef __powerpc64__ 1447 1447 case 4: 1448 + /* 1449 + * There are very many instructions with this primary opcode 1450 + * introduced in the ISA as early as v2.03. However, the ones 1451 + * we currently emulate were all introduced with ISA 3.0 1452 + */ 1448 1453 if (!cpu_has_feature(CPU_FTR_ARCH_300)) 1449 1454 goto unknown_opcode; 1450 1455 ··· 1477 1472 * There are other instructions from ISA 3.0 with the same 1478 1473 * primary opcode which do not have emulation support yet. 1479 1474 */ 1480 - return -1; 1475 + goto unknown_opcode; 1481 1476 #endif 1482 1477 1483 1478 case 7: /* mulli */