[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 03/23] target-i386: Use cpu_exec_enter/exit qom
From: |
Alex Bennée |
Subject: |
Re: [Qemu-devel] [PATCH 03/23] target-i386: Use cpu_exec_enter/exit qom hooks |
Date: |
Sun, 14 Sep 2014 20:38:01 +0100 |
User-agent: |
mu4e 0.9.9.5; emacs 24.3.1 |
Richard Henderson writes:
> Note that the code that was within the "exit" ifdef block
> was identical to the cpu_compute_eflags inline, so make that
> simplification at the same time.
>
> Signed-off-by: Richard Henderson <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
> ---
> cpu-exec.c | 14 ++------------
> target-i386/cpu-qom.h | 3 +++
> target-i386/cpu.c | 2 ++
> target-i386/helper.c | 21 +++++++++++++++++++++
> 4 files changed, 28 insertions(+), 12 deletions(-)
>
> diff --git a/cpu-exec.c b/cpu-exec.c
> index 808d34f..0c1f0d3 100644
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -352,13 +352,7 @@ int cpu_exec(CPUArchState *env)
> cpu->exit_request = 1;
> }
>
> -#if defined(TARGET_I386)
> - /* put eflags in CPU temporary format */
> - CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
> - env->df = 1 - (2 * ((env->eflags >> 10) & 1));
> - CC_OP = CC_OP_EFLAGS;
> - env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
> -#elif defined(TARGET_M68K)
> +#if defined(TARGET_M68K)
> env->cc_op = CC_OP_FLAGS;
> env->cc_dest = env->sr & 0xf;
> env->cc_x = (env->sr >> 4) & 1;
> @@ -811,11 +805,7 @@ int cpu_exec(CPUArchState *env)
> } /* for(;;) */
>
>
> -#if defined(TARGET_I386)
> - /* restore flags in standard format */
> - env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP)
> - | (env->df & DF_MASK);
> -#elif defined(TARGET_M68K)
> +#if defined(TARGET_M68K)
> cpu_m68k_flush_flags(env, env->cc_op);
> env->cc_op = CC_OP_FLAGS;
> env->sr = (env->sr & 0xffe0)
> diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h
> index 7755466..b242cb0 100644
> --- a/target-i386/cpu-qom.h
> +++ b/target-i386/cpu-qom.h
> @@ -151,4 +151,7 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cpu, vaddr
> addr);
> int x86_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
> int x86_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
>
> +void x86_cpu_exec_enter(CPUState *cpu);
> +void x86_cpu_exec_exit(CPUState *cpu);
> +
> #endif
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 90d0a05..223e43e 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -2942,6 +2942,8 @@ static void x86_cpu_common_class_init(ObjectClass *oc,
> void *data)
> #ifndef CONFIG_USER_ONLY
> cc->debug_excp_handler = breakpoint_handler;
> #endif
> + cc->cpu_exec_enter = x86_cpu_exec_enter;
> + cc->cpu_exec_exit = x86_cpu_exec_exit;
> }
>
> static const TypeInfo x86_cpu_type_info = {
> diff --git a/target-i386/helper.c b/target-i386/helper.c
> index 28fefe0..345bda1 100644
> --- a/target-i386/helper.c
> +++ b/target-i386/helper.c
> @@ -1262,3 +1262,24 @@ void do_cpu_sipi(X86CPU *cpu)
> {
> }
> #endif
> +
> +/* Frob eflags into and out of the CPU temporary format. */
> +
> +void x86_cpu_exec_enter(CPUState *cs)
> +{
> + X86CPU *cpu = X86_CPU(cs);
> + CPUX86State *env = &cpu->env;
> +
> + CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
> + env->df = 1 - (2 * ((env->eflags >> 10) & 1));
> + CC_OP = CC_OP_EFLAGS;
> + env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
> +}
> +
> +void x86_cpu_exec_exit(CPUState *cs)
> +{
> + X86CPU *cpu = X86_CPU(cs);
> + CPUX86State *env = &cpu->env;
> +
> + env->eflags = cpu_compute_eflags(env);
> +}
--
Alex Bennée
- [Qemu-devel] [PATCH 00/23] qom hooks to clean up cpu_exec, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 00/23] qom hooks to clean up cpu_exec, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 01/23] qom: Add cpu_exec_enter and cpu_exec_exit hooks, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 02/23] cpu-exec: Remove do-nothing ifdef chains, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 03/23] target-i386: Use cpu_exec_enter/exit qom hooks, Richard Henderson, 2014/09/13
- Re: [Qemu-devel] [PATCH 03/23] target-i386: Use cpu_exec_enter/exit qom hooks,
Alex Bennée <=
- [Qemu-devel] [PATCH 04/23] target-m68k: Use cpu_exec_enter/exit qom hooks, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 05/23] target-ppc: Use cpu_exec_enter qom hook, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 06/23] qom: Add cpu_exec_interrupt hook, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 08/23] target-s390x: Use cpu_exec_interrupt qom hook, Richard Henderson, 2014/09/13