From patchwork Tue Jun 4 20:33:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 165834 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp6343687ili; Tue, 4 Jun 2019 13:51:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyTyRKaNffzjmaFHKtamLkivmpnl4EYLocoIXyUQAlKKKmi/89OllChpHAUMsup4WZ/texv X-Received: by 2002:ac8:3037:: with SMTP id f52mr30429553qte.364.1559681501038; Tue, 04 Jun 2019 13:51:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559681501; cv=none; d=google.com; s=arc-20160816; b=vB8rcbOYjMsVdo4LuofXICRH0bwQkOhQRTXwin/gIGr+cC3PFfhXX6vPC86F0X5e/W j72gWK2g3ddN1KvW1VzyxgapefMZamy+CWlnlnNIJwwpKdCSp+zAVVQ3aDRSTCOMJ1wi 7jKc5VSihjZTqHfCyXFwreg3NYpz12J5cQ5zr46bXL+JDpHt+S4ItH5CHcOHcnuqF7tL tnHvrSMlZmefW+Kk0kNq8NupT5G+cyDcHjZ0x9Otw02CQ5iKGF0VrM5AUYgdhk/4/MeP ff9q3b0k1kMxNBIhj4F4gM0yitPHZNzRNAVFYHFgRnzB45Q9Nlc5Cgn78HIxY/KDLLvO DsXg== 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=tSiI4G5J5ouiA/gsVkWkdNcl9+jS6pdNMYuFN+MKcoA=; b=tIQPPP1paB3JUJDraWNyTweHWG44UKt+WC+99EpRYkcDKSHUdoKK45VS564fVNS925 Jp/1/+q/MkUcNfIQSpERfCKvgzuBRL7CF3uDlBw6j7v3KuEgb5AtruvyeofbhSNCMBAp +A3Lzlsw9hOMXl32TzU8GofBZy7yq8E7zEvxKyQKz+AtoYCbIWpVH1ccebTx9ojU8Iqn YYfKuLBHLSjMxQ25wxZcrrCW1DkYIf7nw2aPxVTLRJbtpsv922nrQM/YqpBMsATslKy5 Ni2VV8ZDT3+Yk/E1nTc/cmnwcPGYfpcT8qEJrnl03NSgzjgLQ0w0q64izn6f5gT+ZMLX jfBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jiF+zYDf; 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 y11si948284qva.106.2019.06.04.13.51.40 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 04 Jun 2019 13:51:41 -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=jiF+zYDf; 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]:57839 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYGPE-00077C-Ez for patch@linaro.org; Tue, 04 Jun 2019 16:51:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYG8c-0001K6-7O for qemu-devel@nongnu.org; Tue, 04 Jun 2019 16:34:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYG8b-0004Q6-7Q for qemu-devel@nongnu.org; Tue, 04 Jun 2019 16:34:30 -0400 Received: from mail-oi1-x241.google.com ([2607:f8b0:4864:20::241]:40974) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hYG8b-0004PM-2G for qemu-devel@nongnu.org; Tue, 04 Jun 2019 16:34:29 -0400 Received: by mail-oi1-x241.google.com with SMTP id b21so12668685oic.8 for ; Tue, 04 Jun 2019 13:34:29 -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=tSiI4G5J5ouiA/gsVkWkdNcl9+jS6pdNMYuFN+MKcoA=; b=jiF+zYDfziQIWsSLbY3qDc8I+sLKQVvgdJtiOLtlpnKPGRm1QzKc9pMKi1Y4LqCC1e b3PxHsP33RiaC33MXSMSD58AmDey5CU2u+8kOaZ1D8Y3Ds/8+CsSDC+yPF/LiwppZ194 x6BZNurk2Vzyfs3BIf+ArQSTjkGkfuJ1WZhbdZWUclCZf2QeSHNdGjxRP125zFMDeUsx r+4P8uZB44u/THcDynkL9XYeU0Z1knvS4oSQdx9ijnmBrv3OkBTjNq3RrbLkKXLVHxxJ l72XRQNAG3kYPVOfOSrdx3DShwD7N8ZDesZpgsf/9ICiCUxpvV/EhAPRpGCI+WFiXXch gSeg== 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=tSiI4G5J5ouiA/gsVkWkdNcl9+jS6pdNMYuFN+MKcoA=; b=saHF9L5Xr+REGykqdw/dBfeuN4oD6pqF93mbxY2UAsErBqilzqDdb+g3rIGUuFqIC+ Ff2/Tg2iHZySWkTqp/IL1/mq1oo4Ylp3kOAv2HqLRPzVUcgIcBdpdYgEHSInnNqqXFNg vtaCK8IS9/s/hbD2Wwie+FWj5p3QaAtuU7e10HI9Rb+zagswnQrlOtRsEAapPyW1maGa fHrHS5dspVAd+gQqrBe+JrgLYJYKg63g9dOFRpqZy03IwOjUzN3Keb79Ddo790jd5dA6 emSYdCn+r0uN0gOapiSc9wOVNaP80IILa5475ucyfSjQJfbY2ASTB1cCr/F16dh93EFU oPaw== X-Gm-Message-State: APjAAAUrp3NGBA8g73BBz4+6vLNhtVjmtrhRTHHb6fnsUY60eKlI6/z3 6V2DPQRg5uL7d6umXB9IgR2dJhsV6psa0g== X-Received: by 2002:aca:5f8b:: with SMTP id t133mr5736686oib.85.1559680468104; Tue, 04 Jun 2019 13:34:28 -0700 (PDT) Received: from localhost.localdomain (200-56-192-86-cable.cybercable.net.mx. [200.56.192.86]) by smtp.gmail.com with ESMTPSA id h1sm5979901otj.78.2019.06.04.13.34.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jun 2019 13:34:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 4 Jun 2019 15:33:33 -0500 Message-Id: <20190604203351.27778-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604203351.27778-1-richard.henderson@linaro.org> References: <20190604203351.27778-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::241 Subject: [Qemu-devel] [PATCH v4 21/39] target/openrisc: 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" Cleanup in the boilerplate that each target must define. Replace openrisc_env_get_cpu with env_archcpu. The combination CPU(openrisc_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/openrisc/cpu.h | 5 ----- linux-user/openrisc/cpu_loop.c | 2 +- target/openrisc/exception_helper.c | 5 ++--- target/openrisc/sys_helper.c | 8 ++++---- 4 files changed, 7 insertions(+), 13 deletions(-) -- 2.17.1 diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index 50f79d540b..9e46ac5266 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -317,11 +317,6 @@ typedef struct OpenRISCCPU { } OpenRISCCPU; -static inline OpenRISCCPU *openrisc_env_get_cpu(CPUOpenRISCState *env) -{ - return container_of(env, OpenRISCCPU, env); -} - #define ENV_OFFSET offsetof(OpenRISCCPU, env) void cpu_openrisc_list(void); diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c index f496e4b48a..4b8165b261 100644 --- a/linux-user/openrisc/cpu_loop.c +++ b/linux-user/openrisc/cpu_loop.c @@ -23,7 +23,7 @@ void cpu_loop(CPUOpenRISCState *env) { - CPUState *cs = CPU(openrisc_env_get_cpu(env)); + CPUState *cs = env_cpu(env); int trapnr; abi_long ret; target_siginfo_t info; diff --git a/target/openrisc/exception_helper.c b/target/openrisc/exception_helper.c index 0797cc9d38..d02a1cf0aa 100644 --- a/target/openrisc/exception_helper.c +++ b/target/openrisc/exception_helper.c @@ -25,15 +25,14 @@ void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp) { - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); + OpenRISCCPU *cpu = env_archcpu(env); raise_exception(cpu, excp); } static void QEMU_NORETURN do_range(CPUOpenRISCState *env, uintptr_t pc) { - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); - CPUState *cs = CPU(cpu); + CPUState *cs = env_cpu(env); cs->exception_index = EXCP_RANGE; cpu_loop_exit_restore(cs, pc); diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c index 05f66c455b..8f11cb8202 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -30,8 +30,8 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) { #ifndef CONFIG_USER_ONLY - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); - CPUState *cs = CPU(cpu); + OpenRISCCPU *cpu = env_archcpu(env); + CPUState *cs = env_cpu(env); target_ulong mr; int idx; @@ -194,8 +194,8 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd, target_ulong spr) { #ifndef CONFIG_USER_ONLY - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); - CPUState *cs = CPU(cpu); + OpenRISCCPU *cpu = env_archcpu(env); + CPUState *cs = env_cpu(env); int idx; switch (spr) {