aboutsummaryrefslogtreecommitdiff
path: root/cpu-common.h
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2011-05-19 18:35:45 +0100
committerAlexander Graf <agraf@suse.de>2011-06-19 04:40:05 +0200
commit38bee5dc94ee355640b030d28f311b03ee2f13d1 (patch)
treeafed6f4a053ce6072703d2219d620766cfa28bb6 /cpu-common.h
parent6506e4f995967b1a48cc34418c77b318df92ce35 (diff)
exec.c: refactor cpu_physical_memory_map
Introduce qemu_ram_ptr_length that takes an address and a size as parameters rather than just an address. Refactor cpu_physical_memory_map so that we call qemu_ram_ptr_length only once rather than calling qemu_get_ram_ptr one time per page. This is not only more efficient but also tries to simplify the logic of the function. Currently we are relying on the fact that all the pages are mapped contiguously in qemu's address space: we have a check to make sure that the virtual address returned by qemu_get_ram_ptr from the second call on is consecutive. Now we are making this more explicit replacing all the calls to qemu_get_ram_ptr with a single call to qemu_ram_ptr_length passing a size argument. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> CC: agraf@suse.de CC: anthony@codemonkey.ws Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'cpu-common.h')
-rw-r--r--cpu-common.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/cpu-common.h b/cpu-common.h
index 9f5917224a..b027e43088 100644
--- a/cpu-common.h
+++ b/cpu-common.h
@@ -65,6 +65,7 @@ void qemu_ram_free_from_ptr(ram_addr_t addr);
void qemu_ram_remap(ram_addr_t addr, ram_addr_t length);
/* This should only be used for ram local to a device. */
void *qemu_get_ram_ptr(ram_addr_t addr);
+void *qemu_ram_ptr_length(target_phys_addr_t addr, target_phys_addr_t *size);
/* Same but slower, to use for migration, where the order of
* RAMBlocks must not change. */
void *qemu_safe_ram_ptr(ram_addr_t addr);