qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] add "info ioapic" monitor command


From: Luiz Capitulino
Subject: Re: [Qemu-devel] [PATCH] add "info ioapic" monitor command
Date: Tue, 29 Dec 2009 14:37:20 -0200

On Thu, 24 Dec 2009 17:02:42 +0200
Gleb Natapov <address@hidden> wrote:

> +
> +static const char *delivery_mode_string[] = {"fixed", "lowprio", "smi", 
> "res",
> +                                             "nmi", "init", "res", "extint"};
> +
> +void do_info_ioapic(Monitor *mon)
> +{
> +    int i;
> +
> +    if (!ioapic)
> +        return;
> +    for (i = 0; i < IOAPIC_NUM_PINS; i++) {
> +        uint64 e = ioapic->ioredtbl[i];
> +        monitor_printf(mon, "%2d: ", i);
> +        if (e & IOAPIC_LVT_MASKED) {
> +            monitor_printf(mon, "masked\n");
> +        } else {
> +            uint8_t vec = e & 0xff;
> +            uint8_t trig_mode = ((e >> 15) & 1);
> +            uint8_t dest = e >> 56;
> +            uint8_t dest_mode = (e >> 11) & 1;
> +            uint8_t delivery_mode = (e >> 8) & 7;
> +            uint8_t polarity = (e >> 13) & 1;
> +            monitor_printf(mon, "vec=%3d %s %s acive-%s %s dest=%d\n",
> +                           vec,
> +                           delivery_mode_string[delivery_mode],
> +                           dest_mode ? "logical":"physical",
> +                           polarity ? "low" : "high",
> +                           trig_mode ? "level": "edge",
> +                           dest);
> +        }
> +    }
> +}

 New Monitor handlers should return QObjects, monitor_printf()
can only be used in the print handler.

 You can take a look at qemu_chr_info() for an example, as it does
what I think you should do here: build a qdict for each pin and
return a qlist or return another qdict if it makes sense (or will
make in the future) to have more the one ioapic.

 I'm still thinking in ways to make the work of writing the new
Monitor handlers easier..




reply via email to

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