On Thu, Jun 06, 2024 at 10:02:50AM -0400, Don Porter wrote: > Signed-off-by: Don Porter <por...@cs.unc.edu> > --- > include/hw/core/sysemu-cpu-ops.h | 6 + > include/monitor/monitor.h | 4 + > monitor/hmp-cmds-target.c | 5 +- > target/i386/cpu.c | 1 + > target/i386/cpu.h | 1 + > target/i386/monitor.c | 354 ++++--------------------------- > 6 files changed, 60 insertions(+), 311 deletions(-) > > diff --git a/include/hw/core/sysemu-cpu-ops.h > b/include/hw/core/sysemu-cpu-ops.h > index bf3de3e004..3bef129460 100644 > --- a/include/hw/core/sysemu-cpu-ops.h > +++ b/include/hw/core/sysemu-cpu-ops.h > @@ -250,6 +250,12 @@ typedef struct SysemuCPUOps { > void (*mon_print_pte) (Monitor *mon, CPUArchState *env, hwaddr addr, > hwaddr pte); > > + /** > + * @mon_print_mem: Hook called by the monitor to print a range > + * of memory mappings in 'info mem' > + */ > + bool (*mon_print_mem)(CPUState *cs, struct mem_print_state *state); > + Similar to the suggestion on the previus patch. I'd suggest this method gains a 'GString *str' parameter, which it will print into. Then add a QMP command that returns HumandReadableText, and call that from the HMP command. This completely separates the architecture code from the monitor APIs.
With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|