fixed: compare virtual address instead of physical in lookup_mapping()

This commit is contained in:
Markus Fröschle
2014-01-21 12:43:32 +00:00
parent bb378a5cd0
commit 401a9bd2e5

View File

@@ -347,7 +347,7 @@ static struct mmu_mapping memory_map[] =
{ CACHE_NOCACHE_PRECISE, SV_PROTECT, 0, ACCESS_READ | ACCESS_WRITE }, { CACHE_NOCACHE_PRECISE, SV_PROTECT, 0, ACCESS_READ | ACCESS_WRITE },
}, },
{ {
/* the same, but different mapping */ /* the same, but different virtual address */
(uint32_t) 0x00f00000, (uint32_t) 0x00f00000,
(uint32_t) 0xfff00000, (uint32_t) 0xfff00000,
(uint32_t) 0x100000, (uint32_t) 0x100000,
@@ -358,7 +358,7 @@ static struct mmu_mapping memory_map[] =
static int num_mmu_maps = sizeof(memory_map) / sizeof(struct mmu_mapping); static int num_mmu_maps = sizeof(memory_map) / sizeof(struct mmu_mapping);
static struct mmu_mapping *lookup_mapping(uint32_t address) static struct mmu_mapping *lookup_mapping(uint32_t virt)
{ {
int i; int i;
@@ -368,7 +368,7 @@ static struct mmu_mapping *lookup_mapping(uint32_t address)
for (i = 0; i < num_mmu_maps; i++) for (i = 0; i < num_mmu_maps; i++)
{ {
if (address >= memory_map[i].phys && address <= memory_map[i].phys + memory_map[i].length - 1) if (virt >= memory_map[i].virt && virt <= memory_map[i].virt + memory_map[i].length - 1)
return &memory_map[i]; return &memory_map[i];
} }
return NULL; return NULL;