Default x86 CPU model to UC_CPU_X86_HASWELL

Rationale: Previouly, Unicorn uses several hacks to pretend it supports
floating point instructions while not properly setting up something
like CPU features. Therefore, once related registers like CR4 is reset,
the hacks stop working and UC_ERR_INSN_INVALID is thrown. Setting the default
model to a CPu that has basical floating point support should have the
minimal break changes.
This commit is contained in:
mio
2025-02-18 12:13:24 +08:00
parent 4d173ea376
commit 1cb8952b14

View File

@@ -5085,9 +5085,9 @@ X86CPU *cpu_x86_init(struct uc_struct *uc)
if (uc->cpu_model == INT_MAX) {
#ifdef TARGET_X86_64
uc->cpu_model = UC_CPU_X86_QEMU64; // qemu64
uc->cpu_model = UC_CPU_X86_HASWELL; // qemu64
#else
uc->cpu_model = UC_CPU_X86_QEMU32; // qemu32
uc->cpu_model = UC_CPU_X86_HASWELL; // qemu32
#endif
} else if (uc->cpu_model >= ARRAY_SIZE(builtin_x86_defs)) {
free(cpu);