On 05/21/2018 10:36 AM, Simon Ruderich wrote:
Adapted patch from Baojun Wang [1] with the following commit message:
I found this could be useful to have qemu-softmmu as a cross
debugger (launch with -s -S command line option), then if we can
have a command to load guest physical memory, we can use cross gdb
to do some target debug which gdb cannot do directly.
pmemload is necessary to directly write physical memory which is not
possible with gdb alone as it uses only logical addresses.
The QAPI for pmemload uses "val" as parameter name for the physical
address. This name is not very descriptive but is consistent with the
existing pmemsave. Changing the parameter name of pmemsave is not
possible without breaking the existing API.
[1]: https://lists.gnu.org/archive/html/qemu-trivial/2014-04/msg00074.html
Based-on-patch-by: Baojun Wang <wan...@gmail.com>
Signed-off-by: Simon Ruderich <si...@ruderich.org>
---
cpus.c | 41 +++++++++++++++++++++++++++++++++++++++++
hmp-commands.hx | 14 ++++++++++++++
hmp.c | 12 ++++++++++++
hmp.h | 1 +
qapi/misc.json | 20 ++++++++++++++++++++
5 files changed, 88 insertions(+)
I haven't closely reviewed this, but a quick note:
+++ b/qapi/misc.json
@@ -1219,6 +1219,26 @@
{ 'command': 'pmemsave',
'data': {'val': 'int', 'size': 'int', 'filename': 'str'} }
+##
+# @pmemload:
+#
+# Load a portion of guest physical memory from a file.
+#
+# @val: the physical address of the guest to start from
+#
+# @size: the size of memory region to load
+#
+# @offset: the offset in the file to start from
+#
+# @filename: the file to load the memory from as binary data
+#
+# Returns: Nothing on success
+#
+# Since: 2.13
There was no 2.13 release, and this feature has missed the 3.0
deadlines, so it would need to say 'Since: 3.1'
+##
+{ 'command': 'pmemload',
+ 'data': {'val': 'int', 'size': 'int', 'offset': 'int', 'filename': 'str'} }
+
##
# @cont:
#
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org