mirror of
https://github.com/mii443/qemu.git
synced 2025-08-24 16:09:37 +00:00
memory: split memory_region_from_host from qemu_ram_addr_from_host
Move the old qemu_ram_addr_from_host to memory_region_from_host and
make it return an offset within the region. For qemu_ram_addr_from_host
return the ram_addr_t directly, similar to what it was before
commit 1b5ec23
("memory: return MemoryRegion from qemu_ram_addr_from_host",
2013-07-04).
Reviewed-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
14
memory.c
14
memory.c
@ -33,8 +33,6 @@
|
||||
|
||||
//#define DEBUG_UNASSIGNED
|
||||
|
||||
#define RAM_ADDR_INVALID (~(ram_addr_t)0)
|
||||
|
||||
static unsigned memory_region_transaction_depth;
|
||||
static bool memory_region_update_pending;
|
||||
static bool ioeventfd_update_pending;
|
||||
@ -1665,6 +1663,18 @@ void *memory_region_get_ram_ptr(MemoryRegion *mr)
|
||||
return ptr + offset;
|
||||
}
|
||||
|
||||
MemoryRegion *memory_region_from_host(void *ptr, ram_addr_t *offset)
|
||||
{
|
||||
RAMBlock *block;
|
||||
|
||||
block = qemu_ram_block_from_host(ptr, false, offset);
|
||||
if (!block) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return block->mr;
|
||||
}
|
||||
|
||||
ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr)
|
||||
{
|
||||
return mr->ram_block ? mr->ram_block->offset : RAM_ADDR_INVALID;
|
||||
|
Reference in New Issue
Block a user