WSL2-Linux-Kernel/arch/powerpc/xmon
Michael Ellerman 1b83f8967b powerpc/xmon: Fix disassembly CPU feature checks
[ Upstream commit 14196e47c5ffe32af7ed5a51c9e421c5ea5bccce ]

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-19 05:45:06 +02:00
..
Makefile
ansidecl.h
dis-asm.h
nonstdio.c
nonstdio.h
ppc-dis.c powerpc/xmon: Fix disassembly CPU feature checks 2024-08-19 05:45:06 +02:00
ppc-opc.c
ppc.h
spr_access.S
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-18 13:07:29 +02:00
xmon_bpts.S
xmon_bpts.h