From patchwork Thu Feb 16 14:30:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?S09OUkFEIEZyw6lkw6lyaWM=?= X-Patchwork-Id: 9577421 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 7E94A60209 for ; Thu, 16 Feb 2017 15:16:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D8E428601 for ; Thu, 16 Feb 2017 15:16:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 625BE28606; Thu, 16 Feb 2017 15:16:54 +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 CDC0128601 for ; Thu, 16 Feb 2017 15:16:53 +0000 (UTC) Received: from localhost ([::1]:47269 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceNng-0005Q0-Uc for patchwork-qemu-devel@patchwork.kernel.org; Thu, 16 Feb 2017 10:16:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceN4u-0002LB-6G for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:30:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceN4r-0007RU-0o for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:30:36 -0500 Received: from greensocs.com ([193.104.36.180]:53103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceN4q-0007Nm-L7 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:30:32 -0500 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id C743240D415; Thu, 16 Feb 2017 15:30:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1487255427; bh=18PF8c3PyUfq+tNct/HXy+bj21rBg/co+AD+/XEM+rQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kZebfurAEeTG5A694u++XlWuUyXAwhgeUNGSapmpW5h66ddOsvcgR3P7970pBl8Iq sgSLW09SaOzhxFFXIo77r4CIci/yzcdz9T2FUb2HXW/ylkHZcXg97fkjZBT2cNrnoI 9Ar/NXMHzJL8d2N6PmfDqlmtWACI0UIiZs42V8Dw= X-Virus-Scanned: amavisd-new at greensocs.com Authentication-Results: gs-01.greensocs.com (amavisd-new); dkim=pass (1024-bit key) header.d=greensocs.com Received: from greensocs.com ([127.0.0.1]) by localhost (gs-01.greensocs.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id odnDlODC4k1K; Thu, 16 Feb 2017 15:30:27 +0100 (CET) Received: from corsair.home (bd231-7-88-127-3-24.fbx.proxad.net [88.127.3.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: fred.konrad@greensocs.com) by greensocs.com (Postfix) with ESMTPSA id 91ACF40D40E; Thu, 16 Feb 2017 15:30:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1487255427; bh=18PF8c3PyUfq+tNct/HXy+bj21rBg/co+AD+/XEM+rQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kZebfurAEeTG5A694u++XlWuUyXAwhgeUNGSapmpW5h66ddOsvcgR3P7970pBl8Iq sgSLW09SaOzhxFFXIo77r4CIci/yzcdz9T2FUb2HXW/ylkHZcXg97fkjZBT2cNrnoI 9Ar/NXMHzJL8d2N6PmfDqlmtWACI0UIiZs42V8Dw= From: fred.konrad@greensocs.com To: qemu-devel@nongnu.org Date: Thu, 16 Feb 2017 15:30:07 +0100 Message-Id: <1487255413-14196-2-git-send-email-fred.konrad@greensocs.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487255413-14196-1-git-send-email-fred.konrad@greensocs.com> References: <1487255413-14196-1-git-send-email-fred.konrad@greensocs.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 193.104.36.180 Subject: [Qemu-devel] [PATCH V1 1/7] cputlb: cleanup get_page_addr_code to use VICTIM_TLB_HIT 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: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, mark.burton@greensocs.com, alistair.francis@xilinx.com, clg@kaod.org, pbonzini@redhat.com, fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: KONRAD Frederic This replaces env1 and page_index variables by env and index so we can use VICTIM_TLB_HIT macro later. Signed-off-by: KONRAD Frederic Reviewed-by: Richard Henderson --- cputlb.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cputlb.c b/cputlb.c index 6c39927..665caea 100644 --- a/cputlb.c +++ b/cputlb.c @@ -457,21 +457,21 @@ static void report_bad_exec(CPUState *cpu, target_ulong addr) * is actually a ram_addr_t (in system mode; the user mode emulation * version of this function returns a guest virtual address). */ -tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr) +tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr) { - int mmu_idx, page_index, pd; + int mmu_idx, index, pd; void *p; MemoryRegion *mr; - CPUState *cpu = ENV_GET_CPU(env1); + CPUState *cpu = ENV_GET_CPU(env); CPUIOTLBEntry *iotlbentry; - page_index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); - mmu_idx = cpu_mmu_index(env1, true); - if (unlikely(env1->tlb_table[mmu_idx][page_index].addr_code != + index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); + mmu_idx = cpu_mmu_index(env, true); + if (unlikely(env->tlb_table[mmu_idx][index].addr_code != (addr & TARGET_PAGE_MASK))) { - cpu_ldub_code(env1, addr); + cpu_ldub_code(env, addr); } - iotlbentry = &env1->iotlb[mmu_idx][page_index]; + iotlbentry = &env->iotlb[mmu_idx][index]; pd = iotlbentry->addr & ~TARGET_PAGE_MASK; mr = iotlb_to_region(cpu, pd, iotlbentry->attrs); if (memory_region_is_unassigned(mr)) { @@ -484,7 +484,7 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr) exit(1); } } - p = (void *)((uintptr_t)addr + env1->tlb_table[mmu_idx][page_index].addend); + p = (void *)((uintptr_t)addr + env->tlb_table[mmu_idx][index].addend); return qemu_ram_addr_from_host_nofail(p); }