From 8e161bb723d92a37cdb5648ab8c0503e98577062 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 12 Mar 2018 03:29:54 -0400 Subject: [PATCH] target/arm: Use the any cpu model instead of cortex-a57 The Cortex-A57 doesn't allow use of v8.1+ architecture instructions --- qemu/hw/arm/virt.c | 4 +++- qemu/target/arm/cpu64.c | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/qemu/hw/arm/virt.c b/qemu/hw/arm/virt.c index fe6d2206..64344cfe 100644 --- a/qemu/hw/arm/virt.c +++ b/qemu/hw/arm/virt.c @@ -64,7 +64,9 @@ static int machvirt_init(struct uc_struct *uc, MachineState *machine) int n; if (!cpu_model) { - cpu_model = "cortex-a57"; // ARM64 + // Unicorn: "any" used instead to allow use of ARMv8.1+ instructions. + //cpu_model = "cortex-a57"; // ARM64 + cpu_model = "any"; } for (n = 0; n < smp_cpus; n++) { diff --git a/qemu/target/arm/cpu64.c b/qemu/target/arm/cpu64.c index 627e9e98..55bc79ee 100644 --- a/qemu/target/arm/cpu64.c +++ b/qemu/target/arm/cpu64.c @@ -188,7 +188,7 @@ static void aarch64_a53_initfn(struct uc_struct *uc, Object *obj, void *opaque) define_arm_cp_regs(cpu, cortex_a57_a53_cp_reginfo); } -#ifdef CONFIG_USER_ONLY +// Unicorn: enabled for the general use-case as well. static void aarch64_any_initfn(struct uc_struct *uc, Object *obj, void *opaque) { ARMCPU *cpu = ARM_CPU(uc, obj); @@ -212,7 +212,6 @@ static void aarch64_any_initfn(struct uc_struct *uc, Object *obj, void *opaque) cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */ cpu->dcz_blocksize = 7; /* 512 bytes */ } -#endif typedef struct ARMCPUInfo { const char *name; @@ -223,9 +222,8 @@ typedef struct ARMCPUInfo { static const ARMCPUInfo aarch64_cpus[] = { { "cortex-a57", aarch64_a57_initfn }, { "cortex-a53", aarch64_a53_initfn }, -#ifdef CONFIG_USER_ONLY + // Unicorn: enabled for the general use case as well { "any", aarch64_any_initfn }, -#endif { NULL } };