From 918fd0839eeafc83bd4984364321a947d29041fe Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Fri, 11 Jan 2013 15:21:22 +0000 Subject: [PATCH 1/2] target-arm: use type_register() instead of type_register_static() The type_register_static() interface is documented as: type_register_static: @info: The #TypeInfo of the new type. @info and all of the strings it points to should exist for the life time that the type is registered. But cpu_register() uses a stack variable for the 'info' argument, so it has to use type_register() instead of type_register_static(). Signed-off-by: Eduardo Habkost Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target-arm/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-arm/cpu.c b/target-arm/cpu.c index 17875ed0f0..94536bb0cc 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -778,7 +778,7 @@ static void cpu_register(const ARMCPUInfo *info) .class_size = sizeof(ARMCPUClass), }; - type_register_static(&type_info); + type_register(&type_info); } static const TypeInfo arm_cpu_type_info = { From 314e2296dc945e286b605563d7b6e6b269d29816 Mon Sep 17 00:00:00 2001 From: "Alex_Rozenman@mentor.com" Date: Fri, 11 Jan 2013 15:21:22 +0000 Subject: [PATCH 2/2] target-arm: Fix SWI (SVC) instruction in M profile. When do_interrupt_v7m is called with EXCP_SWI, the PC already points to the next instruction. Don't modify it here. Signed-off-by: Alex Rozenman Signed-off-by: Peter Maydell --- target-arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index 0525aec87a..66ab78e3f1 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1736,7 +1736,7 @@ static void do_interrupt_v7m(CPUARMState *env) armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); return; case EXCP_SWI: - env->regs[15] += 2; + /* The PC already points to the next instruction. */ armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SVC); return; case EXCP_PREFETCH_ABORT: