On Fri, Jun 07, 2024 at 08:02:51AM +0200, Philippe Mathieu-Daudé wrote: > Hi Don, > > (Cc'ing Daniel for HumanReadableText) > > On 6/6/24 16:02, Don Porter wrote: > > Signed-off-by: Don Porter <por...@cs.unc.edu> > > --- > > include/hw/core/sysemu-cpu-ops.h | 7 + > > monitor/hmp-cmds-target.c | 1 + > > target/i386/cpu.h | 2 + > > target/i386/monitor.c | 217 ++++++------------------------- > > 4 files changed, 53 insertions(+), 174 deletions(-) > > > > diff --git a/include/hw/core/sysemu-cpu-ops.h > > b/include/hw/core/sysemu-cpu-ops.h > > index eb16a1c3e2..bf3de3e004 100644 > > --- a/include/hw/core/sysemu-cpu-ops.h > > +++ b/include/hw/core/sysemu-cpu-ops.h > > @@ -243,6 +243,13 @@ typedef struct SysemuCPUOps { > > bool (*mon_flush_page_print_state)(CPUState *cs, > > struct mem_print_state *state); > > + /** > > + * @mon_print_pte: Hook called by the monitor to print a page > > + * table entry at address addr, with contents pte. > > + */ > > + void (*mon_print_pte) (Monitor *mon, CPUArchState *env, hwaddr addr, > > + hwaddr pte); > > IMO the SysemuCPUOps prototype should not use the monitor and return > a HumanReadableText: > > HumanReadableText *(*mon_print_pte)(CPUArchState *env, > hwaddr addr, hwaddr pte); > > Then define a QMP handler, itself registered to the monitor using > monitor_register_hmp_info_hrt().
IIUC, this method is called repeatedly from an iterator, so I think you would need to be instead relpacing the 'Monitor *mon' parmeter with "GString *str", and print into that buffer. The HumanReadableText would be created from teh GString higher up in the call path. 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 :|