Skip to content

Commit

Permalink
cputlb: fix the way get_page_addr_code fills the tlb
Browse files Browse the repository at this point in the history
get_page_addr_code(..) does a cpu_ldub_code to fill the tlb:
This can lead to some side effects if a device is mapped at this address.

So this patch replaces the cpu_memory_ld by a tlb_fill.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
  • Loading branch information
konrad-fred authored and edgarigl committed Jun 27, 2017
1 parent f2553f0 commit 71b9a45
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions accel/tcg/cputlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,8 +849,10 @@ 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))) {
cpu_ldub_code(env, addr);
(addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK)))) {
if (!VICTIM_TLB_HIT(addr_read, addr)) {
tlb_fill(ENV_GET_CPU(env), addr, MMU_INST_FETCH, mmu_idx, 0);
}
}
iotlbentry = &env->iotlb[mmu_idx][index];
pd = iotlbentry->addr & ~TARGET_PAGE_MASK;
Expand Down

0 comments on commit 71b9a45

Please sign in to comment.