Skip to content

Commit

Permalink
linux-user: ppc64: fix ARCH_206 bit in AT_HWCAP
Browse files Browse the repository at this point in the history
Only the POWER[789] CPUs should have the ARCH_206 bit set. This is what the
linux kernel does. I guess this was also the intention of commit 0e01974.
We have to make sure all *206 bits are set.

Before this patch, the flags check in the GET_FEATURES2 macro returned true
if _any_ bit was set. This worked well as long as there was only one bit
set in the 'flag' parameter. But as explained before, we have to make sure
all bits in the 'flag' parameter are set.

Signed-off-by: Michael Walle <[email protected]>
Signed-off-by: David Gibson <[email protected]>
  • Loading branch information
mwalle authored and dgibson committed Sep 23, 2016
1 parent 0d594f5 commit 58eb530
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions linux-user/elfload.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,8 +741,12 @@ static uint32_t get_elf_hwcap(void)
Altivec/FP/SPE support. Anything else is just a bonus. */
#define GET_FEATURE(flag, feature) \
do { if (cpu->env.insns_flags & flag) { features |= feature; } } while (0)
#define GET_FEATURE2(flag, feature) \
do { if (cpu->env.insns_flags2 & flag) { features |= feature; } } while (0)
#define GET_FEATURE2(flags, feature) \
do { \
if ((cpu->env.insns_flags2 & flags) == flags) { \
features |= feature; \
} \
} while (0)
GET_FEATURE(PPC_64B, QEMU_PPC_FEATURE_64);
GET_FEATURE(PPC_FLOAT, QEMU_PPC_FEATURE_HAS_FPU);
GET_FEATURE(PPC_ALTIVEC, QEMU_PPC_FEATURE_HAS_ALTIVEC);
Expand Down

0 comments on commit 58eb530

Please sign in to comment.