From patchwork Tue Jun 4 20:33:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 165827 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp6337662ili; Tue, 4 Jun 2019 13:45:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqyyk8Veu4rXewBX19QIP6FsZgE3vPhSHu7T2gw/DM+jFmWsqhiwQ9r12lQX9jGF9/WKwO X-Received: by 2002:a1f:2117:: with SMTP id h23mr6083864vkh.91.1559681107774; Tue, 04 Jun 2019 13:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559681107; cv=none; d=google.com; s=arc-20160816; b=OAWJOxxo2Ok19dbjuKxEUKAWHe+GgnK9SJcTlPQjrXAt8wJ1w5At3pNfCfqcAdr9TD ISpzO3uaMJlcSZd54Bb7PRTohzywwzaU2yADJgsuRazI8xL5dZLTuwbELSzA72BXPGmS 9GpyXL1KaKT88rpcT4VZhNoVrSHoQUQwP2cyCh8LF1n8jfyU2x1tsBxYQz0aQhXbliSa Uv3Otg20rE4m2uvUi09n73VO2BgNG3Y3xIa/0etqAfY2GAwD/6V4fVxyT+HOKtCNcAdT quIfec/VUZo+RXgmW1UC+Wdf727POt4YKmg418fKAhvwv3diVP9SiyLaeztGUYlPzQbc p3EQ== 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=9aukZSJTtaEX+E6TYMtemh6Y/79Nrv8IxJ0VQThpXlk=; b=kLUPvnc5osC7Kk+49y1+m6CH9EqD3m9MIQJx7xBBpa0p33qwbayetvV9zH5HTr7c38 txWE0owKMuN2QsUzy+/km0hpOXH9oPuS+hWtAZq6Y9yaGUP5VHSw+QkRvNmzknyj0WP2 GMWLVFBx+P/Hcqv8Tw/fC3Il1+fD6o7xQdbcdRrsubTbfjDOttx82fDIxRgt097YWc7U B5VjlGmMRKGjRUOH9x2Af0E9jh8o8o5S3Z9nqB51hyZjYOzTPbYw5aXrvcGWWG5THCec EJM+Oge6gmzxtJqquJUfpuzQbj6cDyqx7rZWsCKgsAnLenPICrWFJE0W1F85Yjh+ZBWq 2WUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JbPs+X2M; 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 l14si3417914vsj.441.2019.06.04.13.45.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 04 Jun 2019 13:45:07 -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=JbPs+X2M; 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]:57735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYGIt-0002Dr-5X for patch@linaro.org; Tue, 04 Jun 2019 16:45:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYG8G-0000yV-HS for qemu-devel@nongnu.org; Tue, 04 Jun 2019 16:34:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYG8F-00046T-KU for qemu-devel@nongnu.org; Tue, 04 Jun 2019 16:34:08 -0400 Received: from mail-ot1-x342.google.com ([2607:f8b0:4864:20::342]:38818) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hYG8F-00045x-Fe for qemu-devel@nongnu.org; Tue, 04 Jun 2019 16:34:07 -0400 Received: by mail-ot1-x342.google.com with SMTP id d17so6677929oth.5 for ; Tue, 04 Jun 2019 13:34:07 -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=9aukZSJTtaEX+E6TYMtemh6Y/79Nrv8IxJ0VQThpXlk=; b=JbPs+X2MMT/f49HY2N+lxgxvEwKiCxhfb+t7JeSZ2reShq8ly+M/bzNWvbtLTEQ4FK Qh0UMWaBFq0GWCv4dC/vkSHtZWe5/V1ofH/bwB8B1mOAgrRA8SpPvuAH7Pc3xAvrcS4N ZoNOZkVgPyqw8Clr2vd1lPXvh3enyGEL6OHOGmLiL6CWRLARPeQeetqt3wOYRiyK6w9Y 2FEN38qiyC3as9vPWIZbufQbIyp0WXpYUUe+7SK6qnk4bizC2lkC/fEnjpcX/XmqghuM g03kOgYSTH8SvP4X9Ih9drcgzn4jOrIMidinHKatN/9JLaMtJ8b629NFSlUp8BxasFGG C5kA== 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=9aukZSJTtaEX+E6TYMtemh6Y/79Nrv8IxJ0VQThpXlk=; b=kAtPyDWwF0TsM/2WS3BsVFvAJBDdm9zjYFQnuFJleliLAz3gWuuyJsv58DzfadB5Ha 2yJL2b8nnMnX4lHQt8Dar+Fa09xtiZ/LO6fQItjxVI9Z1eoNEr/YCEWJmJMZSq8soTLZ mYNa1a1f+4D9BpmHJbClDd33beg0ESrcTcscQSj1EwdJIfMSI0yoMpoqV1wEvya4Qbxp xJOeYwbFlwnZvF8pqTNI6TbRiVY4Bgt6fgFQEi+SzZZfYn0vkuZjKNU5fHrFfPG1RfWQ 2IasN20BUWiHEZ9kKqK8Ce8u33XuMdY5Vb8z2tvQX+9WlnJaiBtONJm5yuY0ApQU5idt ZraQ== X-Gm-Message-State: APjAAAXBwCGDAJcyf6ImjTbi+fx1A3sprJhPQGRXtbYkhJ6apiDPpE/K Xu+/oG4WFTFFROpZeyv1GmiT1qyW65VUww== X-Received: by 2002:a9d:32c2:: with SMTP id u60mr6298514otb.70.1559680446550; Tue, 04 Jun 2019 13:34:06 -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.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jun 2019 13:34:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 4 Jun 2019 15:33:19 -0500 Message-Id: <20190604203351.27778-8-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::342 Subject: [Qemu-devel] [PATCH v4 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: 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 */