qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH qom-cpu 0/3] target-i386: log_cpu_state() cleanups
@ 2013-07-03 18:42 Andreas Färber
  2013-07-03 18:42 ` [Qemu-devel] [PATCH qom-cpu 1/3] target-i386: Change LOG_PCALL_STATE() argument to CPUState Andreas Färber
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Andreas Färber @ 2013-07-03 18:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, rth

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

Cc: Richard Henderson <rth@twiddle.net>

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(-)

-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH qom-cpu 1/3] target-i386: Change LOG_PCALL_STATE() argument to CPUState
  2013-07-03 18:42 [Qemu-devel] [PATCH qom-cpu 0/3] target-i386: log_cpu_state() cleanups Andreas Färber
@ 2013-07-03 18:42 ` Andreas Färber
  2013-07-03 18:42 ` [Qemu-devel] [PATCH qom-cpu 2/3] target-i386: Change do_interrupt_all() argument to X86CPU Andreas Färber
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Andreas Färber @ 2013-07-03 18:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, rth

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().

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/seg_helper.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/target-i386/seg_helper.c b/target-i386/seg_helper.c
index 42ee823..e0552d0 100644
--- a/target-i386/seg_helper.c
+++ b/target-i386/seg_helper.c
@@ -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);
     }
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH qom-cpu 2/3] target-i386: Change do_interrupt_all() argument to X86CPU
  2013-07-03 18:42 [Qemu-devel] [PATCH qom-cpu 0/3] target-i386: log_cpu_state() cleanups Andreas Färber
  2013-07-03 18:42 ` [Qemu-devel] [PATCH qom-cpu 1/3] target-i386: Change LOG_PCALL_STATE() argument to CPUState Andreas Färber
@ 2013-07-03 18:42 ` Andreas Färber
  2013-07-03 18:42 ` [Qemu-devel] [PATCH qom-cpu 3/3] target-i386: Change do_smm_enter() " Andreas Färber
  2013-07-06  0:33 ` [Qemu-devel] [PATCH qom-cpu 0/3] target-i386: log_cpu_state() cleanups Andreas Färber
  3 siblings, 0 replies; 5+ messages in thread
From: Andreas Färber @ 2013-07-03 18:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, rth

log_cpu_state() needs CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/seg_helper.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/target-i386/seg_helper.c b/target-i386/seg_helper.c
index e0552d0..e789102 100644
--- a/target-i386/seg_helper.c
+++ b/target-i386/seg_helper.c
@@ -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,
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH qom-cpu 3/3] target-i386: Change do_smm_enter() argument to X86CPU
  2013-07-03 18:42 [Qemu-devel] [PATCH qom-cpu 0/3] target-i386: log_cpu_state() cleanups Andreas Färber
  2013-07-03 18:42 ` [Qemu-devel] [PATCH qom-cpu 1/3] target-i386: Change LOG_PCALL_STATE() argument to CPUState Andreas Färber
  2013-07-03 18:42 ` [Qemu-devel] [PATCH qom-cpu 2/3] target-i386: Change do_interrupt_all() argument to X86CPU Andreas Färber
@ 2013-07-03 18:42 ` Andreas Färber
  2013-07-06  0:33 ` [Qemu-devel] [PATCH qom-cpu 0/3] target-i386: log_cpu_state() cleanups Andreas Färber
  3 siblings, 0 replies; 5+ messages in thread
From: Andreas Färber @ 2013-07-03 18:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, rth

log_cpu_state_mask() needs CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 cpu-exec.c               | 2 +-
 target-i386/cpu.h        | 2 +-
 target-i386/smm_helper.c | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cpu-exec.c b/cpu-exec.c
index 9c46846..6c784a7 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -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)) {
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 2849672..2d005b3 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -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);
 
diff --git a/target-i386/smm_helper.c b/target-i386/smm_helper.c
index 5abdfc8..6cb4551 100644
--- a/target-i386/smm_helper.c
+++ b/target-i386/smm_helper.c
@@ -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;
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH qom-cpu 0/3] target-i386: log_cpu_state() cleanups
  2013-07-03 18:42 [Qemu-devel] [PATCH qom-cpu 0/3] target-i386: log_cpu_state() cleanups Andreas Färber
                   ` (2 preceding siblings ...)
  2013-07-03 18:42 ` [Qemu-devel] [PATCH qom-cpu 3/3] target-i386: Change do_smm_enter() " Andreas Färber
@ 2013-07-06  0:33 ` Andreas Färber
  3 siblings, 0 replies; 5+ messages in thread
From: Andreas Färber @ 2013-07-06  0:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: rth

Am 03.07.2013 20:42, schrieb Andreas Färber:
> 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.
[...]
> 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

Inserted 2-3 before and 1 after log_cpu_state*() commit, adapting commit
messages:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu

Andreas

>  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(-)

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-07-06  0:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-03 18:42 [Qemu-devel] [PATCH qom-cpu 0/3] target-i386: log_cpu_state() cleanups Andreas Färber
2013-07-03 18:42 ` [Qemu-devel] [PATCH qom-cpu 1/3] target-i386: Change LOG_PCALL_STATE() argument to CPUState Andreas Färber
2013-07-03 18:42 ` [Qemu-devel] [PATCH qom-cpu 2/3] target-i386: Change do_interrupt_all() argument to X86CPU Andreas Färber
2013-07-03 18:42 ` [Qemu-devel] [PATCH qom-cpu 3/3] target-i386: Change do_smm_enter() " Andreas Färber
2013-07-06  0:33 ` [Qemu-devel] [PATCH qom-cpu 0/3] target-i386: log_cpu_state() cleanups Andreas Färber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).