accel/tcg: Correct "is this a TLB miss" check in get_page_addr_code()

In commit 71b9a45330fe220d1 we changed the condition we use
to determine whether we need to refill the TLB in
get_page_addr_code() to
if (unlikely(env->tlb_table[mmu_idx][index].addr_code !=
(addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK)))) {

This isn't the right check (it will falsely fail if the
input addr happens to have the low bit corresponding to
TLB_INVALID_MASK set, for instance). Replace it with a
use of the new tlb_hit() function, which is the correct test.

Backports commit e4c967a7201400d7f76e5847d5b4c4ac9e2566e0 from qemu
This commit is contained in:
Peter Maydell 2018-07-03 19:23:20 -04:00 committed by Lioncash
parent 6543f9ea26
commit 0c6311f8cc
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -313,8 +313,7 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr)
index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
mmu_idx = cpu_mmu_index(env, true);
if (unlikely(env->tlb_table[mmu_idx][index].addr_code !=
(addr & TARGET_PAGE_MASK))) {
if (unlikely(!tlb_hit(env->tlb_table[mmu_idx][index].addr_code, addr))) {
cpu_ldub_code(env, addr);
//check for NX related error from softmmu
if (env->invalid_error == UC_ERR_FETCH_PROT) {