diff options
author | Artyom Tarasenko <atar4qemu@gmail.com> | 2016-04-15 22:21:43 +0200 |
---|---|---|
committer | Artyom Tarasenko <atar4qemu@gmail.com> | 2017-01-18 22:03:44 +0100 |
commit | 70f44d2f4bce44fa04426def3290306fa8064b91 (patch) | |
tree | 2eb1315f3b636d426507b26827885eb3649a08c0 /target/sparc/ldst_helper.c | |
parent | 913b5f2827d83b573a23960ae2b15795c9b925cd (diff) |
target-sparc: implement auto-demapping for UA2005 CPUs
Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Diffstat (limited to 'target/sparc/ldst_helper.c')
-rw-r--r-- | target/sparc/ldst_helper.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c index d4eee33ee6..4f55388338 100644 --- a/target/sparc/ldst_helper.c +++ b/target/sparc/ldst_helper.c @@ -210,6 +210,28 @@ static void replace_tlb_1bit_lru(SparcTLBEntry *tlb, { unsigned int i, replace_used; + if (cpu_has_hypervisor(env1)) { + uint64_t new_vaddr = tlb_tag & ~0x1fffULL; + uint64_t new_size = 8192ULL << 3 * TTE_PGSIZE(tlb_tte); + uint32_t new_ctx = tlb_tag & 0x1fffU; + for (i = 0; i < 64; i++) { + uint32_t ctx = tlb[i].tag & 0x1fffU; + /* check if new mapping overlaps an existing one */ + if (new_ctx == ctx) { + uint64_t vaddr = tlb[i].tag & ~0x1fffULL; + uint64_t size = 8192ULL << 3 * TTE_PGSIZE(tlb[i].tte); + if (new_vaddr == vaddr + || (new_vaddr < vaddr + size + && vaddr < new_vaddr + new_size)) { + DPRINTF_MMU("auto demap entry [%d] %lx->%lx\n", i, vaddr, + new_vaddr); + replace_tlb_entry(&tlb[i], tlb_tag, tlb_tte, env1); + return; + } + } + + } + } /* Try replacing invalid entry */ for (i = 0; i < 64; i++) { if (!TTE_IS_VALID(tlb[i].tte)) { |