M680x0 doesn't support the same set of instructions
as ColdFire, so we can't use "any" CPU type to execute
m68020 instructions.
We select CPU type ("m68020" or "any" for ColdFire)
according to the ELF header. If we can't, we
use by default the value used until now: "any".

Signed-off-by: Laurent Vivier <laur...@vivier.eu>
---
 linux-user/main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/linux-user/main.c b/linux-user/main.c
index 9ce90ae634..2fc2267fd4 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -4267,6 +4267,16 @@ static const char *get_cpu_model(int fd)
 #elif defined(TARGET_UNICORE32)
     return "any";
 #elif defined(TARGET_M68K)
+    int ret;
+    uint32_t eflags;
+
+    ret = get_elf_eflags(fd, &eflags);
+    if (ret == 0 && eflags == 0) {
+        /* 680x0 */
+        return "m68020";
+    }
+
+    /* Coldfire */
     return "any";
 #elif defined(TARGET_SPARC)
 #ifdef TARGET_SPARC64
-- 
2.14.3


Reply via email to