summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--bsd-user/main.c2
-rw-r--r--include/exec/log.h11
-rw-r--r--linux-user/main.c2
-rw-r--r--linux-user/mmap.c8
4 files changed, 11 insertions, 12 deletions
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 470a8bf79e..7f4e3cd627 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -963,7 +963,7 @@ int main(int argc, char **argv)
 
     if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
         qemu_log("guest_base  0x%lx\n", guest_base);
-        log_page_dump();
+        log_page_dump("binary load");
 
         qemu_log("start_brk   0x" TARGET_ABI_FMT_lx "\n", info->start_brk);
         qemu_log("end_code    0x" TARGET_ABI_FMT_lx "\n", info->end_code);
diff --git a/include/exec/log.h b/include/exec/log.h
index 9bd1e4aa20..fcc7b9e00b 100644
--- a/include/exec/log.h
+++ b/include/exec/log.h
@@ -69,15 +69,14 @@ static inline void log_disas(void *code, unsigned long size)
 
 #if defined(CONFIG_USER_ONLY)
 /* page_dump() output to the log file: */
-static inline void log_page_dump(void)
+static inline void log_page_dump(const char *operation)
 {
-    QemuLogFile *logfile;
-    rcu_read_lock();
-    logfile = atomic_rcu_read(&qemu_logfile);
+    FILE *logfile = qemu_log_lock();
     if (logfile) {
-        page_dump(logfile->fd);
+        qemu_log("page layout changed following %s\n", operation);
+        page_dump(logfile);
     }
-    rcu_read_unlock();
+    qemu_log_unlock(logfile);
 }
 #endif
 #endif
diff --git a/linux-user/main.c b/linux-user/main.c
index 6ff7851e86..8718d03ee2 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -826,7 +826,7 @@ int main(int argc, char **argv, char **envp)
 
     if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
         qemu_log("guest_base  0x%lx\n", guest_base);
-        log_page_dump();
+        log_page_dump("binary load");
 
         qemu_log("start_brk   0x" TARGET_ABI_FMT_lx "\n", info->start_brk);
         qemu_log("end_code    0x" TARGET_ABI_FMT_lx "\n", info->end_code);
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 0b1b43ac3c..3d90fa459c 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -18,6 +18,7 @@
  */
 #include "qemu/osdep.h"
 #include "trace.h"
+#include "exec/log.h"
 #include "qemu.h"
 
 //#define DEBUG_MMAP
@@ -539,10 +540,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
     page_set_flags(start, start + len, prot | PAGE_VALID);
  the_end:
     trace_target_mmap_complete(start);
-#ifdef DEBUG_MMAP
-    page_dump(stdout);
-    printf("\n");
-#endif
+    if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
+        log_page_dump(__func__);
+    }
     tb_invalidate_phys_range(start, start + len);
     mmap_unlock();
     return start;