use address_space_translate to find memory mapping

first version has bugs
This commit is contained in:
Takacs, Philipp
2022-12-22 12:20:36 +01:00
parent cd85f589a2
commit 065af19dc5
22 changed files with 42 additions and 9 deletions

View File

@@ -107,6 +107,18 @@ static uc_err uc_set_tlb(struct uc_struct *uc, int mode) {
}
}
MemoryRegion *find_memory_mapping(struct uc_struct *uc, hwaddr address)
{
hwaddr xlat = 0;
hwaddr len = 1;
MemoryRegion *mr = address_space_translate(&uc->address_space_memory, address, &xlat, &len, false, MEMTXATTRS_UNSPECIFIED);
if (mr == &uc->io_mem_unassigned) {
return NULL;
}
return mr;
}
void softfloat_init(void);
static inline void uc_common_init(struct uc_struct* uc)
{
@@ -124,6 +136,7 @@ static inline void uc_common_init(struct uc_struct* uc)
uc->tcg_flush_tlb = tcg_flush_softmmu_tlb;
uc->memory_map_io = memory_map_io;
uc->set_tlb = uc_set_tlb;
uc->memory_mapping = find_memory_mapping;
if (!uc->release)
uc->release = release_common;