[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there a good method to convert guest machine's user virtual addre
From: |
Peter Maydell |
Subject: |
Re: Is there a good method to convert guest machine's user virtual address to qemu host's virtual address? |
Date: |
Wed, 14 Jul 2021 14:10:19 +0100 |
On Wed, 14 Jul 2021 at 13:12, <ckim@etri.re.kr> wrote:
>
> On second thought, I guess the application should convert the virtual address
> to physical address (by reading the page table) and write the value to the
> register.
Yes. Generally models that emulate real devices will always operate
on physical addresses, because in hardware they are separate from
the CPU and don't have access to the virtual-to-physical translation
that the CPU does. It is possible to design purely virtual hardware
that wants to take a virtual address, but this is a bad idea:
a buffer that's a contiguous lump of virtual memory could be
non-contiguous in physical memory if it spans multiple pages; and
QEMU's APIs are not designed to make it easy to do virtual-to-physical
lookups from a device model.
thanks
-- PMM