target-i386: log_cpu_state() cleanups
cover target-i386: log_cpu_state() cleanups
Hello,
As a follow-up to my CPUState part 11 series changing log_cpu_state[_mask]() argument to CPUState, these patches propagate X86CPU argument where possible. This is in response to rth asking about type/placement of variables.
I note that x86 had me confused in two other places where TCG helpers were not declared using the HELPER() macro. I intend to automate CPUFooState/FooCPU conversion for TCG helpers, but for now those arguments cannot be changed yet.
Regards,
Andreas
Andreas Färber (3):
target-i386: Change LOG_PCALL_STATE() argument to CPUState
target-i386: Change do_interrupt_all() argument to X86CPU
target-i386: Change do_smm_enter() argument to X86CPU
cpu-exec.c | 2 +- target-i386/cpu.h | 2 +- target-i386/seg_helper.c | 19 ++++++++++--------- target-i386/smm_helper.c | 6 +++--- 4 files changed, 15 insertions(+), 14 deletions(-)
Signature · 1 line
1.8.1.4
PATCH 1/3 target-i386: Change LOG_PCALL_STATE() argument to CPUState
Since log_cpu_state_mask() argument was changed to CPUState, CPUArchState is no longer needed.
Choose CPUState rather than X86CPU to not hide type mismatches with CPU().
--- target-i386/seg_helper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
target-i386/seg_helper.c +5 -5
@@ -30,11 +30,11 @@#ifdef DEBUG_PCALL # define LOG_PCALL (...) qemu_log_mask(CPU_LOG_PCALL, ## __VA_ARGS__) -# define LOG_PCALL_STATE (env) \ - log_cpu_state_mask(CPU_LOG_PCALL, CPU(x86_env_get_cpu(env)), CPU_DUMP_CCOP) +# define LOG_PCALL_STATE (cpu) \ + log_cpu_state_mask(CPU_LOG_PCALL, (cpu), CPU_DUMP_CCOP)#else # define LOG_PCALL (...) do { } while (0) -# define LOG_PCALL_STATE (env) do { } while (0) +# define LOG_PCALL_STATE (cpu) do { } while (0)#endif /* return non zero if error */
@@ -1685,7 +1685,7 @@ void helper_lcall_protected(CPUX86State *env, int new_cs, target_ulong new_eip, next_eip = env->eip + next_eip_addend;LOG_PCALL ("lcall %04x:%08x s=%d\n" , new_cs, (uint32_t )new_eip, shift); -LOG_PCALL_STATE (env); +LOG_PCALL_STATE (CPU (x86_env_get_cpu (env)));if ((new_cs &0xfffc ) ==0 ) {raise_exception_err (env,EXCP0D_GPF ,0 ); }
@@ -2019,7 +2019,7 @@ static inline void helper_ret_protected(CPUX86State *env, int shift, }LOG_PCALL ("lret new %04x:" TARGET_FMT_lx" s=%d addend=0x%x\n" , new_cs, new_eip, shift, addend); -LOG_PCALL_STATE (env); +LOG_PCALL_STATE (CPU (x86_env_get_cpu (env)));if ((new_cs &0xfffc ) ==0 ) {raise_exception_err (env,EXCP0D_GPF , new_cs &0xfffc ); }
Signature · 1 line
1.8.1.4
PATCH 2/3 target-i386: Change do_interrupt_all() argument to X86CPU
In reply to Andreas Färberlog_cpu_state() needs CPUState.
--- target-i386/seg_helper.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
target-i386/seg_helper.c +5 -4
@@ -1160,12 +1160,13 @@ static void handle_even_inj(CPUX86State *env, int intno, int is_int,* the int instruction. next_eip is the env->eip value AFTER the interrupt * instruction. It is only relevant if is_int is TRUE. */ -static void do_interrupt_all (CPUX86State *env,int intno,int is_int, +static void do_interrupt_all (X86CPU *cpu,int intno,int is_int,int error_code,target_ulong next_eip,int is_hw) { +CPUX86State *env = &cpu->env; +if (qemu_loglevel_mask (CPU_LOG_INT )) {if ((env->cr[0 ] &CR0_PE_MASK )) { -X86CPU *cpu =x86_env_get_cpu (env);static int count; qemu_log("%6d: v=%02x e=%04x i=%d cpl=%d IP=%04x:" TARGET_FMT_lx
@@ -1253,7 +1254,7 @@ void x86_cpu_do_interrupt(CPUState *cs)/* simulate a real cpu exception. On i386, it can trigger new exceptions, but we do not handle double or triple faults yet. */ -do_interrupt_all (env, env->exception_index, +do_interrupt_all (cpu, env->exception_index, env->exception_is_int, env->error_code, env->exception_next_eip,0 );
@@ -1264,7 +1265,7 @@ void x86_cpu_do_interrupt(CPUState *cs)void do_interrupt_x86_hardirq (CPUX86State *env,int intno,int is_hw) { -do_interrupt_all (env, intno,0 ,0 ,0 , is_hw); +do_interrupt_all (x86_env_get_cpu (env), intno,0 ,0 ,0 , is_hw); } void helper_enter_level(CPUX86State *env, int level, int data32,
Signature · 1 line
1.8.1.4
PATCH 3/3 target-i386: Change do_smm_enter() argument to X86CPU
In reply to Andreas Färberlog_cpu_state_mask() needs CPUState.
--- cpu-exec.c | 2 +- target-i386/cpu.h | 2 +- target-i386/smm_helper.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)
cpu-exec.c +1 -1
@@ -331,7 +331,7 @@ int cpu_exec(CPUArchState *env)cpu_svm_check_intercept_param (env,SVM_EXIT_SMI ,0 ); cpu->interrupt_request &= ~CPU_INTERRUPT_SMI ; -do_smm_enter (env); +do_smm_enter (x86_env_get_cpu (env)); next_tb =0 ; }else if ((interrupt_request &CPU_INTERRUPT_NMI ) && !(env->hflags2 &HF2_NMI_MASK )) {
target-i386/cpu.h +1 -1
@@ -1220,7 +1220,7 @@ void cpu_vmexit(CPUX86State *nenv, uint32_t exit_code, uint64_t exit_info_1);/* seg_helper.c */ void do_interrupt_x86_hardirq (CPUX86State *env,int intno,int is_hw); -void do_smm_enter (CPUX86State *env1); +void do_smm_enter (X86CPU *cpu);void cpu_report_tpr_access (CPUX86State *env,TPRAccess access);
target-i386/smm_helper.c +3 -3
@@ -24,7 +24,7 @@#if defined(CONFIG_USER_ONLY ) -void do_smm_enter (CPUX86State *env) +void do_smm_enter (X86CPU *cpu) { }
@@ -40,9 +40,9 @@ void helper_rsm(CPUX86State *env)#define SMM_REVISION_ID 0x00020000#endif -void do_smm_enter (CPUX86State *env) +void do_smm_enter (X86CPU *cpu) { -X86CPU *cpu =x86_env_get_cpu (env); +CPUX86State *env = &cpu->env;target_ulong sm_state;SegmentCache *dt;int i, offset;
Signature · 1 line
1.8.1.4
Am 03.07.2013 20:42, schrieb Andreas Färber:
Quoted 5 lines
Hello,
As a follow-up to my CPUState part 11 series changing log_cpu_state[_mask]() argument to CPUState, these patches propagate X86CPU argument where possible. This is in response to rth asking about type/placement of variables.
[...]
Quoted 4 lines
Andreas Färber (3):
target-i386: ChangeLOG_PCALL_STATE()argument to CPUState
target-i386: Changedo_interrupt_all()argument to X86CPU
target-i386: Changedo_smm_enter()argument to X86CPU
Inserted 2-3 before and 1 after log_cpu_state*() commit, adapting commit messages:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu
Andreas
Quoted 5 lines
cpu-exec.c | 2 +- target-i386/cpu.h | 2 +- target-i386/seg_helper.c | 19 ++++++++++--------- target-i386/smm_helper.c | 6 +++--- 4 files changed, 15 insertions(+), 14 deletions(-)
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg