From 918c626847413a25781a80834cedabc8f67b5212 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Sat, 24 Feb 2018 03:37:37 -0500 Subject: [PATCH] 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. Backports commit f615f39616c4fd1a3a3b078af8d75bb4be6390de from qemu --- qemu/exec.c | 8 +++----- qemu/include/exec/cpu-common.h | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/qemu/exec.c b/qemu/exec.c index 3821b005..0ec5706c 100644 --- a/qemu/exec.c +++ b/qemu/exec.c @@ -1433,7 +1433,6 @@ static void *qemu_ram_ptr_length(struct uc_struct *uc, RAMBlock *ram_block, * ram_addr_t. */ RAMBlock *qemu_ram_block_from_host(struct uc_struct* uc, void *ptr, bool round_offset, - ram_addr_t *ram_addr, ram_addr_t *offset) { RAMBlock *block; @@ -1461,7 +1460,6 @@ found: if (round_offset) { *offset &= TARGET_PAGE_MASK; } - *ram_addr = block->offset + *offset; return block; } @@ -1491,10 +1489,10 @@ RAMBlock *qemu_ram_block_by_name(struct uc_struct* uc, const char *name) MemoryRegion *qemu_ram_addr_from_host(struct uc_struct* uc, void *ptr, ram_addr_t *ram_addr) { RAMBlock *block; - ram_addr_t offset; /* Not used */ - - block = qemu_ram_block_from_host(uc, ptr, false, ram_addr, &offset); + ram_addr_t offset; + block = qemu_ram_block_from_host(uc, ptr, false, &offset); + *ram_addr = block->offset + offset; if (!block) { return NULL; } diff --git a/qemu/include/exec/cpu-common.h b/qemu/include/exec/cpu-common.h index a3c67f87..20a272e9 100644 --- a/qemu/include/exec/cpu-common.h +++ b/qemu/include/exec/cpu-common.h @@ -51,7 +51,7 @@ void qemu_ram_remap(struct uc_struct *uc, ram_addr_t addr, ram_addr_t length); MemoryRegion *qemu_ram_addr_from_host(struct uc_struct* uc, void *ptr, ram_addr_t *ram_addr); RAMBlock *qemu_ram_block_by_name(struct uc_struct* uc, const char *name); RAMBlock *qemu_ram_block_from_host(struct uc_struct* uc, void *ptr, bool round_offset, - ram_addr_t *ram_addr, ram_addr_t *offset); + ram_addr_t *offset); void qemu_ram_set_idstr(struct uc_struct *uc, RAMBlock *block, const char *name, DeviceState *dev); void qemu_ram_unset_idstr(struct uc_struct *uc, RAMBlock *block); const char *qemu_ram_get_idstr(RAMBlock *rb);