[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 40/50] target/i386: Pass env to do_pause and do_hlt
From: |
Richard Henderson |
Subject: |
[PULL 40/50] target/i386: Pass env to do_pause and do_hlt |
Date: |
Wed, 19 May 2021 13:30:40 -0500 |
Having the callers upcast to X86CPU is a waste, since we
don't need it. We even have to recover env in do_hlt.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210514151342.384376-41-richard.henderson@linaro.org>
---
target/i386/tcg/misc_helper.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/target/i386/tcg/misc_helper.c b/target/i386/tcg/misc_helper.c
index 931dbd9db0..23287b330e 100644
--- a/target/i386/tcg/misc_helper.c
+++ b/target/i386/tcg/misc_helper.c
@@ -101,19 +101,18 @@ void QEMU_NORETURN helper_rdpmc(CPUX86State *env)
raise_exception_err(env, EXCP06_ILLOP, 0);
}
-static QEMU_NORETURN void do_pause(X86CPU *cpu)
+static void QEMU_NORETURN do_pause(CPUX86State *env)
{
- CPUState *cs = CPU(cpu);
+ CPUState *cs = env_cpu(env);
/* Just let another CPU run. */
cs->exception_index = EXCP_INTERRUPT;
cpu_loop_exit(cs);
}
-static QEMU_NORETURN void do_hlt(X86CPU *cpu)
+static void QEMU_NORETURN do_hlt(CPUX86State *env)
{
- CPUState *cs = CPU(cpu);
- CPUX86State *env = &cpu->env;
+ CPUState *cs = env_cpu(env);
env->hflags &= ~HF_INHIBIT_IRQ_MASK; /* needed if sti is just before */
cs->halted = 1;
@@ -123,12 +122,10 @@ static QEMU_NORETURN void do_hlt(X86CPU *cpu)
void QEMU_NORETURN helper_hlt(CPUX86State *env, int next_eip_addend)
{
- X86CPU *cpu = env_archcpu(env);
-
cpu_svm_check_intercept_param(env, SVM_EXIT_HLT, 0, GETPC());
env->eip += next_eip_addend;
- do_hlt(cpu);
+ do_hlt(env);
}
void helper_monitor(CPUX86State *env, target_ulong ptr)
@@ -143,7 +140,6 @@ void helper_monitor(CPUX86State *env, target_ulong ptr)
void QEMU_NORETURN helper_mwait(CPUX86State *env, int next_eip_addend)
{
CPUState *cs = env_cpu(env);
- X86CPU *cpu = env_archcpu(env);
if ((uint32_t)env->regs[R_ECX] != 0) {
raise_exception_ra(env, EXCP0D_GPF, GETPC());
@@ -153,20 +149,18 @@ void QEMU_NORETURN helper_mwait(CPUX86State *env, int
next_eip_addend)
/* XXX: not complete but not completely erroneous */
if (cs->cpu_index != 0 || CPU_NEXT(cs) != NULL) {
- do_pause(cpu);
+ do_pause(env);
} else {
- do_hlt(cpu);
+ do_hlt(env);
}
}
void QEMU_NORETURN helper_pause(CPUX86State *env, int next_eip_addend)
{
- X86CPU *cpu = env_archcpu(env);
-
cpu_svm_check_intercept_param(env, SVM_EXIT_PAUSE, 0, GETPC());
env->eip += next_eip_addend;
- do_pause(cpu);
+ do_pause(env);
}
void QEMU_NORETURN helper_debug(CPUX86State *env)
--
2.25.1
- [PULL 28/50] target/i386: Reorder DisasContext members, (continued)
- [PULL 28/50] target/i386: Reorder DisasContext members, Richard Henderson, 2021/05/19
- [PULL 36/50] target/i386: Tidy svm_check_intercept from tcg, Richard Henderson, 2021/05/19
- [PULL 25/50] target/i386: Leave TF in DisasContext.flags, Richard Henderson, 2021/05/19
- [PULL 24/50] target/i386: Reduce DisasContext popl_esp_hack and rip_offset to uint8_t, Richard Henderson, 2021/05/19
- [PULL 39/50] target/i386: Cleanup read_crN, write_crN, lmsw, Richard Henderson, 2021/05/19
- [PULL 34/50] target/i386: Mark some helpers as noreturn, Richard Henderson, 2021/05/19
- [PULL 37/50] target/i386: Remove pc_start argument to gen_svm_check_intercept, Richard Henderson, 2021/05/19
- [PULL 35/50] target/i386: Simplify gen_debug usage, Richard Henderson, 2021/05/19
- [PULL 38/50] target/i386: Remove user stub for cpu_vmexit, Richard Henderson, 2021/05/19
- [PULL 33/50] target/i386: Eliminate SVM helpers for user-only, Richard Henderson, 2021/05/19
- [PULL 40/50] target/i386: Pass env to do_pause and do_hlt,
Richard Henderson <=
- [PULL 41/50] target/i386: Move invlpg, hlt, monitor, mwait to sysemu, Richard Henderson, 2021/05/19
- [PULL 42/50] target/i386: Unify invlpg, invlpga, Richard Henderson, 2021/05/19
- [PULL 43/50] target/i386: Inline user cpu_svm_check_intercept_param, Richard Henderson, 2021/05/19
- [PULL 45/50] target/i386: Exit tb after wrmsr, Richard Henderson, 2021/05/19
- [PULL 44/50] target/i386: Eliminate user stubs for read/write_crN, rd/wrmsr, Richard Henderson, 2021/05/19
- [PULL 48/50] target/i386: Create helper_check_io, Richard Henderson, 2021/05/19
- [PULL 50/50] target/i386: Remove user-only i/o stubs, Richard Henderson, 2021/05/19
- [PULL 47/50] target/i386: Pass in port to gen_check_io, Richard Henderson, 2021/05/19
- [PULL 46/50] target/i386: Tidy gen_check_io, Richard Henderson, 2021/05/19
- [PULL 49/50] target/i386: Move helper_check_io to sysemu, Richard Henderson, 2021/05/19