From 77305ce4ee3693d6310106aecbb162a3daf0a21e Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Sat, 24 Feb 2018 03:01:19 -0500 Subject: [PATCH] memory: remove unnecessary masking of MemoryRegion ram_addr mr->ram_block->offset is already aligned to both host and target size (see qemu_ram_alloc_internal). Remove further masking as it is unnecessary. Backports commit e4e697940dff612b789b0858270c20a8b680f78d from qemu --- qemu/exec.c | 5 ++--- qemu/memory.c | 3 +-- qemu/translate-all.c | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/qemu/exec.c b/qemu/exec.c index 72e9951a..67c49a27 100644 --- a/qemu/exec.c +++ b/qemu/exec.c @@ -2377,9 +2377,8 @@ static inline uint32_t address_space_ldl_internal(AddressSpace *as, hwaddr addr, } else { /* RAM case */ ptr = qemu_get_ram_ptr(as->uc, mr->ram_block, - (memory_region_get_ram_addr(mr) - & TARGET_PAGE_MASK) - + addr1); + memory_region_get_ram_addr(mr) + addr1); + switch (endian) { case DEVICE_LITTLE_ENDIAN: val = ldl_le_p(ptr); diff --git a/qemu/memory.c b/qemu/memory.c index b34cb36b..9b82a450 100644 --- a/qemu/memory.c +++ b/qemu/memory.c @@ -1353,8 +1353,7 @@ void *memory_region_get_ram_ptr(MemoryRegion *mr) } assert(mr->ram_block); - ptr = qemu_get_ram_ptr(mr->uc, mr->ram_block, - memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK); + ptr = qemu_get_ram_ptr(mr->uc, mr->ram_block, memory_region_get_ram_addr(mr)); // Unicorn: commented out //rcu_read_unlock(); diff --git a/qemu/translate-all.c b/qemu/translate-all.c index 16929bb7..50155f72 100644 --- a/qemu/translate-all.c +++ b/qemu/translate-all.c @@ -1662,8 +1662,7 @@ void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr) || memory_region_is_romd(mr))) { return; } - ram_addr = (ram_addr_t)((memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK) - + addr); + ram_addr = memory_region_get_ram_addr(mr) + addr; tb_invalidate_phys_page_range(as->uc, ram_addr, ram_addr + 1, 0); } #endif /* !defined(CONFIG_USER_ONLY) */