From: David Gibson <david@gibson.dropbear.id.au>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: "Alexander Graf" <agraf@suse.de>,
qemu-devel@nongnu.org, "Markus Armbruster" <armbru@redhat.com>,
"Luiz Capitulino" <lcapitulino@redhat.com>,
qemu-ppc@nongnu.org, "Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH qemu 1/2] monitor: Add CPU class callback to read registers for monitor
Date: Wed, 12 Aug 2015 11:12:04 +1000 [thread overview]
Message-ID: <20150812011204.GC19634@voom.fritz.box> (raw)
In-Reply-To: <1438838757-32352-2-git-send-email-aik@ozlabs.ru>
[-- Attachment #1: Type: text/plain, Size: 2542 bytes --]
On Thu, Aug 06, 2015 at 03:25:56PM +1000, Alexey Kardashevskiy wrote:
> At the moment the monitor only prints registers from monitor_defs.
> Some may not be supported but it will print those anyway, other
> may be missing in the list so monitor_defs needs an update every time
> new register is added.
>
> This defines a CPUClass callback to read various registers from CPU.
>
> Next patch makes use of it.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> include/qom/cpu.h | 1 +
> monitor.c | 14 +++++++++++++-
> 2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index 20aabc9..fcf981f 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -144,6 +144,7 @@ typedef struct CPUClass {
> int flags);
> void (*dump_statistics)(CPUState *cpu, FILE *f,
> fprintf_function cpu_fprintf, int flags);
> + int (*get_monitor_def)(CPUState *cs, const char *name, uint64_t *pval);
> int64_t (*get_arch_id)(CPUState *cpu);
> bool (*get_paging_enabled)(const CPUState *cpu);
> void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
> diff --git a/monitor.c b/monitor.c
> index aeea2b5..bdfcacc 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3303,13 +3303,25 @@ static int get_monitor_def(target_long *pval, const char *name)
> {
> const MonitorDef *md;
> void *ptr;
> + CPUState *cs = mon_get_cpu();
> + CPUClass *cc = CPU_GET_CLASS(cs);
> +
> + if (cc->get_monitor_def) {
> + uint64_t tmp = 0;
> + int ret = cc->get_monitor_def(cs, name, &tmp);
> +
> + if (!ret) {
> + *pval = (target_long) tmp;
> + }
> + return ret;
> + }
>
> for(md = monitor_defs; md->name != NULL; md++) {
> if (compare_cmd(name, md->name)) {
> if (md->get_value) {
> *pval = md->get_value(md, md->offset);
> } else {
> - CPUArchState *env = mon_get_cpu_env();
> + CPUArchState *env = cs->env_ptr;
> ptr = (uint8_t *)env + md->offset;
> switch(md->type) {
> case MD_I32:
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-08-12 2:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-06 5:25 [Qemu-devel] [PATCH qemu 0/2] monitor/ppc: Print correct SPRs Alexey Kardashevskiy
2015-08-06 5:25 ` [Qemu-devel] [PATCH qemu 1/2] monitor: Add CPU class callback to read registers for monitor Alexey Kardashevskiy
2015-08-12 1:12 ` David Gibson [this message]
2015-08-06 5:25 ` [Qemu-devel] [PATCH qemu 2/2] target-ppc: Define get_monitor_def Alexey Kardashevskiy
2015-08-06 6:33 ` Thomas Huth
2015-08-06 7:00 ` Alexey Kardashevskiy
2015-08-06 7:07 ` Thomas Huth
2015-08-12 1:21 ` David Gibson
2015-08-13 15:52 ` [Qemu-devel] [PATCH qemu v2] " Alexey Kardashevskiy
2015-08-13 22:39 ` David Gibson
2015-08-14 3:34 ` [Qemu-devel] [PATCH qemu v3] " Alexey Kardashevskiy
2015-09-07 1:26 ` Alexey Kardashevskiy
2015-09-23 3:40 ` David Gibson
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=20150812011204.GC19634@voom.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=armbru@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.