linux-stable/arch/powerpc/xmon
Michael Ellerman 0713298280 powerpc/xmon: Fix disassembly CPU feature checks
[ Upstream commit 14196e47c5 ]

In the xmon disassembly code there are several CPU feature checks to
determine what dialects should be passed to the disassembler. The
dialect controls which instructions the disassembler will recognise.

Unfortunately the checks are incorrect, because instead of passing a
single CPU feature they are passing a mask of feature bits.

For example the code:

  if (cpu_has_feature(CPU_FTRS_POWER5))
      dialect |= PPC_OPCODE_POWER5;

Is trying to check if the system is running on a Power5 CPU. But
CPU_FTRS_POWER5 is a mask of *all* the feature bits that are enabled on
a Power5.

In practice the test will always return true for any 64-bit CPU, because
at least one bit in the mask will be present in the CPU_FTRS_ALWAYS
mask.

Similarly for all the other checks against CPU_FTRS_xx masks.

Rather than trying to match the disassembly behaviour exactly to the
current CPU, just differentiate between 32-bit and 64-bit, and Altivec,
VSX and HTM.

That will cause some instructions to be shown in disassembly even
on a CPU that doesn't support them, but that's OK, objdump -d output
has the same behaviour, and if anything it's less confusing than some
instructions not being disassembled.

Fixes: 897f112bb4 ("[POWERPC] Import updated version of ppc disassembly code for xmon")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240509121248.270878-2-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-03 08:49:22 +02:00
..
ansidecl.h
dis-asm.h powerpc/xmon: Fix compile error in print_insn* functions 2020-01-26 00:11:35 +11:00
Makefile kbuild: introduce ccflags-remove-y and asflags-remove-y 2020-08-10 01:32:59 +09:00
nonstdio.c powerpc/xmon: Change printk() to pr_cont() 2020-12-04 21:56:30 +11:00
nonstdio.h
ppc-dis.c powerpc/xmon: Fix disassembly CPU feature checks 2024-08-03 08:49:22 +02:00
ppc-opc.c powerpc: fix typos in comments 2022-05-05 22:12:44 +10:00
ppc.h powerpc/xmon: remove unused ppc_parse_cpu() declaration 2022-09-15 22:55:45 +10:00
spr_access.S powerpc/64: asm use consistent global variable declaration and access 2022-09-28 19:22:12 +10:00
spu-dis.c
spu-insns.h
spu-opc.c
spu.h
xmon.c powerpc/xmon: Check cpu id in commands "c#", "dp#" and "dx#" 2024-07-11 12:47:09 +02:00
xmon_bpts.h powerpc/inst: Define ppc_inst_t 2021-12-09 22:41:21 +11:00
xmon_bpts.S powerpc: Add prefixed instructions to instruction data type 2020-05-19 00:10:39 +10:00