From 5533e8891f1283259b0eb49fe747767a85d6c628 Mon Sep 17 00:00:00 2001 From: jamesbrq Date: Fri, 16 Feb 2024 21:07:24 -0500 Subject: [PATCH] Sdd support of write monitor command --- hmp-commands.hx | 4 ++-- include/monitor/hmp.h | 2 +- monitor/hmp-cmds.c | 41 ++++++++++++++++++++--------------------- softmmu/memory.c | 17 ++++++++--------- 4 files changed, 31 insertions(+), 33 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index a83ffde8cd9..c129be42fa1 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -50,14 +50,14 @@ ERST SRST ``write`` or ``w`` - Quit the emulator. + Write to physical memory. ERST { .name = "write|w", .args_type = "addr:l,size:i,data:i", .params = "addr size data", - .help = "write to ram", + .help = "write to physical memory", .cmd = hmp_write, .flags = "p", }, diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 8dedfd9dcf9..13af0412f1b 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -20,7 +20,7 @@ bool hmp_handle_error(Monitor *mon, Error *err); -void hmp_write(Monitor* mon, const QDict* qdict); +void hmp_write(Monitor *mon, const QDict *qdict); void hmp_info_name(Monitor *mon, const QDict *qdict); void hmp_info_version(Monitor *mon, const QDict *qdict); void hmp_info_kvm(Monitor *mon, const QDict *qdict); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index a7bb619c793..3ac0d03fa6a 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -14,20 +14,18 @@ */ #include "qemu/osdep.h" -#include "monitor/hmp.h" -#include "net/net.h" -#include "net/eth.h" #include "chardev/char.h" -#include "sysemu/block-backend.h" -#include "sysemu/runstate.h" -#include "qemu/config-file.h" -#include "qemu/option.h" -#include "qemu/timer.h" -#include "qemu/sockets.h" -#include "qemu/help_option.h" +#include "exec/memory.h" +#include "hw/core/cpu.h" +#include "hw/intc/intc.h" +#include "migration/misc.h" +#include "migration/snapshot.h" +#include "monitor/hmp.h" #include "monitor/monitor-internal.h" -#include "qapi/error.h" +#include "net/eth.h" +#include "net/net.h" #include "qapi/clone-visitor.h" +#include "qapi/error.h" #include "qapi/opts-visitor.h" #include "qapi/qapi-builtin-visit.h" #include "qapi/qapi-commands-block.h" @@ -44,23 +42,24 @@ #include "qapi/qapi-commands-tpm.h" #include "qapi/qapi-commands-ui.h" #include "qapi/qapi-commands-virtio.h" -#include "qapi/qapi-visit-virtio.h" -#include "qapi/qapi-visit-net.h" #include "qapi/qapi-visit-migration.h" +#include "qapi/qapi-visit-net.h" +#include "qapi/qapi-visit-virtio.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" #include "qapi/string-input-visitor.h" #include "qapi/string-output-visitor.h" -#include "qom/object_interfaces.h" -#include "ui/console.h" +#include "qemu/config-file.h" #include "qemu/cutils.h" #include "qemu/error-report.h" -#include "hw/core/cpu.h" -#include "hw/intc/intc.h" -#include "migration/snapshot.h" -#include "migration/misc.h" -#include "exec/memory.h" -#include "exec/memory.h" +#include "qemu/help_option.h" +#include "qemu/option.h" +#include "qemu/sockets.h" +#include "qemu/timer.h" +#include "qom/object_interfaces.h" +#include "sysemu/block-backend.h" +#include "sysemu/runstate.h" +#include "ui/console.h" #ifdef CONFIG_SPICE #include diff --git a/softmmu/memory.c b/softmmu/memory.c index 6f5855a3955..79fac681a2d 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -3596,15 +3596,14 @@ void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled) } -void ram_write(hwaddr addr, void* ptr, hwaddr len) -{ - MemoryRegion* sm = get_system_memory(); - MemoryRegion* mr; - const uint8_t* buf = ptr; - QTAILQ_FOREACH(mr, &sm->subregions, subregions_link) { - if (strcmp(memory_region_name(mr), "xbox.ram") == 0) - { - uint8_t* ram_ptr = qemu_map_ram_ptr(mr->ram_block, addr); +void ram_write(hwaddr addr, void *ptr, hwaddr len) +{ + MemoryRegion *sm = get_system_memory(); + MemoryRegion *mr; + const uint8_t *buf = ptr; + QTAILQ_FOREACH (mr, &sm->subregions, subregions_link) { + if (strcmp(memory_region_name(mr), "xbox.ram") == 0) { + uint8_t *ram_ptr = qemu_map_ram_ptr(mr->ram_block, addr); memcpy(ram_ptr, buf, len); break; }