]> git.proxmox.com Git - mirror_qemu.git/commitdiff
cpu: Introduce env_archcpu
authorRichard Henderson <richard.henderson@linaro.org>
Sat, 23 Mar 2019 00:22:52 +0000 (17:22 -0700)
committerRichard Henderson <richard.henderson@linaro.org>
Mon, 10 Jun 2019 14:03:34 +0000 (07:03 -0700)
This will replace foo_env_get_cpu with a generic definition.
No changes to the target specific code so far.

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
include/exec/cpu-all.h

index 454f6d663f3eec0018dae97234f58a1cc1940789..c62f07b354d456b14d6791e8f8a354b3d05d41ea 100644 (file)
@@ -371,6 +371,17 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
 
 int cpu_exec(CPUState *cpu);
 
+/**
+ * env_archcpu(env)
+ * @env: The architecture environment
+ *
+ * Return the ArchCPU associated with the environment.
+ */
+static inline ArchCPU *env_archcpu(CPUArchState *env)
+{
+    return container_of(env, ArchCPU, env);
+}
+
 /**
  * env_cpu(env)
  * @env: The architecture environment
@@ -379,8 +390,7 @@ int cpu_exec(CPUState *cpu);
  */
 static inline CPUState *env_cpu(CPUArchState *env)
 {
-    ArchCPU *arch_cpu = container_of(env, ArchCPU, env);
-    return &arch_cpu->parent_obj;
+    return &env_archcpu(env)->parent_obj;
 }
 
 #endif /* CPU_ALL_H */