Received: from eggs.gnu.org ([2001:4830:134:3::10]:57653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUg9M-0000EU-So for qemu-devel@nongnu.org; Mon, 31 Mar 2014 13:37:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUg9C-0002RK-Ue for qemu-devel@nongnu.org; Mon, 31 Mar 2014 13:37:32 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45641 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUg9C-0002Qv-Nt for qemu-devel@nongnu.org; Mon, 31 Mar 2014 13:37:22 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 31 Mar 2014 19:37:15 +0200 Message-Id: <1396287436-12696-2-git-send-email-afaerber@suse.de> In-Reply-To: <1396287436-12696-1-git-send-email-afaerber@suse.de> References: <1396287436-12696-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL for-2.0 1/2] target-i386: x86_cpu_get_phys_page_debug(): support 1GB page translation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Luiz Capitulino From: Luiz Capitulino Linux guests, when using more than 4GB of RAM, may end up using 1GB pages to store (kernel) data. When this happens, we're unable to debug a runnin= g Linux kernel with GDB: (gdb) p node_data[0]->node_id Cannot access memory at address 0xffff88013fffd3a0 (gdb) GDB returns this error because x86_cpu_get_phys_page_debug() doesn't supp= ort translating 1GB pages in IA-32e paging mode and returns an error to GDB. This commit adds support for 1GB page translation for IA32e paging. Signed-off-by: Luiz Capitulino Reviewed-by: Paolo Bonzini Reviewed-by: Jan Kiszka Signed-off-by: Andreas F=C3=A4rber --- target-i386/helper.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target-i386/helper.c b/target-i386/helper.c index 4f447b8..372f0e3 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -941,6 +941,14 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vad= dr addr) pdpe =3D ldq_phys(cs->as, pdpe_addr); if (!(pdpe & PG_PRESENT_MASK)) return -1; + + if (pdpe & PG_PSE_MASK) { + page_size =3D 1024 * 1024 * 1024; + pte =3D pdpe & ~( (page_size - 1) & ~0xfff); + pte &=3D ~(PG_NX_MASK | PG_HI_USER_MASK); + goto out; + } + } else #endif { @@ -993,6 +1001,9 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vad= dr addr) pte =3D pte & env->a20_mask; } =20 +#ifdef TARGET_X86_64 +out: +#endif page_offset =3D (addr & TARGET_PAGE_MASK) & (page_size - 1); paddr =3D (pte & TARGET_PAGE_MASK) + page_offset; return paddr; --=20 1.8.4.5