diff mbox

[3/4] cpus: Change tcg_cpu_exec arg to cpu, not env

Message ID 6c2b2815082aaab8580d79cc529150d46c417eaf.1432534114.git.crosthwaite.peter@gmail.com
State New
Headers show

Commit Message

Peter Crosthwaite May 25, 2015, 6:22 a.m. UTC
The sole caller of this function navigates the cpu->env_ptr only for
this function to take it back the cpu pointer straight away. Pass in
cpu pointer instead and grab the env pointer locally in the function.
Removes a core code usage of ENV_GET_CPU.

Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---
 cpus.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Andreas Färber June 5, 2015, 2:48 p.m. UTC | #1
Am 25.05.2015 um 15:22 schrieb Peter Crosthwaite:
> The sole caller of this function navigates the cpu->env_ptr only for
> this function to take it back the cpu pointer straight away. Pass in
> cpu pointer instead and grab the env pointer locally in the function.
> Removes a core code usage of ENV_GET_CPU.

Please follow the convention of writing "foo()" for any function or
parameterized macro, here and elsewhere.

> 
> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
> ---
>  cpus.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

Reviewed-by: Andreas Färber <afaerber@suse.de>

Thanks,
Andreas
diff mbox

Patch

diff --git a/cpus.c b/cpus.c
index de6469f..1b8f05a 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1314,9 +1314,9 @@  int vm_stop_force_state(RunState state)
     }
 }
 
-static int tcg_cpu_exec(CPUArchState *env)
+static int tcg_cpu_exec(CPUState *cpu)
 {
-    CPUState *cpu = ENV_GET_CPU(env);
+    CPUArchState *env = cpu->env_ptr;
     int ret;
 #ifdef CONFIG_PROFILER
     int64_t ti;
@@ -1378,13 +1378,12 @@  static void tcg_exec_all(void)
     }
     for (; next_cpu != NULL && !exit_request; next_cpu = CPU_NEXT(next_cpu)) {
         CPUState *cpu = next_cpu;
-        CPUArchState *env = cpu->env_ptr;
 
         qemu_clock_enable(QEMU_CLOCK_VIRTUAL,
                           (cpu->singlestep_enabled & SSTEP_NOTIMER) == 0);
 
         if (cpu_can_run(cpu)) {
-            r = tcg_cpu_exec(env);
+            r = tcg_cpu_exec(cpu);
             if (r == EXCP_DEBUG) {
                 cpu_handle_guest_debug(cpu);
                 break;