On 6 March 2015 at 04:18, David Gibson <da...@gibson.dropbear.id.au> wrote: > The hmp commands "irq" and "pic" are a bit of a mess. They're implemented > on a number of targets, but not all. On sparc32 and LM32 they do target > specific things, but on the remainder (i386, ppc and mips) they call into > the i8259 PIC code. > > But really, what these commands do shouldn't be dependent on the target > arch, but on the specific machine that's in use. On ppc, for example, > the "prep" machine usually does have an ISA bridge with an i8259, but > most of the other machine types have never had an i8259 at all. Similarly > the sparc specific target would stop working if we ever had a sparc32 > machine that wasn't sun4m. > > This patch cleans things up by implementing these hmp commands on all > targets via a MachineClass callback. If the callback is NULL, for now > we fallback to target specific defaults that match the existing behaviour. > The hope is we can remove those later with target specific cleanups.
I would rather we provided a function for "register a monitor command" that devices could call. Then we could (for instance) move the CPU architecture specific monitor commands out to target-* where they belong, and generally chop down the amount of ifdeffery in monitor.c. A per-machine hook seems insufficiently flexible. -- PMM