From patchwork Tue Nov 1 15:52:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 9407553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8207560585 for ; Tue, 1 Nov 2016 15:57:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72CD829A49 for ; Tue, 1 Nov 2016 15:57:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6625D29A4B; Tue, 1 Nov 2016 15:57:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 727A229A49 for ; Tue, 1 Nov 2016 15:57:16 +0000 (UTC) Received: from localhost ([::1]:48860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1bR5-0008Gl-N6 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 01 Nov 2016 11:57:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1bMh-0004j2-4Z for qemu-devel@nongnu.org; Tue, 01 Nov 2016 11:52:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1bMa-0003cB-LY for qemu-devel@nongnu.org; Tue, 01 Nov 2016 11:52:43 -0400 Received: from mail-bn3nam01on0072.outbound.protection.outlook.com ([104.47.33.72]:59520 helo=NAM01-BN3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c1bMa-0003c7-Ev for qemu-devel@nongnu.org; Tue, 01 Nov 2016 11:52:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=9fbXk0JacGRj529TnyGK+NKiU3SIQGSqvTiyukAUihE=; b=IrDpmQdF6KGDVJN2W9vpcoMlS9nAUL2Mh2yE/u9DiRB1ISzB4W39LNF+ThXA5fX6Fiu59wrN1vKSb715K5s7sU4OjDGL1WyetQp2PGqalcFcwF1jjbCcOHktGluQ7u6CxYPS9eoZ/h/1IYph7lKGHBTCEgVIG5uhOYgpMppbNRU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from [127.0.1.1] (165.204.77.1) by SN1PR12MB0670.namprd12.prod.outlook.com (10.163.208.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Tue, 1 Nov 2016 15:52:32 +0000 From: Brijesh Singh To: , , , , , , , , , Date: Tue, 1 Nov 2016 11:52:27 -0400 Message-ID: <147801554779.18237.4534364473067017190.stgit@brijesh-build-machine> In-Reply-To: <147801550845.18237.12915616525154608660.stgit@brijesh-build-machine> References: <147801550845.18237.12915616525154608660.stgit@brijesh-build-machine> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CY4PR13CA0016.namprd13.prod.outlook.com (10.168.161.154) To SN1PR12MB0670.namprd12.prod.outlook.com (10.163.208.28) X-MS-Office365-Filtering-Correlation-Id: 18c75e1b-87e3-4d18-25f2-08d4026f17de X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0670; 2:m8DJezmUDR/+7y63698G4Sr1t4hl2TdMjESfo/fQqYbJgI1/xq8QYjJiExpOB0RcMsv1e0GHj0i8JXgLIUjT0GW3SmnJZYj2exu7xr5LR8TAYGXMSSYlXiA8VdCeojTEcBO5zA0NCXb2i6fF7uMoXQWnCUafjb0xLwfVBy4m1EK1BlAfqMByKmGAm7/+UOXH5KIlVB0bEMiVtb97qkQ7lg==; 3:vfx4bstP7biVpn1ym8uY9xI365n5yYNA29V7mAp8L4zk8JpgnptCyxfhBF9umAPCn039yVCFVk71eweRRDINif+ECXrW2psfmb/fBGHRNrXOHwiyxsA3MMw4zOJ9ktDq4mijA/g83artgNwp4hNnxA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0670; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0670; 25:YG1iQonvL2Gi/D5JCMTmU83ThCY0XFiwyiEl93yE2XQ40vpaUbuKr15Qmk1giFqQKIncUYYwSVpj0c4wq7HAPBU/Ww4+J66yuXe8Qb2PeG7twaQDi7D2t5IM0llv8pLxSQ354OInipYGZKn3CNOOSG4t8RackdGNeU0jfdW2aSstirRZsJDCLUpFWgZbMQhteOUyK5T+uvbixKOjS4l3MmSXaWhMvS83duIHjyig9vb1jdvxdb71ObbVR0VCXrmd5wQzuTek+4LGZm/G+3yj0JQV5MQSoza4WOXKofNdWLAmWNaNWUSEdoJqcbUv7skk03MDIDNnGFGld8mTc2BWD653SfjbISR7jSQ3F1LtsLXkqI8jjeqT+Moo9JyTdsKDk+eVHFstfSYY87HdMfNT0yfuKITWADgREmihdINTBCY77nU0Gn02eaEiL7BdFy1oGOX3mmFreGXqfTD5q+zODK0W00vs0Cv6tQus4OPwAz7G/wK4aqueX8P+Ge0hd+vZSiYRLdcRxknE7bqDc5sYp6IfLfG5qtz+V2vEy7IvmMiyWYVQ0bdMS831VctuHlgY8Kxx3+17Y60tATjxABiLtYjr/RCOjlQlyv1zZ/9Pn/VUl6hwKL1fWVtYo4xRyXU6CEU7Uwft1FHC0no1ExnZeYHaYNL6kAuLucHXki6QJwx75fC1RsR/nXkzXTTZR8wZW1diWwvyQkb6IIemOatG/w== X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0670; 31:Uf0MvwEBE+qo1IU9R0Zhln9dghYyR4dccUUgqHN6jE6/jAZzUwYbkH2za4jPSTuOVxQ8AzImhbJ5bdqbc8JxaZWdW8uUuoS1Xa9jQi3FfOaq9SKS7Vjh9+LZQMP68Z6BTzpQmJSHIz2MwrMSsjYqrq9281vj3hYDlHys/eUjgpnXp+TjvooNB8bpW4Zf6M0685pnilfyZfaZJER2i4fD7zxsnAImJGpPqBHCGw1k4x6tZd1PnpSvg+ZZFB9ow4ve; 20:7/e7xQa4LHke5YO4bTOoBeRr4nnDoABiDrEjpEnUlH2VveCOd1cx25H3FHHe2SzbbhXBcCSu146EhvF3hphxQeLSHgylBt8YtxOwO9AKjJTpo/LXrl8NfWEVVGozitJ7KJ4OYvAFszobtYpQ709Ynin+R1w1FqFTE0L4TR7/fhwM24lLJfSldsqwTOlmO6LYi/aJJnzf1mtSXQyDfzcj1OaqLRGrKU8EAtRQavQJWFdsorCiLBSHBr35UhEvVl82P8FGjoC/IK3wrndaTbh+iVWElmhXr1TtxuiyuaWerv5V5sCLVhgIpi7O24ErFAy1QrDTXQdYbR6iy0SPYOGVJPL9vX08+D10yZ6UQ7WueWRUpI9aWrWb5RLqTp1tEzR+8jlYa1UVRavZ1VPSV7CBmY7E8nzfrpVNadyNPsSFpU2Ma6lMSzv2wC/EEPQmt0cY7/a+rDSX40GG1/dQEv8dCHFz8kRVol82NUQYy7SFlAz4lCiXGPUsvLi7t+sP5lyj X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:SN1PR12MB0670; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0670; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0670; 4:SMgXnhvbR07Yu7mq2obBJlkPY6CR5t/OQCM17gtVvrxUPpqyOVG9joZu4eVCKzCfj4jY21V3OICGyMvjr7MVMdFBDbFEgVhKM/kX73H8XqTZPajfzgLpC8E/YNdrjd99LR1EQc5JGuzdtec+QADhHvCcv+J01TGbQ0mE+HmuJ5kaTS2Aw8dkIEistPM1ZUDChA8t1AkQvv3sV3Xap7vhsXhBkb3eP65kXC3eK050KRRcpCOqazveABWxsDHAQNPUMTdPBKpu0fGNExc/4pEbUMFRsyOuHEdbkkGNpKtDZJ3BFH1zIxQmT+OvGr/OOaLA8ZJRrRrmGmAeTDNVk2SYYh2A0R8QB+3O33beLnrsIdFJBQkxOam/iHh55lkn/OWzD1ZEqurCzArzqCtVcSjIQZKl81FQDZRRd4WSOIfYCEqVSK02o94lAINpCeWNBXkBXOTqzet7WFuS1zIE1XXIVg== X-Forefront-PRVS: 01136D2D90 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(199003)(189002)(106356001)(586003)(5001770100001)(77096005)(4326007)(33646002)(54356999)(105586002)(103116003)(76176999)(3846002)(50986999)(92566002)(23676002)(5660300001)(97736004)(4001350100001)(6116002)(42186005)(7416002)(229853001)(101416001)(19580395003)(19580405001)(66066001)(68736007)(189998001)(305945005)(2906002)(230700001)(7846002)(7736002)(50466002)(47776003)(2950100002)(6666003)(33716001)(83506001)(9686002)(86362001)(8676002)(2201001)(81156014)(81166006)(921003)(1121003)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0670; H:[127.0.1.1]; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8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?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0670; 6:sPnegwvwvSDK8xt4KExl1WXAPETCtd5MbQFinRrLIuig6r5pUgK/nl0KF3NYpuh3ePZ67/XYRak5JEH7giOAkLac9EKvfEN+PCxxJDdeW3l+ZE9EbQDBfXd3t1pGPgUidqiz6SkVt8SlKFm9prpY1MGeZ5nqZ5QitFNhG8aeDAPnzK1cEDA36fUlXcNU0mRFT2jzUP5iEH2NHfyx7OudWKxxVRnHw6cPjNjjQBr8/m66P9Tlqk15NEvQwmAUZKRoxPVb+xuOaDccBoPcsK/0sC8umB1rFxexFS9itX5v+4qLUFVRYcYSFLeEgEtPKEKlU/ntpDK5sEXkaYnZNMec2P2pfHZCIQUmv6lRFX0wX2E=; 5:bBcKnC5aWTZptOPUElh00MnqURj8h5+HNRc8lmXF8Ogsi4pcNZepjvL0TXdifdal3dPktm4cEHRnO6ggSnCH4mCWczH+CeG7zPP6HbAtZkvbQL3GGl8UBlmY0DZJ9HtEklQzH058yGD6nLAn9EgZbg==; 24:r8kRlTH+4fQPrJ33nbxNMzPAqXZLAu2gQnH1z2ISXtOXUpQ6HS4zuMuDSlh6FQ/Ww8bUqdSrPI48ceR6aZZAdZPIXG0MeR1bxyPQg63Ty3I= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0670; 7:Km2r8wKc+7G5GROPfgt7uZymLouwZ69uGXMj9aO/JDMNzJQix/uudvhSGZ+MNrmUlv+qgNCKQaVYKEDELAXhFTNjQ/9zKuubCvFiIMopboelX+5KkFvMEaG+ySTXkOLpxRwJzDhGsysBI4Y5Z0KdntuIMTVQwE+qCHCUQ/dET3EH0xH7AYQs0esAp9U/AlTsQViC709BRon5zYc5wB4QZT9zxRO/V7PInnhWLU9lJSEX1euxX/KEVvWZnRX4Ksu+nogX8hOxCv+tCckiXVz64HjENn3WDscC+Ffk73n+ovgYBfLRH77AddauJ8WZ+IR6VKejrSffSr/lD5HSyOVYj64TJR6lFs+9IC0sXaEOih4=; 20:mH8xNZxtToscDrZqEuBhWn7xh7imhT8S/IOzwiROBtHwh4i6hHgx8m0ruNwy5xx6mtwP8RPuRGRR8YKzLG/xj1clMFYmb8dPzEUXAmbdgtLD06k/XQwLzKSFvy7XjlI4DY8TCqUJMt34cIUS+OWTIjyiMhN+vLTgJ5/d6rcFucPTbSc5g8z0aE3fknn7oYQf/JvPjs/SyF3OOJ+YnsRUcovvHZOXT8k9WZU/ZKREjdk75X5jIuin+GCblTF2sL0T X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2016 15:52:32.3386 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0670 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.33.72 Subject: [Qemu-devel] [RFC PATCH v3 04/18] monitor: use debug version of memory access apis 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: brijesh.ksingh@gmail.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP updates hmp monitor to use debug version of memory access apis when accessing the guest memory. Signed-off-by: Brijesh Singh --- cpus.c | 2 +- disas.c | 2 +- monitor.c | 2 +- target-i386/helper.c | 14 +++++++------- target-i386/monitor.c | 47 +++++++++++++++++++++++++++++------------------ 5 files changed, 39 insertions(+), 28 deletions(-) diff --git a/cpus.c b/cpus.c index 5213351..bf9836a 100644 --- a/cpus.c +++ b/cpus.c @@ -1654,7 +1654,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename, l = sizeof(buf); if (l > size) l = size; - cpu_physical_memory_read(addr, buf, l); + cpu_physical_memory_read_debug(addr, buf, l); if (fwrite(buf, 1, l, f) != l) { error_setg(errp, QERR_IO_ERROR); goto exit; diff --git a/disas.c b/disas.c index 67f116a..8861441 100644 --- a/disas.c +++ b/disas.c @@ -354,7 +354,7 @@ monitor_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length, CPUDebug *s = container_of(info, CPUDebug, info); if (monitor_disas_is_physical) { - cpu_physical_memory_read(memaddr, myaddr, length); + cpu_physical_memory_read_debug(memaddr, myaddr, length); } else { cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0); } diff --git a/monitor.c b/monitor.c index 7b963ad..1378491 100644 --- a/monitor.c +++ b/monitor.c @@ -1301,7 +1301,7 @@ static void memory_dump(Monitor *mon, int count, int format, int wsize, if (l > line_size) l = line_size; if (is_physical) { - cpu_physical_memory_read(addr, buf, l); + cpu_physical_memory_read_debug(addr, buf, l); } else { if (cpu_memory_rw_debug(mon_get_cpu(), addr, buf, l, 0) < 0) { monitor_printf(mon, " Cannot access memory\n"); diff --git a/target-i386/helper.c b/target-i386/helper.c index 4ecc091..e707350 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1034,13 +1034,13 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) } pml4e_addr = ((env->cr[3] & ~0xfff) + (((addr >> 39) & 0x1ff) << 3)) & env->a20_mask; - pml4e = x86_ldq_phys(cs, pml4e_addr); + pml4e = ldq_phys_debug(cs, pml4e_addr); if (!(pml4e & PG_PRESENT_MASK)) { return -1; } pdpe_addr = ((pml4e & PG_ADDRESS_MASK) + (((addr >> 30) & 0x1ff) << 3)) & env->a20_mask; - pdpe = x86_ldq_phys(cs, pdpe_addr); + pdpe = ldq_phys_debug(cs, pdpe_addr); if (!(pdpe & PG_PRESENT_MASK)) { return -1; } @@ -1055,14 +1055,14 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) { pdpe_addr = ((env->cr[3] & ~0x1f) + ((addr >> 27) & 0x18)) & env->a20_mask; - pdpe = x86_ldq_phys(cs, pdpe_addr); + pdpe = ldq_phys_debug(cs, pdpe_addr); if (!(pdpe & PG_PRESENT_MASK)) return -1; } pde_addr = ((pdpe & PG_ADDRESS_MASK) + (((addr >> 21) & 0x1ff) << 3)) & env->a20_mask; - pde = x86_ldq_phys(cs, pde_addr); + pde = ldq_phys_debug(cs, pde_addr); if (!(pde & PG_PRESENT_MASK)) { return -1; } @@ -1075,7 +1075,7 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) pte_addr = ((pde & PG_ADDRESS_MASK) + (((addr >> 12) & 0x1ff) << 3)) & env->a20_mask; page_size = 4096; - pte = x86_ldq_phys(cs, pte_addr); + pte = ldq_phys_debug(cs, pte_addr); } if (!(pte & PG_PRESENT_MASK)) { return -1; @@ -1085,7 +1085,7 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) /* page directory entry */ pde_addr = ((env->cr[3] & ~0xfff) + ((addr >> 20) & 0xffc)) & env->a20_mask; - pde = x86_ldl_phys(cs, pde_addr); + pde = ldl_phys_debug(cs, pde_addr); if (!(pde & PG_PRESENT_MASK)) return -1; if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) { @@ -1094,7 +1094,7 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) } else { /* page directory entry */ pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc)) & env->a20_mask; - pte = x86_ldl_phys(cs, pte_addr); + pte = ldl_phys_debug(cs, pte_addr); if (!(pte & PG_PRESENT_MASK)) { return -1; } diff --git a/target-i386/monitor.c b/target-i386/monitor.c index 9a3b4d7..2d125c5 100644 --- a/target-i386/monitor.c +++ b/target-i386/monitor.c @@ -122,20 +122,22 @@ static void tlb_info_pae32(Monitor *mon, CPUArchState *env) } #ifdef TARGET_X86_64 -static void tlb_info_64(Monitor *mon, CPUArchState *env) +static void tlb_info_64(Monitor *mon, CPUState *cs) { + X86CPU *cpu = X86_CPU(cs); + CPUArchState *env = &cpu->env; uint64_t l1, l2, l3, l4; uint64_t pml4e, pdpe, pde, pte; uint64_t pml4_addr, pdp_addr, pd_addr, pt_addr; pml4_addr = env->cr[3] & 0x3fffffffff000ULL; for (l1 = 0; l1 < 512; l1++) { - cpu_physical_memory_read(pml4_addr + l1 * 8, &pml4e, 8); + pml4e = ldq_phys_debug(cs, pml4_addr + l1 * 8); pml4e = le64_to_cpu(pml4e); if (pml4e & PG_PRESENT_MASK) { pdp_addr = pml4e & 0x3fffffffff000ULL; for (l2 = 0; l2 < 512; l2++) { - cpu_physical_memory_read(pdp_addr + l2 * 8, &pdpe, 8); + pdpe = ldq_phys_debug(cs, pdp_addr + l2 * 8); pdpe = le64_to_cpu(pdpe); if (pdpe & PG_PRESENT_MASK) { if (pdpe & PG_PSE_MASK) { @@ -145,7 +147,7 @@ static void tlb_info_64(Monitor *mon, CPUArchState *env) } else { pd_addr = pdpe & 0x3fffffffff000ULL; for (l3 = 0; l3 < 512; l3++) { - cpu_physical_memory_read(pd_addr + l3 * 8, &pde, 8); + pde = ldq_phys_debug(cs, pd_addr + l3 * 8); pde = le64_to_cpu(pde); if (pde & PG_PRESENT_MASK) { if (pde & PG_PSE_MASK) { @@ -156,9 +158,8 @@ static void tlb_info_64(Monitor *mon, CPUArchState *env) } else { pt_addr = pde & 0x3fffffffff000ULL; for (l4 = 0; l4 < 512; l4++) { - cpu_physical_memory_read(pt_addr - + l4 * 8, - &pte, 8); + pte = ldq_phys_debug(cs, + pt_addr + l4 * 8); pte = le64_to_cpu(pte); if (pte & PG_PRESENT_MASK) { print_pte(mon, (l1 << 39) + @@ -181,9 +182,14 @@ static void tlb_info_64(Monitor *mon, CPUArchState *env) void hmp_info_tlb(Monitor *mon, const QDict *qdict) { + X86CPU *cpu; + CPUState *cs; CPUArchState *env; - env = mon_get_cpu_env(); + cs = mon_get_cpu(); + cpu = X86_CPU(cs); + env = &cpu->env; + if (!(env->cr[0] & CR0_PG_MASK)) { monitor_printf(mon, "PG disabled\n"); @@ -192,7 +198,7 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict) if (env->cr[4] & CR4_PAE_MASK) { #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { - tlb_info_64(mon, env); + tlb_info_64(mon, cs); } else #endif { @@ -324,10 +330,12 @@ static void mem_info_pae32(Monitor *mon, CPUArchState *env) #ifdef TARGET_X86_64 -static void mem_info_64(Monitor *mon, CPUArchState *env) +static void mem_info_64(Monitor *mon, CPUState *cs) { int prot, last_prot; uint64_t l1, l2, l3, l4; + X86CPU *cpu = X86_CPU(cs); + CPUArchState *env = &cpu->env; uint64_t pml4e, pdpe, pde, pte; uint64_t pml4_addr, pdp_addr, pd_addr, pt_addr, start, end; @@ -335,13 +343,13 @@ static void mem_info_64(Monitor *mon, CPUArchState *env) last_prot = 0; start = -1; for (l1 = 0; l1 < 512; l1++) { - cpu_physical_memory_read(pml4_addr + l1 * 8, &pml4e, 8); + pml4e = ldq_phys_debug(cs, pml4_addr + l1 * 8); pml4e = le64_to_cpu(pml4e); end = l1 << 39; if (pml4e & PG_PRESENT_MASK) { pdp_addr = pml4e & 0x3fffffffff000ULL; for (l2 = 0; l2 < 512; l2++) { - cpu_physical_memory_read(pdp_addr + l2 * 8, &pdpe, 8); + pdpe = ldq_phys_debug(cs, pdp_addr + l2 * 8); pdpe = le64_to_cpu(pdpe); end = (l1 << 39) + (l2 << 30); if (pdpe & PG_PRESENT_MASK) { @@ -353,7 +361,7 @@ static void mem_info_64(Monitor *mon, CPUArchState *env) } else { pd_addr = pdpe & 0x3fffffffff000ULL; for (l3 = 0; l3 < 512; l3++) { - cpu_physical_memory_read(pd_addr + l3 * 8, &pde, 8); + pde = ldq_phys_debug(cs, pd_addr + l3 * 8); pde = le64_to_cpu(pde); end = (l1 << 39) + (l2 << 30) + (l3 << 21); if (pde & PG_PRESENT_MASK) { @@ -365,9 +373,8 @@ static void mem_info_64(Monitor *mon, CPUArchState *env) } else { pt_addr = pde & 0x3fffffffff000ULL; for (l4 = 0; l4 < 512; l4++) { - cpu_physical_memory_read(pt_addr - + l4 * 8, - &pte, 8); + pte = ldq_phys_debug(cs, + pt_addr + l4 * 8); pte = le64_to_cpu(pte); end = (l1 << 39) + (l2 << 30) + (l3 << 21) + (l4 << 12); @@ -404,9 +411,13 @@ static void mem_info_64(Monitor *mon, CPUArchState *env) void hmp_info_mem(Monitor *mon, const QDict *qdict) { + X86CPU *cpu; + CPUState *cs; CPUArchState *env; - env = mon_get_cpu_env(); + cs = mon_get_cpu(); + cpu = X86_CPU(cs); + env = &cpu->env; if (!(env->cr[0] & CR0_PG_MASK)) { monitor_printf(mon, "PG disabled\n"); @@ -415,7 +426,7 @@ void hmp_info_mem(Monitor *mon, const QDict *qdict) if (env->cr[4] & CR4_PAE_MASK) { #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { - mem_info_64(mon, env); + mem_info_64(mon, cs); } else #endif {