Patchwork target-arm/helper.c: Don't allocate TCG resources unless TCG enabled

login
register
mail settings
Submitter Peter Maydell
Date Nov. 25, 2011, 6:25 p.m.
Message ID <1322245550-5110-1-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/127740/
State New
Headers show

Comments

Peter Maydell - Nov. 25, 2011, 6:25 p.m.
Don't call arm_translate_init() (which allocates TCG resources)
unless TCG is enabled.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
First KVM related QEMU patch :-)
[without this we segfault on startup if run with -enable-kvm,
although the omission is currently harmless for upstream QEMU
where TCG is always enabled on ARM.]

 target-arm/helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
andrzej zaborowski - Dec. 5, 2011, 8:22 p.m.
On 25 November 2011 19:25, Peter Maydell <peter.maydell@linaro.org> wrote:
> Don't call arm_translate_init() (which allocates TCG resources)
> unless TCG is enabled.

Thanks, applied this patch.

Cheers

Patch

diff --git a/target-arm/helper.c b/target-arm/helper.c
index 97af4d0..3fe5822 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -390,7 +390,7 @@  CPUARMState *cpu_arm_init(const char *cpu_model)
         return NULL;
     env = g_malloc0(sizeof(CPUARMState));
     cpu_exec_init(env);
-    if (!inited) {
+    if (tcg_enabled() && !inited) {
         inited = 1;
         arm_translate_init();
     }