提交 083dc73d 编写于 作者: R Richard Henderson

cpu: Introduce env_archcpu

This will replace foo_env_get_cpu with a generic definition.
No changes to the target specific code so far.
Reviewed-by: NAlistair Francis <alistair.francis@wdc.com>
Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: NRichard Henderson <richard.henderson@linaro.org>
上级 29a0af61
...@@ -371,6 +371,17 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr, ...@@ -371,6 +371,17 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
int cpu_exec(CPUState *cpu); 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_cpu(env)
* @env: The architecture environment * @env: The architecture environment
...@@ -379,8 +390,7 @@ int cpu_exec(CPUState *cpu); ...@@ -379,8 +390,7 @@ int cpu_exec(CPUState *cpu);
*/ */
static inline CPUState *env_cpu(CPUArchState *env) static inline CPUState *env_cpu(CPUArchState *env)
{ {
ArchCPU *arch_cpu = container_of(env, ArchCPU, env); return &env_archcpu(env)->parent_obj;
return &arch_cpu->parent_obj;
} }
#endif /* CPU_ALL_H */ #endif /* CPU_ALL_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册