[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 40/50] target/i386: Pass env to do_pause and do_hlt
From: |
Richard Henderson |
Subject: |
[PATCH 40/50] target/i386: Pass env to do_pause and do_hlt |
Date: |
Sun, 28 Feb 2021 15:23:11 -0800 |
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>
---
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 b0d3c61f13..20bf4771e7 100644
--- a/target/i386/tcg/misc_helper.c
+++ b/target/i386/tcg/misc_helper.c
@@ -100,19 +100,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;
@@ -122,12 +121,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)
@@ -142,7 +139,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());
@@ -152,20 +148,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
- [PATCH 25/50] target/i386: Leave TF in DisasContext.flags, (continued)
- [PATCH 25/50] target/i386: Leave TF in DisasContext.flags, Richard Henderson, 2021/02/28
- [PATCH 32/50] target/i386: Implement skinit in translate.c, Richard Henderson, 2021/02/28
- [PATCH 30/50] target/i386: Assert !SVME for user-only, Richard Henderson, 2021/02/28
- [PATCH 31/50] target/i386: Assert !GUEST for user-only, Richard Henderson, 2021/02/28
- [PATCH 33/50] target/i386: Eliminate SVM helpers for user-only, Richard Henderson, 2021/02/28
- [PATCH 35/50] target/i386: Simplify gen_debug usage, Richard Henderson, 2021/02/28
- [PATCH 34/50] target/i386: Mark some helpers as noreturn, Richard Henderson, 2021/02/28
- [PATCH 38/50] target/i386: Remove user stub for cpu_vmexit, Richard Henderson, 2021/02/28
- [PATCH 37/50] target/i386: Remove pc_start argument to gen_svm_check_intercept, Richard Henderson, 2021/02/28
- [PATCH 39/50] target/i386: Cleanup read_crN, write_crN, lmsw, Richard Henderson, 2021/02/28
- [PATCH 40/50] target/i386: Pass env to do_pause and do_hlt,
Richard Henderson <=
- [PATCH 41/50] target/i386: Move invlpg, hlt, monitor, mwait to sysemu, Richard Henderson, 2021/02/28
- [PATCH 43/50] target/i386: Inline user cpu_svm_check_intercept_param, Richard Henderson, 2021/02/28
- [PATCH 44/50] target/i386: Eliminate user stubs for read/write_crN, rd/wrmsr, Richard Henderson, 2021/02/28
- [PATCH 45/50] target/i386: Exit tb after wrmsr, Richard Henderson, 2021/02/28
- [PATCH 42/50] target/i386: Unify invlpg, invlpga, Richard Henderson, 2021/02/28
- [PATCH 46/50] target/i386: Tidy gen_check_io, Richard Henderson, 2021/02/28
- [PATCH 47/50] target/i386: Pass in port to gen_check_io, Richard Henderson, 2021/02/28
- [PATCH 49/50] target/i386: Move helper_check_io to sysemu, Richard Henderson, 2021/02/28
- [PATCH 50/50] target/i386: Remove user-only i/o stubs, Richard Henderson, 2021/02/28
- [PATCH 48/50] target/i386: Create helper_check_io, Richard Henderson, 2021/02/28
- Prev by Date:
[PATCH 39/50] target/i386: Cleanup read_crN, write_crN, lmsw
- Next by Date:
[PATCH 41/50] target/i386: Move invlpg, hlt, monitor, mwait to sysemu
- Previous by thread:
[PATCH 39/50] target/i386: Cleanup read_crN, write_crN, lmsw
- Next by thread:
[PATCH 41/50] target/i386: Move invlpg, hlt, monitor, mwait to sysemu
- Index(es):