diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-03-25 12:55:08 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-05-29 09:11:12 +0200 |
commit | 07bdaa4196b51bc7ffa7c3f74e9e4a9dc8a7966a (patch) | |
tree | 5892b36a9f4f08503620ea876dd56f1ae6f763e2 /exec.c | |
parent | f615f39616c4fd1a3a3b078af8d75bb4be6390de (diff) | |
download | qemu-07bdaa4196b51bc7ffa7c3f74e9e4a9dc8a7966a.tar.gz qemu-07bdaa4196b51bc7ffa7c3f74e9e4a9dc8a7966a.tar.bz2 qemu-07bdaa4196b51bc7ffa7c3f74e9e4a9dc8a7966a.zip |
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>
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1964,18 +1964,17 @@ RAMBlock *qemu_ram_block_by_name(const char *name) /* Some of the softmmu routines need to translate from a host pointer (typically a TLB entry) back to a ram offset. */ -MemoryRegion *qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr) +ram_addr_t qemu_ram_addr_from_host(void *ptr) { RAMBlock *block; ram_addr_t offset; block = qemu_ram_block_from_host(ptr, false, &offset); - *ram_addr = block->offset + offset; if (!block) { - return NULL; + return RAM_ADDR_INVALID; } - return block->mr; + return block->offset + offset; } /* Called within RCU critical section. */ @@ -2975,8 +2974,9 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len, MemoryRegion *mr; ram_addr_t addr1; - mr = qemu_ram_addr_from_host(buffer, &addr1); + mr = memory_region_from_host(buffer, &addr1); assert(mr != NULL); + addr1 += memory_region_get_ram_addr(mr); if (is_write) { invalidate_and_set_dirty(mr, addr1, access_len); } |