aboutsummaryrefslogtreecommitdiff
path: root/target-lm32/cpu.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-01-17 12:13:41 +0100
committerAndreas Färber <afaerber@suse.de>2013-02-16 14:51:00 +0100
commitc05efcb18ee30cdf2b00b3512aa0f5233b52911f (patch)
tree4d51c9851f304e7867b10877340914bf23c0fb59 /target-lm32/cpu.c
parent907a5e32f293a0af8875973d4cce12b96bea5bae (diff)
downloadqemu-c05efcb18ee30cdf2b00b3512aa0f5233b52911f.zip
qemu-c05efcb18ee30cdf2b00b3512aa0f5233b52911f.tar.gz
qemu-c05efcb18ee30cdf2b00b3512aa0f5233b52911f.tar.bz2
cpu: Add CPUArchState pointer to CPUState
The target-specific ENV_GET_CPU() macros have allowed us to navigate from CPUArchState to CPUState. The reverse direction was not supported. Avoid introducing CPU_GET_ENV() macros by initializing an untyped pointer that is initialized in derived instance_init functions. The field may not be called "env" due to it being poisoned. Acked-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'target-lm32/cpu.c')
-rw-r--r--target-lm32/cpu.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/target-lm32/cpu.c b/target-lm32/cpu.c
index 5f16734..a2badb5 100644
--- a/target-lm32/cpu.c
+++ b/target-lm32/cpu.c
@@ -56,10 +56,12 @@ static void lm32_cpu_realizefn(DeviceState *dev, Error **errp)
static void lm32_cpu_initfn(Object *obj)
{
+ CPUState *cs = CPU(obj);
LM32CPU *cpu = LM32_CPU(obj);
CPULM32State *env = &cpu->env;
static bool tcg_initialized;
+ cs->env_ptr = env;
cpu_exec_init(env);
env->flags = 0;