@@ -36,27 +36,9 @@ int cpu_register_io_memory(CPUReadMemoryFunc * const *mem_read,
void *opaque);
void cpu_unregister_io_memory(int table_address);
-void cpu_register_physical_memory_log(target_phys_addr_t start_addr,
- ram_addr_t size,
- ram_addr_t phys_offset,
- ram_addr_t region_offset,
- bool log_dirty);
-
-static inline void cpu_register_physical_memory_offset(target_phys_addr_t start_addr,
- ram_addr_t size,
- ram_addr_t phys_offset,
- ram_addr_t region_offset)
-{
- cpu_register_physical_memory_log(start_addr, size, phys_offset,
- region_offset, false);
-}
-
-static inline void cpu_register_physical_memory(target_phys_addr_t start_addr,
- ram_addr_t size,
- ram_addr_t phys_offset)
-{
- cpu_register_physical_memory_offset(start_addr, size, phys_offset, 0);
-}
+struct MemoryRegionSection;
+void cpu_register_physical_memory_log(struct MemoryRegionSection *section,
+ bool readable, bool readonly);
void qemu_register_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size);
void qemu_unregister_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size);
@@ -2510,18 +2510,32 @@ static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
start_addr and region_offset are rounded down to a page boundary
before calculating this offset. This should not be a problem unless
the low bits of start_addr and region_offset differ. */
-void cpu_register_physical_memory_log(target_phys_addr_t start_addr,
- ram_addr_t size,
- ram_addr_t phys_offset,
- ram_addr_t region_offset,
- bool log_dirty)
+void cpu_register_physical_memory_log(MemoryRegionSection *section,
+ bool readable, bool readonly)
{
+ target_phys_addr_t start_addr = section->offset_within_address_space;
+ ram_addr_t size = section->size;
+ ram_addr_t phys_offset = section->mr->ram_addr;
+ ram_addr_t region_offset = section->offset_within_region;
target_phys_addr_t addr, end_addr;
PhysPageDesc *p;
CPUState *env;
ram_addr_t orig_size = size;
subpage_t *subpage;
+ if (memory_region_is_ram(section->mr)) {
+ phys_offset += region_offset;
+ region_offset = 0;
+ }
+
+ if (!readable) {
+ phys_offset &= ~TARGET_PAGE_MASK & ~IO_MEM_ROMD;
+ }
+
+ if (readonly) {
+ phys_offset |= io_mem_rom.ram_addr;
+ }
+
assert(size);
if (phys_offset == io_mem_unassigned.ram_addr) {
@@ -305,38 +305,26 @@ static void access_with_adjusted_size(target_phys_addr_t addr,
static void as_memory_range_add(AddressSpace *as, FlatRange *fr)
{
- ram_addr_t phys_offset, region_offset;
-
- phys_offset = fr->mr->ram_addr;
- region_offset = fr->offset_in_region;
- /* cpu_register_physical_memory_log() wants region_offset for
- * mmio, but prefers offseting phys_offset for RAM. Humour it.
- */
- if (memory_region_is_ram(fr->mr)) {
- phys_offset += region_offset;
- region_offset = 0;
- }
-
- if (!fr->readable) {
- phys_offset &= ~TARGET_PAGE_MASK & ~IO_MEM_ROMD;
- }
-
- if (fr->readonly) {
- phys_offset |= io_mem_rom.ram_addr;
- }
+ MemoryRegionSection section = {
+ .mr = fr->mr,
+ .offset_within_address_space = int128_get64(fr->addr.start),
+ .offset_within_region = fr->offset_in_region,
+ .size = int128_get64(fr->addr.size),
+ };
- cpu_register_physical_memory_log(int128_get64(fr->addr.start),
- int128_get64(fr->addr.size),
- phys_offset,
- region_offset,
- fr->dirty_log_mask);
+ cpu_register_physical_memory_log(§ion, fr->readable, fr->readonly);
}
static void as_memory_range_del(AddressSpace *as, FlatRange *fr)
{
- cpu_register_physical_memory(int128_get64(fr->addr.start),
- int128_get64(fr->addr.size),
- io_mem_unassigned.ram_addr);
+ MemoryRegionSection section = {
+ .mr = &io_mem_unassigned,
+ .offset_within_address_space = int128_get64(fr->addr.start),
+ .offset_within_region = int128_get64(fr->addr.start),
+ .size = int128_get64(fr->addr.size),
+ };
+
+ cpu_register_physical_memory_log(§ion, true, false);
}
static void as_memory_log_start(AddressSpace *as, FlatRange *fr)
Still internally using ram_addr. Signed-off-by: Avi Kivity <avi@redhat.com> --- exec-obsolete.h | 24 +++--------------------- exec.c | 24 +++++++++++++++++++----- memory.c | 44 ++++++++++++++++---------------------------- 3 files changed, 38 insertions(+), 54 deletions(-)