WSL2-Linux-Kernel/arch/powerpc
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
..
boot powerpc/toc: Future proof kernel toc 2024-01-25 14:52:32 -08:00
configs Remove DECnet support from kernel 2023-06-21 15:59:15 +02:00
crypto powerpc: flexible GPR range save/restore macros 2022-07-12 16:35:02 +02:00
include powerpc/64: Set _IO_BASE to POISON_POINTER_DELTA not 0 for CONFIG_PCI=n 2024-07-18 13:07:29 +02:00
kernel powerpc/eeh: avoid possible crash when edev->pdev changes 2024-07-27 10:46:13 +02:00
kexec powerpc: Set crashkernel offset to mid of RMA region 2022-04-13 20:59:03 +02:00
kvm KVM: PPC: Book3S HV: Prevent UAF in kvm_spapr_tce_attach_iommu_group() 2024-07-27 10:46:10 +02:00
lib powerpc: xor_vmx: Add '-mhard-float' to CFLAGS 2024-04-10 16:19:30 +02:00
math-emu powerpc/math_emu/efp: Include module.h 2022-10-26 12:35:21 +02:00
mm powerpc/kasan: Fix addr error caused by page alignment 2024-02-23 08:55:04 +01:00
net powerpc64/bpf: Limit 'ldbrx' to processors compliant with ISA v2.06 2022-02-01 17:27:09 +01:00
perf powerpc/hv-gpci: Fix the H_GET_PERF_COUNTER_INFO hcall return value checks 2024-03-26 18:21:30 -04:00
platforms powerpc/pseries: Whitelist dtl slub object for copying to userspace 2024-07-27 10:46:13 +02:00
purgatory powerpc/purgatory: remove PGO flags 2023-06-21 15:59:14 +02:00
sysdev powerpc/fsl-soc: hide unused const variable 2024-06-16 13:39:28 +02:00
tools powerpc/64: Add UADDR64 relocation support 2022-05-09 09:14:44 +02:00
xmon powerpc/xmon: Fix disassembly CPU feature checks 2024-08-19 05:45:06 +02:00
Kbuild
Kconfig powerpc/memhotplug: Add add_pages override for PPC 2022-07-07 17:53:28 +02:00
Kconfig.debug powerpc: allow PPC_EARLY_DEBUG_CPM only when SERIAL_CPM=y 2023-07-23 13:47:29 +02:00
Makefile powerpc: remove checks for binutils older than 2.25 2024-01-25 14:52:32 -08:00
Makefile.postlink