From patchwork Thu Mar 28 23:03:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 161345 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1330924jan; Thu, 28 Mar 2019 16:30:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOkBBMMXECPtZaSDcb5d0QNudgwr9nAoAQOxj2GXueXXeFN5QM3QeUI9zeNtSqRhmHuhcO X-Received: by 2002:a02:a892:: with SMTP id l18mr18502310jam.28.1553815802603; Thu, 28 Mar 2019 16:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553815802; cv=none; d=google.com; s=arc-20160816; b=dHjhUIUpRvMIllNLMQCDvJpllSSPScfXfXaJ7ZIh9f9dSh/Wk6aNvxG/88HbCAPQSH wzmZTqUs84eCkr4XsGVEdvkactTO6Xm6x8HW3UexS+1Kt1Bp4hmPaCguNUu9VUkWkbmw 0UDfwWMPeXhZtyz6qr+8xjhnAuk0E0nh6Vdlopnrg17vYyZEVfk1qTKvGiGQKDNfWyM4 IGiGlB5EP3cXup14mlSNwDsg2Qh8ifcrCR5QcAeK2DeU2U0ZFOx3tMUgmYZJCWhzR1Mx canBq6KvaxEO9pnFw2TqgzPngiphfQZyBmiTH1ya5CcSlK6004KIqtcDH9Ifa2SfYQx7 X/uw== 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=pboOW5h3NGyyKEYef8MP27p99BzWuQLk4PmNbUbBl30=; b=hkY6+otPEU3hMS+knuO6qn2Agmt8jx97BvyRJu0YqS06fHjiQ3IzVrKTAQ9lblDm/R q3jy0nW4WX7zEiZghxXZbzvWuQ9nOtjLYw/Zf8aYvqPO4bd5G1iQeYtlKEeks53VEumb 8T//ZF6/wngpKnNezm0AqCWTQkbxytlI+QIxOfg3d8CHZtLLCFwlEThyx/smd3fi7tqN 1S5l1RVkXSjGUvUeWqd+hkow6VuhwS4CjVzJuwE+XUKrlo2PM1pFfDU/gCzhLLoLzWaK e7aZO8q1fJYT6hG0YsnD+wjmdHQw+TBo16vLFTZx/XlH29cA8spqqoYQ9eo0dnjOdPmD gVhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WpYz0vxq; 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 y1si170845jae.17.2019.03.28.16.30.02 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 28 Mar 2019 16:30:02 -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=WpYz0vxq; 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]:43290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9eTB-0002bA-Td for patch@linaro.org; Thu, 28 Mar 2019 19:30:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9eKv-0001my-HM 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 1h9e4M-0002yY-3U for qemu-devel@nongnu.org; Thu, 28 Mar 2019 19:04:22 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:44642) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h9e4L-0002y6-Kn for qemu-devel@nongnu.org; Thu, 28 Mar 2019 19:04:22 -0400 Received: by mail-pf1-x443.google.com with SMTP id y13so70213pfm.11 for ; Thu, 28 Mar 2019 16:04:21 -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=pboOW5h3NGyyKEYef8MP27p99BzWuQLk4PmNbUbBl30=; b=WpYz0vxqQD/HcNkRJEGiIP0pOozpORh21Fiym7K9d6PvV1a+n+sYG0/+1IktkZgthL 7v3Ew12Goc7iAx9kr8Gi6dN1F77wyE/HNPFKtasNd77NUB2ff+j0fuA+yB32VY/1eW2z W3FIBzuJP43XlnasneVrWA4S+pn2XB6bAkU2wbZ1PWL7bPt689J28nFYSgH3oxP2cbH4 g8J9nbnYe9wifdwsc5Fu8zBjI3tYHDiqfY+l+bltUdQHufMMH67LTQRDnpCufTa2Iz/A XnK2PhIsZUUeWfgcdE/9GZIU3BBql3lJ4+DHwDVUNl1IYvFHOrKrvVrz306qs8cLgyDN 0rwQ== 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=pboOW5h3NGyyKEYef8MP27p99BzWuQLk4PmNbUbBl30=; b=U+Jps2z7spxDs6s0a/HIQz16EUApxdAMuQTA8AOFfn4Fn4x/becJNC/b2Y0123ZS+f duQ8P+FWYsQ5BENDlveGKxo24o/QXWyf5Mjk3MpDlJ5H3C95M9QrZhjh6Yq+/Z+DM+0H pdUGNi8MSmE0U+PquP8FzJp+ljbG7EVt6kBGcPH1jniIdSo27GQZPDp9cOWIJP+z0Omw OolT+S18o5SU0/Xu5+MmDG1yYILSHKrWCIUJ124jDMVaZxpkAZ4ArayciR4qBk5HdFSt HDycliI+HYtH2MLvmjyHBuD/WOL/erRZqC6MAHlpoBySGh66BMrOm/aDfFWFTXHxFbXM 7orQ== X-Gm-Message-State: APjAAAUqsudIgLQQBPqSUN5AfIOCfhw/xHWEtFpG4B12+Yxuw1fvG/Hp 08goE2sZ09KQh/oT5wJIHwtIcA5rYVE= X-Received: by 2002:a65:4549:: with SMTP id x9mr43639392pgr.3.1553814260414; Thu, 28 Mar 2019 16:04:20 -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.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Mar 2019 16:04:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 28 Mar 2019 13:03:35 -1000 Message-Id: <20190328230404.12909-8-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::443 Subject: [Qemu-devel] [PATCH for-4.1 v2 07/36] 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 foo_env_get_cpu with a generic definition. No changes to the target specific code so far. Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) -- 2.17.1 Reviewed-by: Peter Maydell diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 9fb3f57684..0951fd9053 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 */