aboutsummaryrefslogtreecommitdiffstats
path: root/exec.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-01-02 12:17:03 +0200
committerAvi Kivity <avi@redhat.com>2012-01-04 13:34:50 +0200
commitdd81124bf6d58ac3c5035093a501a55258f825e4 (patch)
treee76cbc6a053297f2b524a5ad87834edf4c620e85 /exec.c
parent0e0df1e24de709016c42164d9b22b981a04e4696 (diff)
Switch cpu_register_physical_memory_log() to use MemoryRegions
Still internally using ram_addr. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/exec.c b/exec.c
index 0f5bad841..389abe720 100644
--- a/exec.c
+++ b/exec.c
@@ -2510,18 +2510,32 @@ static subpage_t *subpage_init (target_phys_addr_t base, ram_addr_t *phys,
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) {