From nobody Sun Feb 8 22:21:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493594658720973.5625679429959; Sun, 30 Apr 2017 16:24:18 -0700 (PDT) Received: from localhost ([::1]:46224 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d4yCP-0000Ke-GF for importer@patchew.org; Sun, 30 Apr 2017 19:24:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d4y3S-0001uP-Si for qemu-devel@nongnu.org; Sun, 30 Apr 2017 19:15:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d4y3R-0006Vp-4M for qemu-devel@nongnu.org; Sun, 30 Apr 2017 19:15:02 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:36471) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d4y3Q-0006VU-Uu for qemu-devel@nongnu.org; Sun, 30 Apr 2017 19:15:01 -0400 Received: by mail-pf0-x244.google.com with SMTP id v14so25734945pfd.3 for ; Sun, 30 Apr 2017 16:15:00 -0700 (PDT) Received: from localhost (z209.124-44-183.ppp.wakwak.ne.jp. [124.44.183.209]) by smtp.gmail.com with ESMTPSA id d1sm8472519pfa.56.2017.04.30.16.14.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 30 Apr 2017 16:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=yxHg3XOdD+A+57odxRvo3TC/7WsvaeDBVyL72alOQJg=; b=nPM3sU3y3EetgNZjfRscK8L98ykcBv7g44sPIxI3FUHiIyux2cFd2zpF+QIs5onFmw 5n+lYoCUNJzgMv1Q/vDAE4ZA9kkz6irCzTm2EozTP0iehmfs82R66QOpcMQWFsFlcZkk 3ugJ3GorHQnjMunxuRHCXkswNXtX8ghQL6kMn7VkDY0c3RXb29GqXPtD+efmYJ1wbwM3 qosw4OwXLAOuL4+BAB4XFP/Z+uaDN7GcJskxel67igu94dI1KD4QIqoGb2yAz3Nn5RUL 9fIbHQ4+V57URF6V6vETACP+Qz0S8v0bzkfWEXKGZADBfJ4RMc4cpLQfhzG+1PJgj/EC PZ/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=yxHg3XOdD+A+57odxRvo3TC/7WsvaeDBVyL72alOQJg=; b=SnJPBCHxN4DgpimG743GnU0NrCKx0FQ5dltAUe4bDHYBw9PQxPWeEbu36iYv8v3q/F hjs6e0qXQ9AJjKkorPgg8YsA0Ov0e6QzvsCFu5gwZCFZ/9BKLQxASyqTKkqAOJIqjzG9 guKXzCSLYFlqWljliwF1weqjwhQEdWXjN+myK+QY5DDXfs0zENtjgLp0WWMGiHXAdm8B IbgjHi2TDpCyWxu+mWqo2MMV84h+7KY9TsTR7ZnyAGVTg9XAePzQYxODWp4yR6MO3W3G 1nOBXbVGtzPTq+vrv4MZQs+6LAxPfpp+0ypa2NW5TmWbSmUD8Gu8i/LGtmH9DNiSJxkk w4hA== X-Gm-Message-State: AN3rC/6cE33it3uNCci3JL/XD8i4VJZPtBYy9uhynrUa6fXAnIUJmovL ty1AfwL9+kEbiv/t X-Received: by 10.98.153.216 with SMTP id t85mr23750830pfk.178.1493594100233; Sun, 30 Apr 2017 16:15:00 -0700 (PDT) From: Stafford Horne To: peter.maydell@linaro.org Date: Mon, 1 May 2017 08:14:18 +0900 Message-Id: X-Mailer: git-send-email 2.9.3 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::244 Subject: [Qemu-devel] [PULL 04/11] target/openrisc: Fixes for memory debugging X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stafford Horne , QEMU Development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When debugging in gdb you might want to inspect instructions in mapped pages or in exception vectors like 0x800 etc. This was previously not possible in qemu since the *get_phys_page_debug() routine only looked into the data tlb. Change to fall back to look into instruction tlb and plain physical pages. Reviewed-by: Richard Henderson Signed-off-by: Stafford Horne --- target/openrisc/mmu.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/target/openrisc/mmu.c b/target/openrisc/mmu.c index 56b11d3..a6d7bcd 100644 --- a/target/openrisc/mmu.c +++ b/target/openrisc/mmu.c @@ -124,7 +124,7 @@ static int cpu_openrisc_get_phys_addr(OpenRISCCPU *cpu, { int ret =3D TLBRET_MATCH; =20 - if (rw =3D=3D 2) { /* ITLB */ + if (rw =3D=3D MMU_INST_FETCH) { /* ITLB */ *physical =3D 0; ret =3D cpu->env.tlb->cpu_openrisc_map_address_code(cpu, physical, prot, address, r= w); @@ -221,12 +221,27 @@ hwaddr openrisc_cpu_get_phys_page_debug(CPUState *cs,= vaddr addr) OpenRISCCPU *cpu =3D OPENRISC_CPU(cs); hwaddr phys_addr; int prot; + int miss; =20 - if (cpu_openrisc_get_phys_addr(cpu, &phys_addr, &prot, addr, 0)) { - return -1; + /* Check memory for any kind of address, since during debug the + gdb can ask for anything, check data tlb for address */ + miss =3D cpu_openrisc_get_phys_addr(cpu, &phys_addr, &prot, addr, 0); + + /* Check instruction tlb */ + if (miss) { + miss =3D cpu_openrisc_get_phys_addr(cpu, &phys_addr, &prot, addr, = MMU_INST_FETCH); + } + + /* Last, fall back to a plain address */ + if (miss) { + miss =3D cpu_openrisc_get_phys_nommu(cpu, &phys_addr, &prot, addr,= 0); } =20 - return phys_addr; + if (miss) { + return -1; + } else { + return phys_addr; + } } =20 void cpu_openrisc_mmu_init(OpenRISCCPU *cpu) --=20 2.9.3