From patchwork Mon Jun 10 02:01:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 166254 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp469412ilk; Sun, 9 Jun 2019 19:17:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1wq+2Hcqrji6v4pjuBvIUXRYYt7sbU+Op+FTMgBckRncrDqm+kFFMZm9eIlm1nJw59RnU X-Received: by 2002:aed:3824:: with SMTP id j33mr56985247qte.108.1560133058071; Sun, 09 Jun 2019 19:17:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560133058; cv=none; d=google.com; s=arc-20160816; b=wPSizQDw1ceu41nR5UWRqMC881Jaf98TvMGZr4h1x1RWuEe2/6Mj8Le3EajnxQDsis b9NiH1p3JH/XaEf5LWYC/SecpADG+Oz3Mg9Ja1+ULKXvv97Ge471nDCeO2Py586Zctax apw3h1bvshU/XkTsa7jtHHp5JG9pgyJ2xAE/IQfz6yQGbJgnFxvWWmwHWn0Yg0IseK9u zhe0mor3diM3rC6Qw9ewaFy6JdHQe9B2JqRQapr2G7lfLXpAWela9DzSv5kU60PFpaqy fx7f6BReHr8nKOR2OJHz4kBfutzv9v40q3OnA2by/XhNf4pD0XWVNvillqfZWmwoy+mZ TQqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=2YlJXMPiyvFoAXCG6DRvfJeW5V6xBJbkISsj/LLUjoo=; b=y9S8wxpcQeg/f27g/G2nDjUzsquFUVQ2I2pkn27t/OP84dXQXcBg+78pb/23gvXgdR CbDkvlwponCp6X+ghBUgxOl8H8H27awiNdxiaAYER5KqS1xc5z2sUGehJzPI4ZDhJsXB RjLq/kG5+UJTXZ2BPzu86MCAO94woDZ8Zh4L4gEirRHdOrZ5XBUfgYhlJdyUDnnM/UZG IHWrtIt2zfx8r0NfGmCci+gwxU1Wl44t0uAkYWqkiCranqGVze+oIOHIGBiKQVyeH2Zw zGbOjgtIxp6vGu6P40fdCxwGU1+SKHL/Sdo3io+X5mW5ihfyyswI2wjvzRJgLUcuGPf4 THnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=I+sYOtk5; 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 p45si5761395qtj.285.2019.06.09.19.17.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jun 2019 19:17:38 -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=I+sYOtk5; 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 ([::1]:39704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ha9sI-0003Nm-Hl for patch@linaro.org; Sun, 09 Jun 2019 22:17:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53005) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ha9du-0005wn-QZ for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ha9dt-0001gc-7M for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:38 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:39707) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ha9ds-0001gD-Vk for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:37 -0400 Received: by mail-pf1-x442.google.com with SMTP id j2so4319015pfe.6 for ; Sun, 09 Jun 2019 19:02:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2YlJXMPiyvFoAXCG6DRvfJeW5V6xBJbkISsj/LLUjoo=; b=I+sYOtk5x5Da27+J/CJjU1sX/fYyn1mbIlKOtEhkQp1HbV03Veze5WGIF8yv328eQb TbwANtX0Huj0Xs8BfhxV7xUoDSgBd/h62tzeBKv/L0GDaJpzZ/d+/Czolkxi9w5ZGbS2 hvMPk7vFII69Lxj5JVVGr2gwP5tRjOybMFlfGYQo+LcWkOwNIF1Iljnv8PXDpGH1c7lV kwTJTBMokVWeies+oA6xxDbuyynj01Vxn7mcIh5yaubnWtiUiGq7qqU/b5JCo442gfP3 9JtcfJ6zqWAqoaIakw/Hy4UkgK7YNE91xVBQVR3FiqhW6bSz6yRaHRaxdwOrIdXpvBwN IMoA== 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; bh=2YlJXMPiyvFoAXCG6DRvfJeW5V6xBJbkISsj/LLUjoo=; b=oMVXwWoy2D0HxJs0VqcNRIwzQvOJKb7d0VIN0PqfyhdgwxCOHYisxBJHRQCk00Idn+ 986U5340nklcXxdeMZlqJ6dxi/SlXtdkNBXqcj/nAwlWU4sIGmzoUhyvucZSfrixqbl6 12Lygo1W7fnTEx17f8E4Q6a9Yo/S15vJx/VY5Fx4Egb5GzL6BQWQ9ue8uEf81qnQsL5F 9am8QFMa9eN72vsONkGAbfTAwW156uVZBMGzE+8QAcyKF//j5nnGNDl89Am6z3Ak+szh 1u0vDrewpYDW+mPHvR6qkepCglPg5gaA6/VzqfpbD7Be/pzEizEuJuCD0TBuUQt4kBoV xKnw== X-Gm-Message-State: APjAAAWLLAoZohHvSV4wLOYJJSBDU36bxMwvpZh11SJ6ENvbYiELNs/a a11BtMfRZIlo9yqjekQ5ZwwD6WQXRy0= X-Received: by 2002:a62:4e48:: with SMTP id c69mr49502417pfb.176.1560132155483; Sun, 09 Jun 2019 19:02:35 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id l63sm9749013pfl.181.2019.06.09.19.02.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Jun 2019 19:02:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 9 Jun 2019 19:01:51 -0700 Message-Id: <20190610020218.9228-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610020218.9228-1-richard.henderson@linaro.org> References: <20190610020218.9228-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::442 Subject: [Qemu-devel] [PULL 12/39] target/cris: Use env_cpu, env_archcpu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Cleanup in the boilerplate that each target must define. Replace cris_env_get_cpu with env_archcpu. The combination CPU(cris_env_get_cpu) should have used ENV_GET_CPU to begin; use env_cpu now. Reviewed-by: Alistair Francis Reviewed-by: Peter Maydell 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 diff --git a/target/cris/cpu.h b/target/cris/cpu.h index 0746d19f38..e9e4e39a40 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 7ec36cb0b5..86e711108d 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 9cb73bbfec..2acbcfd1c7 100644 --- a/target/cris/mmu.c +++ b/target/cris/mmu.c @@ -288,7 +288,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; @@ -312,7 +311,7 @@ void cris_mmu_flush_pid(CPUCRISState *env, uint32_t pid) if (tlb_v && !tlb_g && (tlb_pid == 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 e4c6942922..6b1e7ae4a8 100644 --- a/target/cris/op_helper.c +++ b/target/cris/op_helper.c @@ -39,7 +39,7 @@ 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); @@ -58,8 +58,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); @@ -72,9 +71,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; @@ -112,7 +108,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 31b40a57f9..3429a3b768 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -3097,7 +3097,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) * 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;