From patchwork Mon Jun 10 02:01:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 166250 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp464876ilk; Sun, 9 Jun 2019 19:12:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAwr4sImUoP6tGROeCSXhegk8pTuYDDapiD4E9/aZ7wRw4z8RUEyet6PmmcQCMUU64Gg+G X-Received: by 2002:ae9:f005:: with SMTP id l5mr9934719qkg.113.1560132742153; Sun, 09 Jun 2019 19:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560132742; cv=none; d=google.com; s=arc-20160816; b=BT25aPJreWSuyyQd4qezcv9MfBtULR5WMGqyXuA3plkWIAk+W9nB0PkKuxL4lCWOEG xbPKENIk5+NMqHvT1WcwamJXMLFNsZreQR4G03LWAQ+/WN+MNoxn0Cz8x7rR4F9YmN7N UvsyQE7+8UpklzUbBkX27U43ujiyj6SqU2JIJWILJEqdbRgjmRRiFzwhP5krIw9dWC5+ d/mB+QYucyag7ibuzI0wWK4uZqlCzugnEH95pllPTTU1XWxCR5ACwoP3cQKvFdWSIF1S L7kEgfWLo8WmbymfKiDlDRHZqZr6ojb6Ui66fi7IVMhiP4Cfn5tubpT1B2v2RrcGNAeP y4Jg== 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=9aukZSJTtaEX+E6TYMtemh6Y/79Nrv8IxJ0VQThpXlk=; b=V9m6r7NZCoiwKihXi4n2RIuprRmXueFSV+5bD85Q8z1BY0fU+E55G9AJp/DoQUUfm2 37atq4uBYiEsS0xDIGQUC18zzFzEEjNP9DqnkaX4rEZikySndSeRNzJn6IF+Bgwmf/o8 RuGWiJ4fyNx9NwiVl0l4J3OSF3w3iZqVsMd+2EM38cBpEJpj6KF+A+yolOdRZXmeR9uh +orkRtQdhmimX39SJNlhb9jwXOGPWzELorSLgs3lNKMqduo9HD1u8ewoUeK8qD5LXahX u1PJNaP9UAsFqf+p1ptHPeZ0d/zD1OqM0lUL7ejsA5qgTRc1lJb0CYAyNG3VtnfLOhrU IJsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=nHfb9L2X; 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 55si4710623qvn.124.2019.06.09.19.12.22 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jun 2019 19:12:22 -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=nHfb9L2X; 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]:39662 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ha9nJ-0006Ko-Nk for patch@linaro.org; Sun, 09 Jun 2019 22:12:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52903) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ha9do-0005jx-99 for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ha9dn-0001cy-8k for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:32 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:37374) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ha9dn-0001cY-1x for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:31 -0400 Received: by mail-pf1-x429.google.com with SMTP id 19so3484448pfa.4 for ; Sun, 09 Jun 2019 19:02:30 -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=9aukZSJTtaEX+E6TYMtemh6Y/79Nrv8IxJ0VQThpXlk=; b=nHfb9L2XltDjexft8NMwFWzXXzLL9G0jfmvJh4JGDzhWyVokzo0UQx5p9BivwYIvmg TUT+9+NI3LGP+2ehz+8T8CaP2ATCwo3EqNVeg+t1aCf+8apSxZ+fZcTQ0PTZzqMixjEq v4zA9dHbdC87FMW3SJJeGQhPVlkwCf9u7+AarHMe1TjNJn2XqUY5SlClPDDImuF/sXqH UEgfAwjdWWt17sA/8uzQ0/5QG7oOameSX5wtBP4kofsU8czCVlakEzRCBwP6MorcoxMF uXNivDNUMxPcjyk5xb+J82zmPpGmmlokT2NhDgIaq5/r3mfqA5QFvtTE+U+Grmi1kmiE egcg== 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=9aukZSJTtaEX+E6TYMtemh6Y/79Nrv8IxJ0VQThpXlk=; b=ldb8YF9hcgrW0sGZtxbMPnu7vjs9fU5F5qr8uT1e+qJPjo/phZ7F+TlYEUYZymJWP5 6azREbu9QPaBMC0/1og+E+7RZr41QWPpg1uuo/kNT4ppq76jLMZlSMLntrPOzCOG38D8 tT2FIkptKs6LtKTiA/QYkwIoqDgICWhIxV0G8WVYvfH7vf/2BP9qbSDx+u2qcB32c9Lx 4FuuLPVOMGNIJOA96O271I/FpNBsXa4cfY3kqGUJNIxF6tigROx8CHzMZg6HrBLTvMVz eap5AzPMt62/GWoqW+M9wfei4wlFSVPzFt1TfHfIcyXBzOwdZXtzTSpTzYPi/hiR7LpN oyVA== X-Gm-Message-State: APjAAAUavh0FtaN4rf+UZl9XNX0YUkoNUV/kn0AC0/7pLQWO7XSF/0wZ HXgvLEpU1bhUls8fQOyOf5JsMptEVGU= X-Received: by 2002:a63:445b:: with SMTP id t27mr13571344pgk.56.1560132149435; Sun, 09 Jun 2019 19:02:29 -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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Jun 2019 19:02:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 9 Jun 2019 19:01:46 -0700 Message-Id: <20190610020218.9228-8-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::429 Subject: [Qemu-devel] [PULL 07/39] cpu: Introduce 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" This will replace foo_env_get_cpu with a generic definition. No changes to the target specific code so far. Reviewed-by: Alistair Francis 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 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 */