Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JkQuu-0008Qd-CP for qemu-devel@nongnu.org; Fri, 11 Apr 2008 17:36:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JkQut-0008QD-Qu for qemu-devel@nongnu.org; Fri, 11 Apr 2008 17:36:15 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JkQut-0008Q8-I8 for qemu-devel@nongnu.org; Fri, 11 Apr 2008 17:36:15 -0400 Received: from savannah.gnu.org ([199.232.41.3] helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JkQut-0001g5-8j for qemu-devel@nongnu.org; Fri, 11 Apr 2008 17:36:15 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1JkQus-0002Za-Iz for qemu-devel@nongnu.org; Fri, 11 Apr 2008 21:36:14 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1JkQus-0002ZW-Di for qemu-devel@nongnu.org; Fri, 11 Apr 2008 21:36:14 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Fri, 11 Apr 2008 21:36:14 +0000 Subject: [Qemu-devel] [4195] physical memory dump to file Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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, }, };