[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/5] exec: fix code tlb entry misused as iotlb i
From: |
Avi Kivity |
Subject: |
Re: [Qemu-devel] [PATCH 3/5] exec: fix code tlb entry misused as iotlb in get_page_addr_code() |
Date: |
Sun, 18 Mar 2012 18:33:47 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 |
On 03/18/2012 01:07 PM, Max Filippov wrote:
> >>> get_page_addr_code() reads a code tlb entry, but interprets it as an
> >>> iotlb entry. This works by accident since the low bits of a RAM code
> >>> tlb entry are clear, and match a RAM iotlb entry. This accident is
> >>> about to unhappen, so fix the code to use an iotlb entry (using the
> >>> code entry with TLB_MMIO may fail if the page is a watchpoint).
> >>>
> >>> Signed-off-by: Avi Kivity<address@hidden>
> >>> ---
> >>> exec.c | 2 +-
> >>> 1 files changed, 1 insertions(+), 1 deletions(-)
> >>>
> >>> diff --git a/exec.c b/exec.c
> >>> index a35eb4f..f26d1b0 100644
> >>> --- a/exec.c
> >>> +++ b/exec.c
> >>> @@ -4685,7 +4685,7 @@ tb_page_addr_t get_page_addr_code(CPUState
> >>> *env1, target_ulong addr)
> >>> (addr& TARGET_PAGE_MASK))) {
> >>> ldub_code(addr);
> >>> }
> >>> - pd = env1->tlb_table[mmu_idx][page_index].addr_code&
> >>> ~TARGET_PAGE_MASK;
> >>> + pd = env1->iotlb[mmu_idx][page_index]& ~TARGET_PAGE_MASK;
> >>> if (pd != io_mem_ram.ram_addr&& pd != io_mem_rom.ram_addr
> >>> && !io_mem_region[pd]->rom_device) {
> >>> #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) ||
> >>> defined(TARGET_SPARC)
> >>
> >> With this patch xtensa debug option unit test causes qemu abort with
> >> the message
> >>
> >> qemu: fatal: Trying to execute code outside RAM or ROM at 0xd000088c
> >>
> >> This happens immediately after a watchpoint setup for a data
> >> breakpoint at the same memory page where the currently
> >> executed code is located. Any idea on how to fix it?
> >
> > Can you provide details on how to reproduce this?
>
> It may be reproduced by running test_break.tst unit test:
>
> qemu-system-xtensa -M sim -cpu dc232b -nographic -semihosting -kernel
> ./test_break.tst
>
> Compiled test binary is here:
> http://jcmvbkbc.spb.ru/~dumb/ws/osll/qemu-xtensa/20120318/test_break.tst
>
Thanks. Please try out the attached patch.
--
error compiling committee.c: too many arguments to function
0001-memory-check-for-watchpoints-when-getting-code-ram_a.patch
Description: Text Data
[Qemu-devel] [PATCH 4/5] memory: dispatch directly via MemoryRegion, Avi Kivity, 2012/03/08
[Qemu-devel] [PATCH 2/5] memory: store section indices in iotlb instead of io indices, Avi Kivity, 2012/03/08
[Qemu-devel] [PATCH 5/5] memory: get rid of cpu_register_io_memory(), Avi Kivity, 2012/03/08