qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v12 2/9] target-avr: adding AVR CPU features/fla


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v12 2/9] target-avr: adding AVR CPU features/flavors
Date: Mon, 25 Jul 2016 19:42:23 +0100

On 24 July 2016 at 01:02, Michael Rolnik <address@hidden> wrote:
> Signed-off-by: Michael Rolnik <address@hidden>
> ---
>  target-avr/cpu.c     | 313 
> ++++++++++++++++++++++++++++++++++++++++++++++++++-
>  target-avr/cpu.h     |  48 ++++++++
>  target-avr/machine.c |   1 +
>  3 files changed, 361 insertions(+), 1 deletion(-)
>
> diff --git a/target-avr/cpu.c b/target-avr/cpu.c
> index 7e8d34b..0ee4930 100644
> --- a/target-avr/cpu.c
> +++ b/target-avr/cpu.c
> @@ -204,6 +204,302 @@ static void avr_cpu_class_init(ObjectClass *oc, void 
> *data)
>  static const AVRCPUInfo avr_cpus[] = {
> -    {   .name = "any",      .initfn = avr_any_initfn },
> +    {.name = "avr1", .initfn = avr_avr1_initfn},
> +    {.name = "avr2", .initfn = avr_avr2_initfn},
> +    {.name = "avr25", .initfn = avr_avr25_initfn},
> +    {.name = "avr3", .initfn = avr_avr3_initfn},
> +    {.name = "avr31", .initfn = avr_avr31_initfn},
> +    {.name = "avr35", .initfn = avr_avr35_initfn},
> +    {.name = "avr4", .initfn = avr_avr4_initfn},
> +    {.name = "avr5", .initfn = avr_avr5_initfn},
> +    {.name = "avr51", .initfn = avr_avr51_initfn},
> +    {.name = "avr6", .initfn = avr_avr6_initfn},
> +    {.name = "xmega2", .initfn = avr_xmega2_initfn},
> +    {.name = "xmega4", .initfn = avr_xmega4_initfn},
> +    {.name = "xmega5", .initfn = avr_xmega5_initfn},
> +    {.name = "xmega6", .initfn = avr_xmega6_initfn},
> +    {.name = "xmega7", .initfn = avr_xmega7_initfn},
> +    {.name = "any", .initfn = avr_any_initfn },

If we have all these real CPUs we probably don't want the "any" CPU,
especially since it has no feature bits set at all.
(The usual purpose of an "any" CPU is for linux-user emulation,
where it represents a CPU with all feature bits set so you can
run any Linux binary regardless of what CPU it was compiled
from. For system emulation you're typically emulating a real
board and you know what CPU you want; and also the differences
between real CPUs are often more complicated than simple
"has/doesn't have feature X".)

>  };
>
> diff --git a/target-avr/machine.c b/target-avr/machine.c
> index 5c8049e..b0f5ca8 100644
> --- a/target-avr/machine.c
> +++ b/target-avr/machine.c
> @@ -98,6 +98,7 @@ const VMStateDescription vms_avr_cpu = {
>      .version_id         = 0,
>      .minimum_version_id = 0,
>      .fields = (VMStateField[]) {
> +        VMSTATE_UINT32(env.features, AVRCPU),

Feature bits are set once at CPU creation and never change, so there is
no need to migrate them.

>          VMSTATE_UINT32(env.pc_w, AVRCPU),
>          VMSTATE_UINT32(env.sp, AVRCPU),
>
> --
> 2.4.9 (Apple Git-60)

thanks
-- PMM



reply via email to

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