From patchwork Thu May 19 11:18:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 9127529 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 929E36077F for ; Thu, 19 May 2016 13:02:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8A5D281AE for ; Thu, 19 May 2016 12:17:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC533281B1; Thu, 19 May 2016 12:17:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 3BE5A281AE for ; Thu, 19 May 2016 12:17:25 +0000 (UTC) Received: from localhost ([::1]:50014 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3MtH-0006q9-7g for patchwork-qemu-devel@patchwork.kernel.org; Thu, 19 May 2016 08:17:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Lz7-0004MM-Is for qemu-devel@nongnu.org; Thu, 19 May 2016 07:19:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3Lyx-00047l-G0 for qemu-devel@nongnu.org; Thu, 19 May 2016 07:19:20 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:33756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Lyx-00047e-94 for qemu-devel@nongnu.org; Thu, 19 May 2016 07:19:11 -0400 Received: by mail-wm0-x241.google.com with SMTP id r12so20127861wme.0 for ; Thu, 19 May 2016 04:19:11 -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=Kk31ixW/LjZKwAoDcDKOMN1fXocQeXdgnGz+5mO2s3E=; b=bDSMoXN9DQaQGdsvfKaQ8BJ/3B981u6Nxa8F4T1LqAF2u0XkjDtVsaNAxbov6Ii54d RWqyFAM0K+8Bqhovq5H1YepmMueopsjhD18zhfXogPcu3CUhWqcro5kRDMIAjSkS+O5l 79xGM5mEklX5tA0XgbqqiVcEdd8vU95xohBhp9U8SdmH3wIoLMAeczxF1kaOYUTarYZ2 yK3I5aZbunJknUdPNss6bNnK/ly/3cN9ZQhpGV9h1OM7UcJekCxcWsMJiBEHZtUCdXQC ewpRL01RopDIYfxoSlFAlCkiKKQ0r/rLKp8m+IFiT/HdoKQ6jkFSoxKC3YxeF9wAU86f D6Aw== 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=Kk31ixW/LjZKwAoDcDKOMN1fXocQeXdgnGz+5mO2s3E=; b=k7FOeZBudiNbNh/oBlygc0Sjs+A5ghZgIqaUzuTnf8eskqSA+XLPXHX5GRiQRVUaR5 2RtxQoTtahq7jPzf7O80RR42BOrINo68yaepmeUL2XIqEGoUnp1GuQqfXjg35hOFC/I8 lXCUb509xAB9LePBJQ9LwhFB6IBKvyuEH5MkTQjgjUVTfaHfyUDPc8FTXZRjlmUNZk1W xIipnoMV06A0O33tl6hsdArzCFI33QHypZ6pwC2gDZ1C3hTAaUVxi3Xykg0sQTFjbzG4 Y5Pw5mjrSAEItpuPxFYqtjmq6RBA9woKBtKiNpkBdGgbcScpqJUjpbGqksAGNMde8R7j SVvA== X-Gm-Message-State: AOPr4FUyW1ln8gBqMk7i4xLy4KHb+tMfT2qTkDMly7Kup+Xf3aUDb5ZUe5BXsv60VUwhvg== X-Received: by 10.28.15.79 with SMTP id 76mr13614138wmp.53.1463656750742; Thu, 19 May 2016 04:19:10 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-252-58.clienti.tiscali.it. [78.12.252.58]) by smtp.gmail.com with ESMTPSA id c7sm8374317wji.38.2016.05.19.04.19.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2016 04:19:10 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 19 May 2016 13:18:15 +0200 Message-Id: <1463656726-35952-22-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1463656726-35952-1-git-send-email-pbonzini@redhat.com> References: <1463656726-35952-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::241 Subject: [Qemu-devel] [PULL 21/52] 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-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 e64cb7e..7099509 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);