提交 9f029603 编写于 作者: J Jan Kiszka 提交者: Paolo Bonzini

memory: Introduce address_space_lookup_region

This introduces a wrapper for phys_page_find (before we complicate
address_space_translate with IOMMU translation).  This function will
also encapsulate locking and reference counting when we introduce
BQL-free dispatching.
Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 3752a036
...@@ -203,6 +203,12 @@ bool memory_region_is_unassigned(MemoryRegion *mr) ...@@ -203,6 +203,12 @@ bool memory_region_is_unassigned(MemoryRegion *mr)
&& mr != &io_mem_watch; && mr != &io_mem_watch;
} }
static MemoryRegionSection *address_space_lookup_region(AddressSpace *as,
hwaddr addr)
{
return phys_page_find(as->dispatch, addr >> TARGET_PAGE_BITS);
}
MemoryRegionSection *address_space_translate(AddressSpace *as, hwaddr addr, MemoryRegionSection *address_space_translate(AddressSpace *as, hwaddr addr,
hwaddr *xlat, hwaddr *plen, hwaddr *xlat, hwaddr *plen,
bool is_write) bool is_write)
...@@ -210,7 +216,7 @@ MemoryRegionSection *address_space_translate(AddressSpace *as, hwaddr addr, ...@@ -210,7 +216,7 @@ MemoryRegionSection *address_space_translate(AddressSpace *as, hwaddr addr,
MemoryRegionSection *section; MemoryRegionSection *section;
Int128 diff; Int128 diff;
section = phys_page_find(as->dispatch, addr >> TARGET_PAGE_BITS); section = address_space_lookup_region(as, addr);
/* Compute offset within MemoryRegionSection */ /* Compute offset within MemoryRegionSection */
addr -= section->offset_within_address_space; addr -= section->offset_within_address_space;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册