From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLxw2-0002gv-D1 for qemu-devel@nongnu.org; Tue, 17 Sep 2013 12:15:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLxvt-0007jW-VN for qemu-devel@nongnu.org; Tue, 17 Sep 2013 12:15:30 -0400 Received: from mail-ob0-x235.google.com ([2607:f8b0:4003:c01::235]:51673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLxvt-0007jS-Qy for qemu-devel@nongnu.org; Tue, 17 Sep 2013 12:15:21 -0400 Received: by mail-ob0-f181.google.com with SMTP id gq1so5537714obb.26 for ; Tue, 17 Sep 2013 09:15:21 -0700 (PDT) Sender: Richard Henderson Message-ID: <52388014.2090401@twiddle.net> Date: Tue, 17 Sep 2013 09:15:16 -0700 From: Richard Henderson MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] Single stepping & GDB on ARM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Emmanuel Blot Cc: Peter Maydell , QEMU Developers On 09/17/2013 03:02 AM, Emmanuel Blot wrote: > There is a piece of code I'm not sure to understand, in > get_page_addr_code(CPUArchState *env1, target_ulong addr) > > … > if (unlikely(env1->tlb_table[mmu_idx][page_index].addr_code != > (addr & TARGET_PAGE_MASK))) { > cpu_ldub_code(env1, addr); > } > pd = env1->iotlb[mmu_idx][page_index] & ~TARGET_PAGE_MASK; > mr = iotlb_to_region(pd); > if (memory_region_is_unassigned(mr)) > … > > cpu_ldub_code() leads to call io_mem_read() which may trigger a > unassigned_mem_read(). > In this case, the invalid mem access is always considered as a data > access, whereas it is an execution access if I'm not mistaken. > > In other words, before > get_page_addr_code:memory_region_is_unassigned() is tested and > get_page_addr_code:do_unassigned_access() gets a "chance" to be called > as an "instruction" invalid access, another unsigned access is > triggered with a "data" invalid access. > > Did I miss something here? No miss. That cpu_ldub_code ought to be just a straight tlb fill, rather than a read with discarded result. E.g. the tlb_fill(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr); line from exec/softmmu_template.h. r~