qemu-ppc
[Top][All Lists]
Advanced

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

Re: [Qemu-ppc] [RFC/PATCH] monitor/ppc: Access all SPRs from the monitor


From: David Gibson
Subject: Re: [Qemu-ppc] [RFC/PATCH] monitor/ppc: Access all SPRs from the monitor
Date: Wed, 30 Sep 2015 16:03:55 +1000
User-agent: Mutt/1.5.23 (2014-03-12)

On Sun, Sep 27, 2015 at 04:31:16PM +1000, Benjamin Herrenschmidt wrote:
> We already have a table with all supported SPRs along with their names,
> so let's use that rather than a duplicate table that is perpetually
> out of sync in the monitor code.
> 
> This adds a new monitor hook target_extra_monitor_def() which is called
> if nothing is found is the normal table. We still use the old mechanism
> for anything that isn't an SPR.
> 
> Signed-off-by: Benjamin Herrenschmidt <address@hidden>

This looks like a good idea, but it seems to be a slightly different
approach from the one taken by some rather similar patches Alexey
posted recently.

Would you care to co-ordinate on which of those approaches to go ahead
with?

[snip]
> @@ -253,3 +180,23 @@ const MonitorDef *target_monitor_defs(void)
>  {
>      return monitor_defs;
>  }
> +
> +int target_extra_monitor_def(uint64_t *pval, const char *name)
> +{
> +     /* On ppc, search through the SPRs so we can print any of them */
> +    {
       ^
Also, this appears to be a redundant set of braces.

> +        CPUArchState *env = mon_get_cpu_env();
> +        ppc_spr_t *spr_cb = env->spr_cb;
> +        int i;
> +
> +        for (i = 0; i < 1024; i++) {
> +            if (!spr_cb[i].name || strcasecmp(name, spr_cb[i].name)) {
> +                continue;
> +            }
> +            *pval = env->spr[i];
> +            return 0;
> +        }
> +    }
> +    return -1;
> +}
> +
> 
> 
> 

-- 
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: pgpKxTbzyDqPY.pgp
Description: PGP signature


reply via email to

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