exec: remove ram_addr argument from qemu_ram_block_from_host
Of the two callers, one does not use it, and the other can compute it itself based on the other output argument (offset) and the RAMBlock. Reviewed-by: Marc-André Lureau <marcandre.lureau@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
4ff87573df
commit
f615f39616
13
exec.c
13
exec.c
@ -1897,16 +1897,16 @@ static void *qemu_ram_ptr_length(RAMBlock *ram_block, ram_addr_t addr,
|
|||||||
* ram_addr_t.
|
* ram_addr_t.
|
||||||
*/
|
*/
|
||||||
RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
|
RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
|
||||||
ram_addr_t *ram_addr,
|
|
||||||
ram_addr_t *offset)
|
ram_addr_t *offset)
|
||||||
{
|
{
|
||||||
RAMBlock *block;
|
RAMBlock *block;
|
||||||
uint8_t *host = ptr;
|
uint8_t *host = ptr;
|
||||||
|
|
||||||
if (xen_enabled()) {
|
if (xen_enabled()) {
|
||||||
|
ram_addr_t ram_addr;
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
*ram_addr = xen_ram_addr_from_mapcache(ptr);
|
ram_addr = xen_ram_addr_from_mapcache(ptr);
|
||||||
block = qemu_get_ram_block(*ram_addr);
|
block = qemu_get_ram_block(ram_addr);
|
||||||
if (block) {
|
if (block) {
|
||||||
*offset = (host - block->host);
|
*offset = (host - block->host);
|
||||||
}
|
}
|
||||||
@ -1938,7 +1938,6 @@ found:
|
|||||||
if (round_offset) {
|
if (round_offset) {
|
||||||
*offset &= TARGET_PAGE_MASK;
|
*offset &= TARGET_PAGE_MASK;
|
||||||
}
|
}
|
||||||
*ram_addr = block->offset + *offset;
|
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
@ -1968,10 +1967,10 @@ RAMBlock *qemu_ram_block_by_name(const char *name)
|
|||||||
MemoryRegion *qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr)
|
MemoryRegion *qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr)
|
||||||
{
|
{
|
||||||
RAMBlock *block;
|
RAMBlock *block;
|
||||||
ram_addr_t offset; /* Not used */
|
ram_addr_t offset;
|
||||||
|
|
||||||
block = qemu_ram_block_from_host(ptr, false, ram_addr, &offset);
|
|
||||||
|
|
||||||
|
block = qemu_ram_block_from_host(ptr, false, &offset);
|
||||||
|
*ram_addr = block->offset + offset;
|
||||||
if (!block) {
|
if (!block) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length);
|
|||||||
MemoryRegion *qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr);
|
MemoryRegion *qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr);
|
||||||
RAMBlock *qemu_ram_block_by_name(const char *name);
|
RAMBlock *qemu_ram_block_by_name(const char *name);
|
||||||
RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
|
RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
|
||||||
ram_addr_t *ram_addr, ram_addr_t *offset);
|
ram_addr_t *offset);
|
||||||
void qemu_ram_set_idstr(RAMBlock *block, const char *name, DeviceState *dev);
|
void qemu_ram_set_idstr(RAMBlock *block, const char *name, DeviceState *dev);
|
||||||
void qemu_ram_unset_idstr(RAMBlock *block);
|
void qemu_ram_unset_idstr(RAMBlock *block);
|
||||||
const char *qemu_ram_get_idstr(RAMBlock *rb);
|
const char *qemu_ram_get_idstr(RAMBlock *rb);
|
||||||
|
@ -407,7 +407,6 @@ static void *postcopy_ram_fault_thread(void *opaque)
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
ram_addr_t rb_offset;
|
ram_addr_t rb_offset;
|
||||||
ram_addr_t in_raspace;
|
|
||||||
struct pollfd pfd[2];
|
struct pollfd pfd[2];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -459,7 +458,7 @@ static void *postcopy_ram_fault_thread(void *opaque)
|
|||||||
|
|
||||||
rb = qemu_ram_block_from_host(
|
rb = qemu_ram_block_from_host(
|
||||||
(void *)(uintptr_t)msg.arg.pagefault.address,
|
(void *)(uintptr_t)msg.arg.pagefault.address,
|
||||||
true, &in_raspace, &rb_offset);
|
true, &rb_offset);
|
||||||
if (!rb) {
|
if (!rb) {
|
||||||
error_report("postcopy_ram_fault_thread: Fault outside guest: %"
|
error_report("postcopy_ram_fault_thread: Fault outside guest: %"
|
||||||
PRIx64, (uint64_t)msg.arg.pagefault.address);
|
PRIx64, (uint64_t)msg.arg.pagefault.address);
|
||||||
|
Loading…
Reference in New Issue
Block a user