qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Any better way to access CPUArchState in vl.c?


From: Andreas Färber
Subject: Re: [Qemu-devel] Any better way to access CPUArchState in vl.c?
Date: Mon, 18 Jun 2012 12:01:19 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120421 Thunderbird/12.0

Hi Wei-Ren,

Am 18.06.2012 09:47, schrieb 陳韋任 (Wei-Ren Chen):
>   Say I want to print env->some_field in vl.c. I #include "dyngen-exec.h"
> in vl.c, but got compilation error immediately.
> 
>   /tmp/chenwj/qemu/dyngen-exec.h:64:10: error: attempt to use poisoned 
> "CPUArchState"
>   /tmp/chenwj/qemu/dyngen-exec.h:64:23: error: expected '=', ',', ';', 'asm' 
> or '__attribute__' before '*' token
>   /tmp/chenwj/qemu/dyngen-exec.h:64:24: error: attempt to use poisoned "env"
> 
> After googling, I figure out QEMU poison some identifiers which cannot be used
> in target indenpent code. Although we can get some_field by the following way,
> 
>   int some_field = &env->some_field;
> 
> but it's not very convenient if we have many field of CPUState want to 
> access. Is
> there a better way to do so? Thanks!

Poisoned is the "env" variable. You cannot just #include "dyngen-exec.h"
and expect it to be usable since AREG0 targets don't guarantee it's set
properly (may be NULL even with traditional targets at times).

CPUArchState should currently be usable in vl.c, you just need explicit
access to it (e.g., a function argument).
Question is, what are you trying to do? In particular, of which CPU
(think SMP) are you trying to print ->some_field? :)

Regards,
Andreas

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]