aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-05-24 14:02:39 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2013-05-29 16:27:14 +0200
commitc353e4cc08a2fce7c505dd0d04512ef3947adff8 (patch)
treedd3ca3eb20febaa82fcf9851fa81b2be44479f40 /exec.c
parentd2702032b4746515cff0bf29891a6b6decfc3d86 (diff)
exec: implement .valid.accepts for subpages
Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/exec.c b/exec.c
index d640d07da4..ab4b4d2b24 100644
--- a/exec.c
+++ b/exec.c
@@ -1558,9 +1558,29 @@ static void subpage_write(void *opaque, hwaddr addr,
io_mem_write(section->mr, addr, value, len);
}
+static bool subpage_accepts(void *opaque, hwaddr addr,
+ unsigned size, bool is_write)
+{
+ subpage_t *mmio = opaque;
+ unsigned int idx = SUBPAGE_IDX(addr);
+ MemoryRegionSection *section;
+#if defined(DEBUG_SUBPAGE)
+ printf("%s: subpage %p %c len %d addr " TARGET_FMT_plx
+ " idx %d\n", __func__, mmio,
+ is_write ? 'w' : 'r', len, addr, idx);
+#endif
+
+ section = &phys_sections[mmio->sub_section[idx]];
+ addr += mmio->base;
+ addr -= section->offset_within_address_space;
+ addr += section->offset_within_region;
+ return memory_region_access_valid(section->mr, addr, size, is_write);
+}
+
static const MemoryRegionOps subpage_ops = {
.read = subpage_read,
.write = subpage_write,
+ .valid.accepts = subpage_accepts,
.endianness = DEVICE_NATIVE_ENDIAN,
};