Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jjs9V-00013E-10 for qemu-devel@nongnu.org; Thu, 10 Apr 2008 04:29:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jjs9R-00012L-4G for qemu-devel@nongnu.org; Thu, 10 Apr 2008 04:28:59 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jjs9Q-00012H-Vh for qemu-devel@nongnu.org; Thu, 10 Apr 2008 04:28:57 -0400 Received: from duality.mitra.id.au ([204.228.200.16]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jjs9Q-0002Yo-06 for qemu-devel@nongnu.org; Thu, 10 Apr 2008 04:28:56 -0400 Received: from cognition.uchi.phear.cc (65-101-142-115.tukw.qwest.net [65.101.142.115]) by duality.mitra.id.au (Postfix) with ESMTP id A554EE7 for ; Thu, 10 Apr 2008 18:28:46 +1000 (EST) Date: Thu, 10 Apr 2008 01:28:28 -0700 From: kaizoku Message-Id: <20080410012828.a7ca1025.kaizoku@phear.cc> Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Thu__10_Apr_2008_01_28_28_-0700_/IhK.OYp7ZSUhcGv" Subject: [Qemu-devel] [PATCH] 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 --Signature=_Thu__10_Apr_2008_01_28_28_-0700_/IhK.OYp7ZSUhcGv Content-Type: multipart/mixed; boundary="Multipart=_Thu__10_Apr_2008_01_28_28_-0700_Gv2xHGIfRbnKJsni" --Multipart=_Thu__10_Apr_2008_01_28_28_-0700_Gv2xHGIfRbnKJsni Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable This is just a quick little modification of memsave which saves the physica= l memory rather than the virtual memory. -- Josh --Multipart=_Thu__10_Apr_2008_01_28_28_-0700_Gv2xHGIfRbnKJsni Content-Type: text/x-patch; name="qemu-physical_memory_save.patch" Content-Disposition: attachment; filename="qemu-physical_memory_save.patch" Content-Transfer-Encoding: quoted-printable diff -u qemu-old/monitor.c qemu/monitor.c --- qemu-old/monitor.c 2008-04-09 23:29:00.000000000 -0700 +++ qemu/monitor.c 2008-04-09 23:23:44.000000000 -0700 @@ -744,6 +744,32 @@ fclose(f); } =20 +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 =3D GET_TLONG(valh, vall); + + f =3D fopen(filename, "wb"); + if (!f) { + term_printf("could not open '%s'\n", filename); + return; + } + while (size !=3D 0) { + l =3D sizeof(buf); + if (l > size) + l =3D size; + cpu_physical_memory_rw(addr, buf, l, 0); + fwrite(buf, 1, l, f); + fflush(f); + addr +=3D l; + size -=3D 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 'add= r' of size 'size'", }, + { "pmemsave", "lis", do_physical_memory_save, + "addr size file", "save to disk physical memory dump starting at 'ad= dr' of size 'size'", }, { NULL, NULL, }, }; --Multipart=_Thu__10_Apr_2008_01_28_28_-0700_Gv2xHGIfRbnKJsni-- --Signature=_Thu__10_Apr_2008_01_28_28_-0700_/IhK.OYp7ZSUhcGv Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iD8DBQFH/c+w/JVlA/TKfFMRAgKIAJ9TzLD14k3IyQ1zslmfRx9Ym+MvgQCfRmWX hTrue9BjDSImdPA8Db7VvRs= =g7w5 -----END PGP SIGNATURE----- --Signature=_Thu__10_Apr_2008_01_28_28_-0700_/IhK.OYp7ZSUhcGv--