From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KszEE-0007PB-50 for qemu-devel@nongnu.org; Thu, 23 Oct 2008 08:23:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KszEA-0007Nf-Bi for qemu-devel@nongnu.org; Thu, 23 Oct 2008 08:23:49 -0400 Received: from [199.232.76.173] (port=51720 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KszEA-0007Nb-64 for qemu-devel@nongnu.org; Thu, 23 Oct 2008 08:23:46 -0400 Received: from mx2.redhat.com ([66.187.237.31]:54744) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KszE7-0006Ng-Fw for qemu-devel@nongnu.org; Thu, 23 Oct 2008 08:23:46 -0400 From: Glauber Costa Date: Thu, 23 Oct 2008 12:19:14 -0200 Message-Id: <1224771556-11146-31-git-send-email-glommer@redhat.com> In-Reply-To: <1224771556-11146-1-git-send-email-glommer@redhat.com> References: <1224771556-11146-1-git-send-email-glommer@redhat.com> Subject: [Qemu-devel] [PATCH 30/32] lcall/lret arch specific accel hooks Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: jan.kiszka@siemens.com, aliguori@us.ibm.com, jes@sgi.com, avi@qumranet.com, dmitry.baryshkov@siemens.com provide arch specific hooks for far calls in op_helper.c Signed-off-by: Glauber Costa --- 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