qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] memory: Use standard log messages for unassigned me


From: Stefan Weil
Subject: [Qemu-devel] [PATCH] memory: Use standard log messages for unassigned memory read / write
Date: Wed, 7 Sep 2016 21:13:47 +0200

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 <address@hidden>
---

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);
     if (current_cpu != NULL) {
         cpu_unassigned_access(current_cpu, addr, true, false, 0, size);
     }
-- 
2.1.4




reply via email to

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