Received: from eggs.gnu.org ([2001:4830:134:3::10]:41204) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCBWk-0005lG-Ec for qemu-devel@nongnu.org; Mon, 06 Jul 2015 14:54:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCBWh-0004IA-2V for qemu-devel@nongnu.org; Mon, 06 Jul 2015 14:54:02 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:63375) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCBWg-0004Hi-Sr for qemu-devel@nongnu.org; Mon, 06 Jul 2015 14:53:59 -0400 From: Date: Mon, 6 Jul 2015 11:53:52 -0700 Message-ID: <1436208832-17651-3-git-send-email-meadori@codesourcery.com> In-Reply-To: <1436208832-17651-1-git-send-email-meadori@codesourcery.com> References: <1436208832-17651-1-git-send-email-meadori@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH 2/2] target-arm: Add "anyvfp" CPU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Meador Inge From: Meador Inge This patch adds support for `-cpu anyvfp`, which is just like `-cpu any`, but enables the coprocessors by default. This is useful for working with a wide range of bare-metal C/C++ applications that have been compiled in different ways and assume the coprocessor has been enabled already. Original patch by Daniel Jacobowitz. Signed-off-by: Meador Inge --- target-arm/cpu.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/target-arm/cpu.c b/target-arm/cpu.c index 3665f6b..2a00e73 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -181,7 +181,14 @@ static void arm_cpu_reset(CPUState *s) env->regs[15] = 0xFFFF0000; } - env->vfp.xregs[ARM_VFP_FPEXC] = 0; + /* For -cpu anyvfp, enable coprocessors by default. Useful for + testing code that expects something else to turn on the + coprocessor. */ + if (cpu->midr == 0xfffffffe) { + env->vfp.xregs[ARM_VFP_FPEXC] = 1 << 30; + } else { + env->vfp.xregs[ARM_VFP_FPEXC] = 0; + } #endif set_flush_to_zero(1, &env->vfp.standard_fp_status); set_flush_inputs_to_zero(1, &env->vfp.standard_fp_status); @@ -1258,6 +1265,13 @@ static void arm_any_initfn(Object *obj) cpu->midr = 0xffffffff; } +static void arm_anyvfp_initfn(Object *obj) +{ + ARMCPU *cpu = ARM_CPU(obj); + arm_any_initfn(obj); + cpu->midr = 0xfffffffe; +} + #endif /* !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) */ typedef struct ARMCPUInfo { @@ -1304,6 +1318,7 @@ static const ARMCPUInfo arm_cpus[] = { { .name = "pxa270-c0", .initfn = pxa270c0_initfn }, { .name = "pxa270-c5", .initfn = pxa270c5_initfn }, { .name = "any", .initfn = arm_any_initfn }, + { .name = "anyvfp", .initfn = arm_anyvfp_initfn }, #endif { .name = NULL } }; -- 1.8.1.1