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
This commit is contained in:
Paolo Bonzini 2018-02-24 03:01:19 -05:00 committed by Lioncash
parent 74962feee1
commit 77305ce4ee
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
3 changed files with 4 additions and 7 deletions

View file

@ -2377,9 +2377,8 @@ static inline uint32_t address_space_ldl_internal(AddressSpace *as, hwaddr addr,
} else { } else {
/* RAM case */ /* RAM case */
ptr = qemu_get_ram_ptr(as->uc, mr->ram_block, ptr = qemu_get_ram_ptr(as->uc, mr->ram_block,
(memory_region_get_ram_addr(mr) memory_region_get_ram_addr(mr) + addr1);
& TARGET_PAGE_MASK)
+ addr1);
switch (endian) { switch (endian) {
case DEVICE_LITTLE_ENDIAN: case DEVICE_LITTLE_ENDIAN:
val = ldl_le_p(ptr); val = ldl_le_p(ptr);

View file

@ -1353,8 +1353,7 @@ void *memory_region_get_ram_ptr(MemoryRegion *mr)
} }
assert(mr->ram_block); assert(mr->ram_block);
ptr = qemu_get_ram_ptr(mr->uc, mr->ram_block, ptr = qemu_get_ram_ptr(mr->uc, mr->ram_block, memory_region_get_ram_addr(mr));
memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK);
// Unicorn: commented out // Unicorn: commented out
//rcu_read_unlock(); //rcu_read_unlock();

View file

@ -1662,8 +1662,7 @@ void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr)
|| memory_region_is_romd(mr))) { || memory_region_is_romd(mr))) {
return; return;
} }
ram_addr = (ram_addr_t)((memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK) ram_addr = memory_region_get_ram_addr(mr) + addr;
+ addr);
tb_invalidate_phys_page_range(as->uc, ram_addr, ram_addr + 1, 0); tb_invalidate_phys_page_range(as->uc, ram_addr, ram_addr + 1, 0);
} }
#endif /* !defined(CONFIG_USER_ONLY) */ #endif /* !defined(CONFIG_USER_ONLY) */