From patchwork Wed May 8 00:06:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163561 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:81:0:0:0:0 with SMTP id l1csp1989075ilm; Tue, 7 May 2019 17:09:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPCjSDLqR/8yMuw24c1oQ17UR5FjG1wBVUi+iAuRr4AG8aGMxlDgwQmn3Hlz64577wqbw5 X-Received: by 2002:adf:8567:: with SMTP id 94mr97499wrh.286.1557274198369; Tue, 07 May 2019 17:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557274198; cv=none; d=google.com; s=arc-20160816; b=VbECNCIMx5RgrAY8xjpEl63ElW7TDBC9uNF1QVxiWzsRijbnR5Wg/5ZAlJG0CqVIny 7KE2aWcsk9mE188bplkdWHiTgnf1Dttaj1PpJtAvYPcdEQn/Ip4tYDljyHkGMp6I6C87 dtfWbTOMymGXOX3ogeVRD3eWiy7EswRhETUHiqYmN1xmFPSmQNm4QBadeiirxDXVfdyw by7D837b/904qoUsfzBnX8xK1ltj9k7G31QRRTmQSyH4Kj2qGQj+FrGqnUlxCIhTQO6d SXT05aAPvmtiZEHHyK6h0ipXzpM1owoh3YAEu8pjKqY/2oEhnjlGcODD9NSJ14pYHWl/ qtfA== 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=A6Z3eRt9kjtdgrun+ExeQKOLr1ytY3aH2RtVK8s7SBw=; b=eYGgNMn7G6qA+bqVw76ikw/BVRA0PpSGuXOmn0oBPa3V1Pi4BS/9wLKflpCbKFuLAr ySG9whG2OXhYAb8vQYNz1rT5HxueW/ixVK4ZeNLbl4xTnmvFYjDi6/Xx9e3qmG59e9zy 6hZKDG8E3JFSbaIWTnrvhRJ5jJQxxL6mXqEYzWuQhGm+prvrAJT6qOB5CFr0KA2gHuDl +yldS4txdjHMMGLG4SeYlIeIikO+4/JrDBNSxZtV09GiBQPW6KfUDGGBSxqlcdyOQYXB bvSbscJeUKhSoyTpo+UY//U2XBij58ZkfcArXcdw+v/6Chp42bre66sJpjBGsJzoYYYQ gQQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=s1X0wkAV; 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 h2si364534wmf.76.2019.05.07.17.09.58 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 07 May 2019 17:09:58 -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=s1X0wkAV; 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]:56405 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOA9k-0001Rb-6f for patch@linaro.org; Tue, 07 May 2019 20:09:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOA6q-0007D2-Fo for qemu-devel@nongnu.org; Tue, 07 May 2019 20:06:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOA6p-00068F-Lj for qemu-devel@nongnu.org; Tue, 07 May 2019 20:06:56 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:34978) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOA6p-00062x-Fm for qemu-devel@nongnu.org; Tue, 07 May 2019 20:06:55 -0400 Received: by mail-pf1-x444.google.com with SMTP id t87so8916895pfa.2 for ; Tue, 07 May 2019 17:06:54 -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=A6Z3eRt9kjtdgrun+ExeQKOLr1ytY3aH2RtVK8s7SBw=; b=s1X0wkAV2PzJIqNVsbHrNcUx4tTT5teQ3b8nck+ZQWV44jaQ1X1McPJ8zONtMZuntW +AgqF9o6fQiqCgkgZ00AQp6kSPCMQFV+RQceN9GhxN6zyue5gu35FnD4isrYy8YAcorn /nyaT4Nq2gD69D/ON1nTnV7SqLgquD+CmwDMZjC7dWRY0RavPVXidywX17hjHphtJV1i BQzjYvFZarLRIjbXzUTc+HYDSf7fRPHWYuZU5IVSdBOpvXNzNdIeauzlb5LIhvqiXnN+ S4w4s8kLtDCpUHlR7Ko2df5ukShkmPy7WUBm8n72UAvzcm89V+FWSzuzGIXwBs72DE8F b/Wg== 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=A6Z3eRt9kjtdgrun+ExeQKOLr1ytY3aH2RtVK8s7SBw=; b=nhomPbBwfONwG42HKNBp6Q1my/MlnA1H22eFS6WedlYRVRiDDlF1dsEw8jT2lrcBIW 3RPV6Ny6uS52cYztyQVr6Pi81uVEQaDNIwudQCYupfCQpIzTCxvmZNLCHN3Ihc79tQ6v +wWMrEoRGurzLVXM42L9SlBvyl9UyHwDP6Rls20llpV764tsitA6+nBa45npOimBXqvd QyNdRqacPTwPhH2xJN4wiHouUE2DsgLDLJZogUjm59XSWuPHeBbDZdhhusyOqaiIhg9M 4lf6djnnS8mUOwD7pTVzuOBkpUcouBnw7ies8LDQdzO/PFBYEAhcUFpJpNbf1Ues3Bs/ ZmPA== X-Gm-Message-State: APjAAAUgK+6+GQwR1ZzWiSwgtUGymCi1Xqi+rmPPm6YVlnfctz7xsTvL IpFejxNa8Y4hEogUQp+6DPafpbBTelc= X-Received: by 2002:a63:360e:: with SMTP id d14mr43527522pga.188.1557274012878; Tue, 07 May 2019 17:06:52 -0700 (PDT) Received: from localhost.localdomain (97-113-189-189.tukw.qwest.net. [97.113.189.189]) by smtp.gmail.com with ESMTPSA id j1sm15793183pgp.91.2019.05.07.17.06.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 17:06:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 7 May 2019 17:06:09 -0700 Message-Id: <20190508000641.19090-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190508000641.19090-1-richard.henderson@linaro.org> References: <20190508000641.19090-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 v3 07/39] cpu: Introduce 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" This will replace foo_env_get_cpu with a generic definition. No changes to the target specific code so far. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) -- 2.17.1 Reviewed-by: Alistair Francis diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 454f6d663f..c62f07b354 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -371,6 +371,17 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr, int cpu_exec(CPUState *cpu); +/** + * env_archcpu(env) + * @env: The architecture environment + * + * Return the ArchCPU associated with the environment. + */ +static inline ArchCPU *env_archcpu(CPUArchState *env) +{ + return container_of(env, ArchCPU, env); +} + /** * env_cpu(env) * @env: The architecture environment @@ -379,8 +390,7 @@ int cpu_exec(CPUState *cpu); */ static inline CPUState *env_cpu(CPUArchState *env) { - ArchCPU *arch_cpu = container_of(env, ArchCPU, env); - return &arch_cpu->parent_obj; + return &env_archcpu(env)->parent_obj; } #endif /* CPU_ALL_H */