struct MemoryRegionCache {
hwaddr xlat;
- void *ptr;
hwaddr len;
- MemoryRegion *mr;
- bool is_write;
+ AddressSpace *as;
};
-#define MEMORY_REGION_CACHE_INVALID ((MemoryRegionCache) { .mr = NULL })
+#define MEMORY_REGION_CACHE_INVALID ((MemoryRegionCache) { .as = NULL })
/* address_space_cache_init: prepare for repeated access to a physical
* memory region
void *buf, int len)
{
assert(addr < cache->len && len <= cache->len - addr);
- memcpy(buf, cache->ptr + addr, len);
+ address_space_read(cache->as, cache->xlat + addr, MEMTXATTRS_UNSPECIFIED, buf, len);
}
/**
void *buf, int len)
{
assert(addr < cache->len && len <= cache->len - addr);
- memcpy(cache->ptr + addr, buf, len);
+ address_space_write(cache->as, cache->xlat + addr, MEMTXATTRS_UNSPECIFIED, buf, len);
}
#endif