From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [4195] physical memory dump to file
Date: Fri, 11 Apr 2008 21:36:14 +0000	[thread overview]
Message-ID: <E1JkQus-0002ZW-Di@cvs.savannah.gnu.org> (raw)
Revision: 4195
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4195
Author:   aurel32
Date:     2008-04-11 21:36:14 +0000 (Fri, 11 Apr 2008)
Log Message:
-----------
physical memory dump to file
(Marvin Flumm)
Modified Paths:
--------------
    trunk/monitor.c
Modified: trunk/monitor.c
===================================================================
--- trunk/monitor.c	2008-04-11 21:36:06 UTC (rev 4194)
+++ trunk/monitor.c	2008-04-11 21:36:14 UTC (rev 4195)
@@ -744,6 +744,32 @@
     fclose(f);
 }
 
+static void do_physical_memory_save(unsigned int valh, unsigned int vall,
+                                    uint32_t size, const char *filename)
+{
+    FILE *f;
+    uint32_t l;
+    uint8_t buf[1024];
+    target_long addr = GET_TLONG(valh, vall);
+
+    f = fopen(filename, "wb");
+    if (!f) {
+        term_printf("could not open '%s'\n", filename);
+        return;
+    }
+    while (size != 0) {
+        l = sizeof(buf);
+        if (l > size)
+            l = size;
+        cpu_physical_memory_rw(addr, buf, l, 0);
+        fwrite(buf, 1, l, f);
+        fflush(f);
+        addr += l;
+        size -= l;
+    }
+    fclose(f);
+}
+
 static void do_sum(uint32_t start, uint32_t size)
 {
     uint32_t addr;
@@ -1328,6 +1354,8 @@
        "capture index", "stop capture" },
     { "memsave", "lis", do_memory_save,
       "addr size file", "save to disk virtual memory dump starting at 'addr' of size 'size'", },
+    { "pmemsave", "lis", do_physical_memory_save,
+      "addr size file", "save to disk physical memory dump starting at 'addr' of size 'size'", },
     { NULL, NULL, },
 };
 
next             reply	other threads:[~2008-04-11 21:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-11 21:36 Aurelien Jarno [this message]
2008-04-12  1:32 ` [Qemu-devel] [4195] physical memory dump to file Stuart Brady
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=E1JkQus-0002ZW-Di@cvs.savannah.gnu.org \
    --to=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).