qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 30/32] lcall/lret arch specific accel hooks


From: Glauber Costa
Subject: [Qemu-devel] [PATCH 30/32] lcall/lret arch specific accel hooks
Date: Thu, 23 Oct 2008 12:19:14 -0200

provide arch specific hooks for far calls in op_helper.c

Signed-off-by: Glauber Costa <address@hidden>
---
 kqemu.c                 |   10 ++++++++++
 target-i386/accel86.h   |   16 ++++++++++++++++
 target-i386/op_helper.c |   14 ++------------
 3 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/kqemu.c b/kqemu.c
index 1934aa5..7b87a58 100644
--- a/kqemu.c
+++ b/kqemu.c
@@ -1205,11 +1205,21 @@ static void kqemu_syscall_return(CPUState *env)
     }
 }
 
+static void kqemu_long_exit_loop(CPUState *env)
+{
+    if (kqemu_kernel_flags_ok(env)) {
+        env->exception_index = -1;
+        cpu_loop_exit();
+    }
+}
+
 QEMUAccel86 kqemu_accel86 = {
     .get_msr = kqemu_get_msr,
     .set_msr = kqemu_set_msr,
     .interrupt_return = kqemu_interrupt_return,
     .syscall_return = kqemu_syscall_return,
+    .long_call = kqemu_long_exit_loop,
+    .long_ret = kqemu_long_exit_loop,
 };
 
 QEMUAccel kqemu_accel = {
diff --git a/target-i386/accel86.h b/target-i386/accel86.h
index 1624a64..a7ba39b 100644
--- a/target-i386/accel86.h
+++ b/target-i386/accel86.h
@@ -8,6 +8,8 @@ typedef struct QEMUAccel86 {
        int (*set_msr)(int msr, uint64_t value);
     void (*interrupt_return)(CPUState *env);
     void (*syscall_return)(CPUState *env);
+    void (*long_call)(CPUState *env);
+    void (*long_ret)(CPUState *env);
 } QEMUAccel86;
 
 #define accel86_call_func ((QEMUAccel86 *)(current_accel->arch))
@@ -40,5 +42,19 @@ static inline void accel_syscall_return(CPUState *env)
     accel86_call_func->syscall_return(env);
 }
 
+static inline void accel_long_call(CPUState *env)
+{
+    if (!current_accel->arch)
+        return;
+    accel86_call_func->syscall_return(env);
+}
+
+static inline void accel_long_ret(CPUState *env)
+{
+    if (!current_accel->arch)
+        return;
+    accel86_call_func->syscall_return(env);
+}
+
 #endif
 
diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
index a831a4d..addd42a 100644
--- a/target-i386/op_helper.c
+++ b/target-i386/op_helper.c
@@ -2617,12 +2617,7 @@ void helper_lcall_protected(int new_cs, target_ulong 
new_eip,
         SET_ESP(sp, sp_mask);
         EIP = offset;
     }
-#ifdef USE_KQEMU
-    if (kqemu_is_ok(env)) {
-        env->exception_index = -1;
-        cpu_loop_exit();
-    }
-#endif
+    accel_long_call(env);
 }
 
 /* real and vm86 mode iret */
@@ -2918,12 +2913,7 @@ void helper_iret_protected(int shift, int next_eip)
 void helper_lret_protected(int shift, int addend)
 {
     helper_ret_protected(shift, 0, addend);
-#ifdef USE_KQEMU
-    if (kqemu_is_ok(env)) {
-        env->exception_index = -1;
-        cpu_loop_exit();
-    }
-#endif
+    accel_long_ret(env);
 }
 
 void helper_sysenter(void)
-- 
1.5.5.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]