[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 06/11] monitor/i386: use debug APIs when accessing guest memo
From: |
Peter Maydell |
Subject: |
Re: [PATCH 06/11] monitor/i386: use debug APIs when accessing guest memory |
Date: |
Tue, 1 Dec 2020 12:05:24 +0000 |
On Mon, 16 Nov 2020 at 19:29, Ashish Kalra <Ashish.Kalra@amd.com> wrote:
>
> From: Brijesh Singh <brijesh.singh@amd.com>
>
> Update the HMP commands to use the debug version of APIs when accessing
> guest memory.
>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
> ---
> monitor/misc.c | 4 ++--
> softmmu/cpus.c | 2 +-
> target/i386/monitor.c | 54 ++++++++++++++++++++++++-------------------
> 3 files changed, 33 insertions(+), 27 deletions(-)
>
> diff --git a/monitor/misc.c b/monitor/misc.c
> index 32e6a8c13d..7eba3a6fce 100644
> --- a/monitor/misc.c
> +++ b/monitor/misc.c
> @@ -824,8 +824,8 @@ static void hmp_sum(Monitor *mon, const QDict *qdict)
>
> sum = 0;
> for(addr = start; addr < (start + size); addr++) {
> - uint8_t val = address_space_ldub(&address_space_memory, addr,
> - MEMTXATTRS_UNSPECIFIED, NULL);
> + uint8_t val;
> + cpu_physical_memory_read_debug(addr, &val, 1);
> /* BSD sum algorithm ('sum' Unix command) */
> sum = (sum >> 1) | (sum << 15);
> sum += val;
Side note -- are byte-by-byte accesses to the encrypted guest
memory noticeably higher overhead than if we asked for a
larger buffer to be decrypted at once? If so and if anybody
cares about hmp_sum performance we might consider having it
work on a larger buffer at a time rather than byte-by-byte...
thanks
-- PMM