From: Matheus Tavares Bernardino Date: Thu, 4 May 2023 18:53:12 +0000 (-0300) Subject: Hexagon: append eflags to unknown cpu model string X-Git-Tag: v8.1.0-rc0~115^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3128588232333beb505505366133d18da671e2c8;p=thirdparty%2Fqemu.git Hexagon: append eflags to unknown cpu model string Running qemu-hexagon with a binary that was compiled for an arch version unknown by qemu can produce a somewhat confusing message: qemu-hexagon: unable to find CPU model 'unknown' Let's give a bit more info by appending the eflags so that the message becomes: qemu-hexagon: unable to find CPU model 'unknown (0x69)' Signed-off-by: Matheus Tavares Bernardino Signed-off-by: Taylor Simpson Tested-by: Taylor Simpson Reviewed-by: Taylor Simpson Message-Id: <8a8d013cc619b94fd4fb577ae6a8df26cedb972b.1683225804.git.quic_mathbern@quicinc.com> --- diff --git a/linux-user/hexagon/target_elf.h b/linux-user/hexagon/target_elf.h index a0271a0a2aa..36056fc9f01 100644 --- a/linux-user/hexagon/target_elf.h +++ b/linux-user/hexagon/target_elf.h @@ -20,6 +20,9 @@ static inline const char *cpu_get_model(uint32_t eflags) { + static char buf[32]; + int err; + /* For now, treat anything newer than v5 as a v73 */ /* FIXME - Disable instructions that are newer than the specified arch */ if (eflags == 0x04 || /* v5 */ @@ -39,7 +42,9 @@ static inline const char *cpu_get_model(uint32_t eflags) ) { return "v73"; } - return "unknown"; + + err = snprintf(buf, sizeof(buf), "unknown (0x%x)", eflags); + return err >= 0 && err < sizeof(buf) ? buf : "unknown"; } #endif