diff mbox

x86 tlb_fill in memory_helper.c

Message ID efb89578-ba8c-1f42-0ec3-79f769b3f1f1@genode-labs.com
State New
Headers show

Commit Message

Alexander Boettcher Feb. 16, 2017, 10:57 a.m. UTC
Hello,

I have a short question/observation and a longer story.

Short question:

Between qemu 2.4.1 and 2.5.0 following snippet of code vanished:

     }
 }
diff mbox

Patch

--- qemu-2.4.1/target-i386/mem_helper.c
+++ qemu-2.5.0/target-i386/mem_helper.c
@@ -122,11 +142,7 @@ 
         X86CPU *cpu = X86_CPU(cs);
         CPUX86State *env = &cpu->env;

-        if (retaddr) {
-            /* now we have a real cpu fault */
-            cpu_restore_state(cs, retaddr);
-        }
-        raise_exception_err(env, cs->exception_index, env->error_code);
+        raise_exception_err_ra(env, cs->exception_index,
env->error_code, retaddr);
     }
 }
 #endif

The special retaddr condition seems to be part in every other
architecture but not i386. Is there a specific reason ?

The point is - because I'm asking - beginning with qemu 2.5.0. the AMD
SVM virtualization (-cpu phenom) does not work anymore for us. Patching
the vanished retaddr condition back to 2.5.0, 2.8.0 and qemu devel git
branch makes it working again.



From 87e061542205ac56cc485d13607db16239524e4b Mon Sep 17 00:00:00 2001
From: Alexander Boettcher <alexander.boettcher@genode-labs.com>
Date: Thu, 16 Feb 2017 11:17:09 +0100
Subject: [PATCH] x86/tlb_fill: call cpu_restore_state on valid addr

Vanished between 2.4.1 and 2.5.0 release and breaks SVM virtualization.

Signed-off-by: Alexander Boettcher <alexander.boettcher@genode-labs.com>
---
 target/i386/mem_helper.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/i386/mem_helper.c b/target/i386/mem_helper.c
index 70f6766..d6267f9 100644
--- a/target/i386/mem_helper.c
+++ b/target/i386/mem_helper.c
@@ -209,6 +209,10 @@  void tlb_fill(CPUState *cs, target_ulong addr,
MMUAccessType access_type,
         X86CPU *cpu = X86_CPU(cs);
         CPUX86State *env = &cpu->env;

+        if (retaddr) {
+            /* now we have a real cpu fault */
+            cpu_restore_state(cs, retaddr);
+        }
         raise_exception_err_ra(env, cs->exception_index,
env->error_code, retaddr);