From patchwork Thu May 19 11:18:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 9127441 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 55A1A9F1C3 for ; Thu, 19 May 2016 12:06:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9C10220211 for ; Thu, 19 May 2016 12:06:38 +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 CCEAD2021A for ; Thu, 19 May 2016 12:06:37 +0000 (UTC) Received: from localhost ([::1]:49926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Miq-0005NH-Q0 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 19 May 2016 08:06:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Lz6-0004L2-JI for qemu-devel@nongnu.org; Thu, 19 May 2016 07:19:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3Lyw-00047N-Gt for qemu-devel@nongnu.org; Thu, 19 May 2016 07:19:19 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Lyw-00047H-9O for qemu-devel@nongnu.org; Thu, 19 May 2016 07:19:10 -0400 Received: by mail-wm0-x242.google.com with SMTP id r12so20127769wme.0 for ; Thu, 19 May 2016 04:19:10 -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=dlXJKnBlewxlOXcSsdcK1apRkmxLDl1pgOq7JJCemSs=; b=xE8wtssdE/4krhSb3TWrSShfeys0fogpGiwP5+nuK5JTkChQe+QOBo58FPsOlSaz4Y 3NU4JJvQkmDYI7WS50bpd6k/WEcvq3CvbmDebGIH3r5C3uN5BP+Z57zda1iPHDu1Blud juJ7nM5NTB628LmFDNpIufmY8KxxrnA+JdLYMmf8/bnaaNfXCWLzzQh7SAharnwzKJ1D KTIHQ2M5TKAs2S4OeKZ9JdWH1V2nTryiCMhCSlk8Wt0WtE+hRnBpJ728+ZCIb7dJ5pWA gjWHB1uqYB51I1G67GNUkZPAuCxgQzaeFPRuaXPVyv0ubwJwszwZlvBK07eOxTIimqPo HlOQ== 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=dlXJKnBlewxlOXcSsdcK1apRkmxLDl1pgOq7JJCemSs=; b=Csg3x4OWEOYxPs/bXVWKy4m0KbiBYdtRuVhWEj8eMjxmAtwUdINMiH2ps9OJkTW6YQ r1xWpVyktTC7VxesmsFQ2I66XmPYZUGOaOF37xW7Wx7f59WlShnKIIt2erYIAuEy7Y0D PP2l1asolElOzCckgfCrSilpnhpAE0bzBmiHqWz6QeKgvFFH6SMltB4lTwPzE+0044/N XxreXGY5G1N2RO7RjWvmGFq7UiP5U+Od/S0JGwRcrtr74Atl3aQv6G27DcuqdSu+w7RP RBmMGycQhZ4qWj88WYCpgmI2vhIrEJWjHmvu2qOjkpPaiRfrr6FFFZ1RxRMvf/mTFJJN 9kzA== X-Gm-Message-State: AOPr4FX1Ikxe40xPvIc7HcCK9P9IlZ7AZC+BDSLxcLxEa8igoAFBfe2LMr/Al+KMQhP3tQ== X-Received: by 10.28.138.13 with SMTP id m13mr13709353wmd.3.1463656749731; Thu, 19 May 2016 04:19:09 -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.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2016 04:19:08 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 19 May 2016 13:18:14 +0200 Message-Id: <1463656726-35952-21-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::242 Subject: [Qemu-devel] [PULL 20/52] target-tricore: 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 TriCoreCPU 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-tricore/cpu-qom.h | 28 +--------------------------- target-tricore/cpu.h | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/target-tricore/cpu-qom.h b/target-tricore/cpu-qom.h index 66c9664..399c98f 100644 --- a/target-tricore/cpu-qom.h +++ b/target-tricore/cpu-qom.h @@ -39,32 +39,6 @@ typedef struct TriCoreCPUClass { void (*parent_reset)(CPUState *cpu); } TriCoreCPUClass; -/** - * TriCoreCPU: - * @env: #CPUTriCoreState - * - * A TriCore CPU. - */ -typedef struct TriCoreCPU { - /*< private >*/ - CPUState parent_obj; - /*< public >*/ - - CPUTriCoreState env; -} TriCoreCPU; - -static inline TriCoreCPU *tricore_env_get_cpu(CPUTriCoreState *env) -{ - return TRICORE_CPU(container_of(env, TriCoreCPU, env)); -} - -#define ENV_GET_CPU(e) CPU(tricore_env_get_cpu(e)) - -#define ENV_OFFSET offsetof(TriCoreCPU, env) - -hwaddr tricore_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); -void tricore_cpu_dump_state(CPUState *cpu, FILE *f, - fprintf_function cpu_fprintf, int flags); - +typedef struct TriCoreCPU TriCoreCPU; #endif /*QEMU_TRICORE_CPU_QOM_H */ diff --git a/target-tricore/cpu.h b/target-tricore/cpu.h index eaebdd2..a48340f 100644 --- a/target-tricore/cpu.h +++ b/target-tricore/cpu.h @@ -21,6 +21,7 @@ #include "tricore-defs.h" #include "qemu-common.h" +#include "cpu-qom.h" #include "exec/cpu-defs.h" #include "fpu/softfloat.h" @@ -198,6 +199,34 @@ struct CPUTriCoreState { struct QEMUTimer *timer; /* Internal timer */ }; +/** + * TriCoreCPU: + * @env: #CPUTriCoreState + * + * A TriCore CPU. + */ +struct TriCoreCPU { + /*< private >*/ + CPUState parent_obj; + /*< public >*/ + + CPUTriCoreState env; +}; + +static inline TriCoreCPU *tricore_env_get_cpu(CPUTriCoreState *env) +{ + return TRICORE_CPU(container_of(env, TriCoreCPU, env)); +} + +#define ENV_GET_CPU(e) CPU(tricore_env_get_cpu(e)) + +#define ENV_OFFSET offsetof(TriCoreCPU, env) + +hwaddr tricore_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +void tricore_cpu_dump_state(CPUState *cpu, FILE *f, + fprintf_function cpu_fprintf, int flags); + + #define MASK_PCXI_PCPN 0xff000000 #define MASK_PCXI_PIE 0x00800000 #define MASK_PCXI_UL 0x00400000 @@ -341,7 +370,6 @@ void psw_write(CPUTriCoreState *env, uint32_t val); void fpu_set_state(CPUTriCoreState *env); -#include "cpu-qom.h" #define MMU_USER_IDX 2 void tricore_cpu_list(FILE *f, fprintf_function cpu_fprintf);