From patchwork Thu Mar 28 23:03:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 161348 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1331338jan; Thu, 28 Mar 2019 16:30:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+VCpxY+XydWabq79UrBRqqFB13vU9/hQK0/w0gmweOiWjh+Lxw7jItbdXAMmEVMP/2okj X-Received: by 2002:a24:79d1:: with SMTP id z200mr2396466itc.53.1553815829358; Thu, 28 Mar 2019 16:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553815829; cv=none; d=google.com; s=arc-20160816; b=STSAXeVRs3ctrESgRyklbR1ZFzizXmEU6QvJ2IF3l9IBWDjhgPdFTxirXolqUUUVXr aFbs8368I8MxJkl39AnEvgPkbmPHiPinv8KDx7rk3PfCa5T/2vcJnflnh6HyfaRkvnqR UrDKb/lpFR3Fc6FlzeoU47F48hdG/n4R8hp1KuKorflrYM65N1uGsEWx1TvPjQ95Htcn HgGcLaegSlPg6ENEWJ+2bAstQvZBG1vKtbpUlBy9mJZEYGloX/VuxdC7SjUHMF9WZNqs pc9U1p1LOvG8pxYMqeJqUZBgGbPG15OA5YVEmskRqLm4yRRb+Jcg1ghQP9xMQxyKLJZO cp0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=YDXXZKk8gyLGCOyZSj4yYSFdmT3482rnPUV4g3dH+GI=; b=zKSSZus5Z9tnSRluGzNvEnamOB21ow4XSxbqz8fuwzHd0DonfrsbD5CURHd1UvK4q0 87FSiG9xzUrndX9sS2QPKYUJRkQTi6zOi4437Wp73HUJyJBxySrafqMyPfzEV6YildDR PtM4uVjlBiU5id7zZ5mx8q3gZwga9FR7pkGw3WbxG0FrB6U7F6yFrstPFnM0trsThoLY teajV52DA+c94L1de7MnZAZBdlYqYTOfmBleuBISikua/litWUysI3Z1IUa0J44oNRUf GswJU9Uezji/cwGfdW5Mp0WgSYalM6VQRwNKRDD/fwX9TNWd2gQf+f63rFCwpo+TBvXf XxgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kqCEkbWz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a17si201712itk.51.2019.03.28.16.30.29 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 28 Mar 2019 16:30:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kqCEkbWz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:43304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9eTc-0002fQ-Jv for patch@linaro.org; Thu, 28 Mar 2019 19:30:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9eKv-0001jU-Dz for qemu-devel@nongnu.org; Thu, 28 Mar 2019 19:21:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9e4S-00031O-HW for qemu-devel@nongnu.org; Thu, 28 Mar 2019 19:04:30 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:45427) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h9e4Q-00030E-Op for qemu-devel@nongnu.org; Thu, 28 Mar 2019 19:04:27 -0400 Received: by mail-pf1-x444.google.com with SMTP id e24so67723pfi.12 for ; Thu, 28 Mar 2019 16:04:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=YDXXZKk8gyLGCOyZSj4yYSFdmT3482rnPUV4g3dH+GI=; b=kqCEkbWzeNYh5ieTN3hgxK5Efg1jvAaWQ6MGBt8FSgx29mkUar0F9q/AUVERF0UGCG u1OnSl71ftmhv1AnCq8AfBMrpeCulEcvKOTSTCsrmuEzX/wzIVpTmxaOBveSabsYPHiQ ZY1hAxHyKCdhJ3ajqcrsH+7jCrT2kcQyLx7vIOXqdxgqZEVCrZzQIMXnrlKYRf9BO6Ym wn37/8UhorRT8CFh0nqE9cx/NuA1sbFvTvCH2YTsAkk6tJmdPNUbrSjRXHYL6l8XeIBq dsvBYBjxltYau1Uml/n9VnZibeiXBV7YF3+7gAraB8l9rLElUDB32pbgvYXo+LdxPgTV tvjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=YDXXZKk8gyLGCOyZSj4yYSFdmT3482rnPUV4g3dH+GI=; b=XsWT6roBL2W0/p5ALwJXCQdSjvl+r1dS7JSBSkto6z/DLKUVYjpMQ7arhcDV2o1DYz Gfn8t4urU5T3YeLAw/hbANdYxDHhhZAFHUf032ii4z4UU7k2hT6tGsu1Ll+nzOB1VGoq 7SSnlFkmS5yZ/kCySLXh7gYB+mpDunoR2siwTMBbswNO53eUtyXo2vjpGZ8CFrVZxGJU T5SnePTm0sPKwmEDeqJL8EDVk2/r/+g6XDgGj2m4mNw/+5InZdIEAxq+qZIMZQ62NQns 69G4BDt0Uce29XGRHow1rLV6bNlFvvLU78xOLqd7G0eHDgcrhlLAHVAVDFqchCD9qugy CUxA== X-Gm-Message-State: APjAAAX19ZO71rgkv38pZMnyIMO4SYb8MHvq8ZQD8oIl5otg23g+gCPT 5YLuLzRqS3slLLYEUt06BtrxrrtY+d4= X-Received: by 2002:a62:4610:: with SMTP id t16mr44927005pfa.217.1553814265085; Thu, 28 Mar 2019 16:04:25 -0700 (PDT) Received: from cloudburst.ASUS (cpe-66-75-72-255.hawaii.res.rr.com. [66.75.72.255]) by smtp.gmail.com with ESMTPSA id f1sm280911pgl.35.2019.03.28.16.04.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Mar 2019 16:04:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 28 Mar 2019 13:03:38 -1000 Message-Id: <20190328230404.12909-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190328230404.12909-1-richard.henderson@linaro.org> References: <20190328230404.12909-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH for-4.1 v2 10/36] target/cris: Use env_cpu, env_archcpu 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/cris/cpu.h | 5 ----- linux-user/cris/cpu_loop.c | 2 +- target/cris/mmu.c | 3 +-- target/cris/op_helper.c | 10 +++------- target/cris/translate.c | 2 +- 5 files changed, 6 insertions(+), 16 deletions(-) -- 2.17.1 Reviewed-by: Peter Maydell diff --git a/target/cris/cpu.h b/target/cris/cpu.h index 632ebf84b0..6111dbb14c 100644 --- a/target/cris/cpu.h +++ b/target/cris/cpu.h @@ -183,11 +183,6 @@ struct CRISCPU { CPUCRISState env; }; -static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env) -{ - return container_of(env, CRISCPU, env); -} - #define ENV_OFFSET offsetof(CRISCPU, env) #ifndef CONFIG_USER_ONLY diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c index d012e70a7a..06709f19c1 100644 --- a/linux-user/cris/cpu_loop.c +++ b/linux-user/cris/cpu_loop.c @@ -23,7 +23,7 @@ void cpu_loop(CPUCRISState *env) { - CPUState *cs = CPU(cris_env_get_cpu(env)); + CPUState *cs = env_cpu(env); int trapnr, ret; target_siginfo_t info; diff --git a/target/cris/mmu.c b/target/cris/mmu.c index b8db908823..ff0d3f4182 100644 --- a/target/cris/mmu.c +++ b/target/cris/mmu.c @@ -290,7 +290,6 @@ static int cris_mmu_translate_page(struct cris_mmu_result *res, void cris_mmu_flush_pid(CPUCRISState *env, uint32_t pid) { - CRISCPU *cpu = cris_env_get_cpu(env); target_ulong vaddr; unsigned int idx; uint32_t lo, hi; @@ -316,7 +315,7 @@ void cris_mmu_flush_pid(CPUCRISState *env, uint32_t pid) vaddr = tlb_vpn << TARGET_PAGE_BITS; D_LOG("flush pid=%x vaddr=%x\n", pid, vaddr); - tlb_flush_page(CPU(cpu), vaddr); + tlb_flush_page(env_cpu(env), vaddr); } } } diff --git a/target/cris/op_helper.c b/target/cris/op_helper.c index 0ee3a3117b..acb137a8ce 100644 --- a/target/cris/op_helper.c +++ b/target/cris/op_helper.c @@ -67,7 +67,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int size, void helper_raise_exception(CPUCRISState *env, uint32_t index) { - CPUState *cs = CPU(cris_env_get_cpu(env)); + CPUState *cs = env_cpu(env); cs->exception_index = index; cpu_loop_exit(cs); @@ -85,8 +85,7 @@ void helper_tlb_flush_pid(CPUCRISState *env, uint32_t pid) void helper_spc_write(CPUCRISState *env, uint32_t new_spc) { #if !defined(CONFIG_USER_ONLY) - CRISCPU *cpu = cris_env_get_cpu(env); - CPUState *cs = CPU(cpu); + CPUState *cs = env_cpu(env); tlb_flush_page(cs, env->pregs[PR_SPC]); tlb_flush_page(cs, new_spc); @@ -99,9 +98,6 @@ void helper_spc_write(CPUCRISState *env, uint32_t new_spc) void helper_movl_sreg_reg(CPUCRISState *env, uint32_t sreg, uint32_t reg) { -#if !defined(CONFIG_USER_ONLY) - CRISCPU *cpu = cris_env_get_cpu(env); -#endif uint32_t srs; srs = env->pregs[PR_SRS]; srs &= 3; @@ -143,7 +139,7 @@ void helper_movl_sreg_reg(CPUCRISState *env, uint32_t sreg, uint32_t reg) D_LOG("tlb flush vaddr=%x v=%d pc=%x\n", vaddr, tlb_v, env->pc); if (tlb_v) { - tlb_flush_page(CPU(cpu), vaddr); + tlb_flush_page(env_cpu(env), vaddr); } } } diff --git a/target/cris/translate.c b/target/cris/translate.c index 11b2c11174..b5598c6fd5 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -3104,7 +3104,7 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) * delayslot, like in real hw. */ pc_start = tb->pc & ~1; - dc->cpu = cris_env_get_cpu(env); + dc->cpu = env_archcpu(env); dc->tb = tb; dc->is_jmp = DISAS_NEXT;