implement host-controlled memory mapping for #261

This commit is contained in:
Ryan Hileman
2015-11-27 17:25:53 -08:00
parent c6b6ba5daa
commit 6d21ebabea
19 changed files with 160 additions and 7 deletions

View File

@@ -48,6 +48,23 @@ MemoryRegion *memory_map(struct uc_struct *uc, ram_addr_t begin, size_t size, ui
return ram;
}
MemoryRegion *memory_map_ptr(struct uc_struct *uc, ram_addr_t begin, size_t size, void *ptr)
{
MemoryRegion *ram = g_new(MemoryRegion, 1);
memory_region_init_ram_ptr(uc, ram, NULL, "pc.ram", size, ptr);
if (ram->ram_addr == -1)
// out of memory
return NULL;
memory_region_add_subregion(get_system_memory(uc), begin, ram);
if (uc->current_cpu)
tlb_flush(uc->current_cpu, 1);
return ram;
}
void memory_unmap(struct uc_struct *uc, MemoryRegion *mr)
{
int i;