From patchwork Fri Apr 8 20:28:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8785881 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 82A419F659 for ; Fri, 8 Apr 2016 20:40:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C020920172 for ; Fri, 8 Apr 2016 20:40:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 12C8220109 for ; Fri, 8 Apr 2016 20:40:34 +0000 (UTC) Received: from localhost ([::1]:58144 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aodCj-0001M1-EB for patchwork-qemu-devel@patchwork.kernel.org; Fri, 08 Apr 2016 16:40:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod26-0003y0-VF for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aod25-00025t-TV for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:34 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod25-00025j-Iq for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:33 -0400 Received: by mail-wm0-x242.google.com with SMTP id a140so6838363wma.2 for ; Fri, 08 Apr 2016 13:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=afu8Wpc7TsfXLStPpLHn8/bt2ap8+l+MN4nPUN/5Nx4=; b=NJf1zJvhME6DhlBq9BoJ2bnjk+Gh3YDR6dVOBuovLPiNL26ZeX2p/rrcO9E8f6ApgJ JtzNo3fgeR/3V4JVJ0KnUIQ0gqvVrIv74xx5D9voE7Epe6WdPOpZfLsTOySUvvucBYmN mYDV0SuJfmxS3B9tL6qjjGaCkpFNZ8SCuHarXgjIMqmozh4Ah7IygbSHmrw1C/ZJO/IC neA8NSiEHllWEy3epuIBQIU/mcWm+d2BoeQwYgqC+f9X4pQRPvVhhA2riyvxM7pPfmJ9 8SvFXuUyvhgqtQzX+HX2hQfPCmjJkQ4sBlHZJjp0kizQOvMIhq+AF8IIvqnlsgWqhrBt uy5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=afu8Wpc7TsfXLStPpLHn8/bt2ap8+l+MN4nPUN/5Nx4=; b=EtR2gOIOpAxkCrj7OaaA7WvZBZwMYthX5ynlsEhDZhLqsjvJLNRdzzQFCPpWwIMoS7 4ZXZ39ryP7f0ItafOC6RYS/4mbF30UIURjJ5JO6Zydvvj2RaehhXOxVFDPqsrzImyqUS d1zGVrI2Hvc4V+f6Ci7n1uooCx5kXaSgLVQqknsaJNf7cHM7e7lS83dwu7LmrysQD5ur EjJSeNhD0+OhcqWP9tvq4Vua0yzdHMrBip+GeQLi8lCWnN1k35U72V86NQWTvpITinkE kfaVTc45RgnwCSJEaJSoG3nyA2CYLQiblp64o4DaFAYttoO06BrvSLuKr332ZWSm7J/N 8Kgg== X-Gm-Message-State: AD7BkJI5Iy7RgUSGqNuz2wyOEeXjE1k5SIMzdeHF17RUJSsWqfT48/nMaPC2K6F+qi7t4Q== X-Received: by 10.194.76.72 with SMTP id i8mr11262797wjw.117.1460147373046; Fri, 08 Apr 2016 13:29:33 -0700 (PDT) Received: from 640k.lan (94-39-141-76.adsl-ull.clienti.tiscali.it. [94.39.141.76]) by smtp.gmail.com with ESMTPSA id w10sm3849168wjz.9.2016.04.08.13.29.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Apr 2016 13:29:32 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 8 Apr 2016 22:28:39 +0200 Message-Id: <1460147350-7601-20-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1460147350-7601-1-git-send-email-pbonzini@redhat.com> References: <1460147350-7601-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH 19/50] target-unicore32: make cpu-qom.h not target specific 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make UniCore32CPU an opaque type within cpu-qom.h, and move all definitions of private methods, as well as all type definitions that require knowledge of the layout to cpu.h. This helps making files independent of NEED_CPU_H if they only need to pass around CPU pointers. Signed-off-by: Paolo Bonzini --- target-unicore32/cpu-qom.h | 29 +---------------------------- target-unicore32/cpu.h | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/target-unicore32/cpu-qom.h b/target-unicore32/cpu-qom.h index e554f1f..bc68e78 100644 --- a/target-unicore32/cpu-qom.h +++ b/target-unicore32/cpu-qom.h @@ -36,33 +36,6 @@ typedef struct UniCore32CPUClass { DeviceRealize parent_realize; } UniCore32CPUClass; -/** - * UniCore32CPU: - * @env: #CPUUniCore32State - * - * A UniCore32 CPU. - */ -typedef struct UniCore32CPU { - /*< private >*/ - CPUState parent_obj; - /*< public >*/ - - CPUUniCore32State env; -} UniCore32CPU; - -static inline UniCore32CPU *uc32_env_get_cpu(CPUUniCore32State *env) -{ - return container_of(env, UniCore32CPU, env); -} - -#define ENV_GET_CPU(e) CPU(uc32_env_get_cpu(e)) - -#define ENV_OFFSET offsetof(UniCore32CPU, env) - -void uc32_cpu_do_interrupt(CPUState *cpu); -bool uc32_cpu_exec_interrupt(CPUState *cpu, int int_req); -void uc32_cpu_dump_state(CPUState *cpu, FILE *f, - fprintf_function cpu_fprintf, int flags); -hwaddr uc32_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +typedef struct UniCore32CPU UniCore32CPU; #endif diff --git a/target-unicore32/cpu.h b/target-unicore32/cpu.h index 9c1fbf9..22a0aef 100644 --- a/target-unicore32/cpu.h +++ b/target-unicore32/cpu.h @@ -20,6 +20,7 @@ #define CPUArchState struct CPUUniCore32State #include "qemu-common.h" +#include "cpu-qom.h" #include "exec/cpu-defs.h" #include "fpu/softfloat.h" @@ -71,6 +72,35 @@ typedef struct CPUUniCore32State { } CPUUniCore32State; +/** + * UniCore32CPU: + * @env: #CPUUniCore32State + * + * A UniCore32 CPU. + */ +struct UniCore32CPU { + /*< private >*/ + CPUState parent_obj; + /*< public >*/ + + CPUUniCore32State env; +}; + +static inline UniCore32CPU *uc32_env_get_cpu(CPUUniCore32State *env) +{ + return container_of(env, UniCore32CPU, env); +} + +#define ENV_GET_CPU(e) CPU(uc32_env_get_cpu(e)) + +#define ENV_OFFSET offsetof(UniCore32CPU, env) + +void uc32_cpu_do_interrupt(CPUState *cpu); +bool uc32_cpu_exec_interrupt(CPUState *cpu, int int_req); +void uc32_cpu_dump_state(CPUState *cpu, FILE *f, + fprintf_function cpu_fprintf, int flags); +hwaddr uc32_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); + #define ASR_M (0x1f) #define ASR_MODE_USER (0x10) #define ASR_MODE_INTR (0x12) @@ -134,7 +164,6 @@ static inline int cpu_mmu_index(CPUUniCore32State *env, bool ifetch) } #include "exec/cpu-all.h" -#include "cpu-qom.h" #include "exec/exec-all.h" int uc32_cpu_exec(CPUState *s);