/* Memory peeking flags. */
typedef enum {
VIR_MEMORY_VIRTUAL = 1, /* addresses are virtual addresses */
+ VIR_MEMORY_PHYSICAL = 2, /* addresses are physical addresses */
} virDomainMemoryFlags;
int virDomainMemoryPeek (virDomainPtr dom,
/* Memory peeking flags. */
typedef enum {
VIR_MEMORY_VIRTUAL = 1, /* addresses are virtual addresses */
+ VIR_MEMORY_PHYSICAL = 2, /* addresses are physical addresses */
} virDomainMemoryFlags;
int virDomainMemoryPeek (virDomainPtr dom,
goto error;
}
- /* Flags must be VIR_MEMORY_VIRTUAL at the moment.
- *
- * Note on access to physical memory: A VIR_MEMORY_PHYSICAL flag is
+ /* Note on access to physical memory: A VIR_MEMORY_PHYSICAL flag is
* a possibility. However it isn't really useful unless the caller
* can also access registers, particularly CR3 on x86 in order to
* get the Page Table Directory. Since registers are different on
* every architecture, that would imply another call to get the
* machine registers.
*
- * The QEMU driver handles only VIR_MEMORY_VIRTUAL, mapping it
+ * The QEMU driver handles VIR_MEMORY_VIRTUAL, mapping it
* to the qemu 'memsave' command which does the virtual to physical
* mapping inside qemu.
*
+ * The QEMU driver also handles VIR_MEMORY_PHYSICAL, mapping it
+ * to the qemu 'pmemsave' command.
+ *
* At time of writing there is no Xen driver. However the Xen
* hypervisor only lets you map physical pages from other domains,
* and so the Xen driver would have to do the virtual to physical
* which does this, although we cannot copy this code directly
* because of incompatible licensing.
*/
- if (flags != VIR_MEMORY_VIRTUAL) {
+
+ if (flags != VIR_MEMORY_VIRTUAL && flags != VIR_MEMORY_PHYSICAL) {
virLibDomainError (dom, VIR_ERR_INVALID_ARG,
- _("flags parameter must be VIR_MEMORY_VIRTUAL"));
+ _("flags parameter must be VIR_MEMORY_VIRTUAL or VIR_MEMORY_PHYSICAL"));
goto error;
}
goto cleanup;
}
- if (flags != VIR_MEMORY_VIRTUAL) {
+ if (flags != VIR_MEMORY_VIRTUAL && flags != VIR_MEMORY_PHYSICAL) {
qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("QEMU driver only supports virtual memory addrs"));
+ "%s", _("flags parameter must be VIR_MEMORY_VIRTUAL or VIR_MEMORY_PHYSICAL"));
goto cleanup;
}
goto cleanup;
}
- /* Issue the memsave command. */
- snprintf (cmd, sizeof cmd, "memsave %llu %zi \"%s\"", offset, size, tmp);
+ if (flags == VIR_MEMORY_VIRTUAL)
+ /* Issue the memsave command. */
+ snprintf (cmd, sizeof cmd, "memsave %llu %zi \"%s\"", offset, size, tmp);
+ else
+ /* Issue the pmemsave command. */
+ snprintf (cmd, sizeof cmd, "pmemsave %llu %zi \"%s\"", offset, size, tmp);
+
if (qemudMonitorCommand (vm, cmd, &info) < 0) {
qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
"%s", _("'memsave' command failed"));
goto cleanup;
}
- DEBUG ("%s: memsave reply: %s", vm->def->name, info);
+ DEBUG ("%s: (p)memsave reply: %s", vm->def->name, info);
/* Read the memory file into buffer. */
if (saferead (fd, buffer, size) == (ssize_t) -1) {