On 7 September 2016 at 20:13, Stefan Weil <s...@weilnetz.de> wrote: > The old log messages are implemented by conditional compilation > and not available by default. > > The new log messages can be enabled either by a command line option > (-d unimp) or in the QEMU monitor (log unimp). > > Signed-off-by: Stefan Weil <s...@weilnetz.de> > --- > > The new code is very useful when implementing new platforms or > looking for problems with existing platforms which are only > partially emulated (I use it for Raspberry Pi). > > target-sparc/ldst_helper.c also uses DEBUG_UNASSIGNED > and could get similar code. > > Regards, > Stefan > > > memory.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/memory.c b/memory.c > index 0eb6895..92f8879 100644 > --- a/memory.c > +++ b/memory.c > @@ -23,6 +23,7 @@ > #include "qapi/visitor.h" > #include "qemu/bitops.h" > #include "qemu/error-report.h" > +#include "qemu/log.h" > #include "qom/object.h" > #include "trace.h" > > @@ -31,8 +32,6 @@ > #include "sysemu/kvm.h" > #include "sysemu/sysemu.h" > > -//#define DEBUG_UNASSIGNED > - > static unsigned memory_region_transaction_depth; > static bool memory_region_update_pending; > static bool ioeventfd_update_pending; > @@ -1101,9 +1100,7 @@ static void memory_region_initfn(Object *obj) > static uint64_t unassigned_mem_read(void *opaque, hwaddr addr, > unsigned size) > { > -#ifdef DEBUG_UNASSIGNED > - printf("Unassigned mem read " TARGET_FMT_plx "\n", addr); > -#endif > + qemu_log_mask(LOG_UNIMP, "%s " TARGET_FMT_plx "\n", __func__, addr); > if (current_cpu != NULL) { > cpu_unassigned_access(current_cpu, addr, false, false, 0, size); > } > @@ -1113,9 +1110,8 @@ static uint64_t unassigned_mem_read(void *opaque, > hwaddr addr, > static void unassigned_mem_write(void *opaque, hwaddr addr, > uint64_t val, unsigned size) > { > -#ifdef DEBUG_UNASSIGNED > - printf("Unassigned mem write " TARGET_FMT_plx " = 0x%"PRIx64"\n", addr, > val); > -#endif > + qemu_log_mask(LOG_UNIMP, "%s " TARGET_FMT_plx " = 0x%" PRIx64 "\n", > + __func__, addr, val);
Maybe this should be LOG_GUEST_ERROR rather than LOG_UNIMP ? > if (current_cpu != NULL) { > cpu_unassigned_access(current_cpu, addr, true, false, 0, size); > } > -- > 2.1.4 Idle thought: would it be worth having an "unimplemented-thing" device which just existed to print LOG_GUEST_ERROR errors which included a string indicating what the missing device was? The board models would need to actually instantiate them in the right places (hopefully just one-liners) but that's easier than implementing lots of devices. And it would give us some documentation in the source of what's still missing in a board. thanks -- PMM