From: "Andreas Färber" <afaerber@suse.de>
To: "\"陳韋任 (Wei-Ren Chen)\"" <chenwj@iis.sinica.edu.tw>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Any better way to access CPUArchState in vl.c?
Date: Mon, 18 Jun 2012 12:01:19 +0200 [thread overview]
Message-ID: <4FDEFC6F.10104@suse.de> (raw)
In-Reply-To: <20120618074756.GA47810@cs.nctu.edu.tw>
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
next prev parent reply other threads:[~2012-06-18 10:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-18 7:47 [Qemu-devel] Any better way to access CPUArchState in vl.c? 陳韋任 (Wei-Ren Chen)
2012-06-18 10:01 ` Andreas Färber [this message]
2012-06-19 9:02 ` 陳韋任 (Wei-Ren Chen)
2012-06-19 9:54 ` Andreas Färber
2012-06-19 11:54 ` 陳韋任 (Wei-Ren Chen)
2012-06-19 12:08 ` Peter Maydell
2012-06-20 8:03 ` 陳韋任 (Wei-Ren Chen)
2012-06-19 12:09 ` Peter Crosthwaite
2012-06-19 13:21 ` Andreas Färber
2012-06-19 12:12 ` Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FDEFC6F.10104@suse.de \
--to=afaerber@suse.de \
--cc=chenwj@iis.sinica.edu.tw \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).