* [Qemu-devel] [4195] physical memory dump to file
@ 2008-04-11 21:36 Aurelien Jarno
2008-04-12 1:32 ` Stuart Brady
0 siblings, 1 reply; 2+ messages in thread
From: Aurelien Jarno @ 2008-04-11 21:36 UTC (permalink / raw)
To: qemu-devel
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, },
};
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [4195] physical memory dump to file
2008-04-11 21:36 [Qemu-devel] [4195] physical memory dump to file Aurelien Jarno
@ 2008-04-12 1:32 ` Stuart Brady
0 siblings, 0 replies; 2+ messages in thread
From: Stuart Brady @ 2008-04-12 1:32 UTC (permalink / raw)
To: qemu-devel
Hi,
I've not tested this, but wouldn't something like this be needed?
Index: monitor.c
===================================================================
--- monitor.c (revision 4196)
+++ monitor.c (working copy)
@@ -750,7 +750,7 @@ static void do_physical_memory_save(unsi
FILE *f;
uint32_t l;
uint8_t buf[1024];
- target_long addr = GET_TLONG(valh, vall);
+ target_phys_addr_t addr = GET_TPHYSADDR(valh, vall);
f = fopen(filename, "wb");
if (!f) {
Also, it might be worth trying to merge do_physical_memory_save() and
do_memory_save(), although I'm not sure of the correct type for addr.
memory_dump() uses target_phys_addr_t for both physical and virtual
addresses, which it can obviously get away with, but I'm not sure
whether sizeof(target_phys_addr_t) >= sizeof(target_long) will always
be a safe assumption.
Cheers,
--
Stuart Brady
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-04-12 1:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-11 21:36 [Qemu-devel] [4195] physical memory dump to file Aurelien Jarno
2008-04-12 1:32 ` Stuart Brady
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).