Skip to content

Commit

Permalink
cputlb: Fix io_readx() to respect the access_type
Browse files Browse the repository at this point in the history
This change adapts io_readx() to its input access_type. Currently
io_readx() treats any memory access as a read, although it has an
input argument "MMUAccessType access_type". This results in:

1) Calling the tlb_fill() only with MMU_DATA_LOAD
2) Considering only entry->addr_read as the tlb_addr

Buglink: https://bugs.launchpad.net/qemu/+bug/1825359
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Shahab Vahedi <shahab.vahedi@gmail.com>
Message-Id: <20190420072236.12347-1-shahab.vahedi@gmail.com>
[rth: Remove assert; fix expression formatting.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
shahab-vahedi authored and rth7680 committed Apr 25, 2019
1 parent b4b82d7 commit ef5dae6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions accel/tcg/cputlb.c
Expand Up @@ -878,10 +878,11 @@ static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry,
CPUTLBEntry *entry;
target_ulong tlb_addr;

tlb_fill(cpu, addr, size, MMU_DATA_LOAD, mmu_idx, retaddr);
tlb_fill(cpu, addr, size, access_type, mmu_idx, retaddr);

entry = tlb_entry(env, mmu_idx, addr);
tlb_addr = entry->addr_read;
tlb_addr = (access_type == MMU_DATA_LOAD ?
entry->addr_read : entry->addr_code);
if (!(tlb_addr & ~(TARGET_PAGE_MASK | TLB_RECHECK))) {
/* RAM access */
uintptr_t haddr = addr + entry->addend;
Expand Down

0 comments on commit ef5dae6

Please sign in to comment.