From patchwork Mon May 16 15:35:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 9104091 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F37E4BF29F for ; Mon, 16 May 2016 15:48:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 47AF320172 for ; Mon, 16 May 2016 15:48:58 +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 8F3BD20160 for ; Mon, 16 May 2016 15:48:57 +0000 (UTC) Received: from localhost ([::1]:44523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KlM-0005fT-QV for patchwork-qemu-devel@patchwork.kernel.org; Mon, 16 May 2016 11:48:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KZc-0001fx-Rs for qemu-devel@nongnu.org; Mon, 16 May 2016 11:36:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2KZa-0006Zx-Lc for qemu-devel@nongnu.org; Mon, 16 May 2016 11:36:47 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:34976) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KZa-0006Zl-Fz for qemu-devel@nongnu.org; Mon, 16 May 2016 11:36:46 -0400 Received: by mail-wm0-x243.google.com with SMTP id e201so18924622wme.2 for ; Mon, 16 May 2016 08:36:46 -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=RIZelBFI3ao18HseZo1RirDWey7+NPIMmN2oqAWxArA=; b=wuGkMDOMHPpA07qIybjox9ei8O+soteY6wYd3rjzA8mnVaQ2z99Coa/76atpiu60g7 pCdh5HJGc4KbLIklpqqULeIzXoyaxzR/jFKqD1XcWJimPOQB8PkYCUaStnyCk5P+DmV2 cIUBOLU/grzs8NiQgUnsdxJFaTWnAdSA+Z5kKOrb9aKz/MracTQHUVr4CFN5XQCmuRbz dVmhI1iqhwyfCbAJNzfBffiJAnFVLUyLTeRy1bqwF6xVPb5NiIANEu2D8lLxFukPGqen s17+pVQYzTJwgYZCgU5P4edigmiUfkgzaGB5AVlnt3PIINO3BJ3KTMV2UXiZIzfM0U2v HJsA== 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=RIZelBFI3ao18HseZo1RirDWey7+NPIMmN2oqAWxArA=; b=nNhLWF30a7l/PtS/Pwsxvx3d0gSDzNoKF7GFZHvlBFT0zjIbiPSv0x8IXBYjLrbfTU V/6pVMOY6V7ZqRqDDeN8RU2g+ANgxcr9G1qslA6nEo4KrZgKzw5Hgtjd0/pOa9fdCH9h XNK1db67OqTETjy8yJCMPt8Zz8vLU10aWmMtAJ1m0PdVBNYkMjYi7nQhbtuhtPoBKniI bNTEjV2LsVvtdo2bjZjEhHQO9dKO0vZ2eUEYLbDuv6hf3UM9RpfLlWLxeF4onIBpR1nR vJDxAHLfRuFh/iSY+kWCVqVQL6aK4zt+sQy7TEM64Qvm8geq4uAYeIFV6w5dHBrAqKhf Crpg== X-Gm-Message-State: AOPr4FVfy0K9itt5EDZ7dXMXGSTR7xS1iYFBLrLh2JOjWHDO88oB5me3X3UtTrJU3y1Lyg== X-Received: by 10.194.58.162 with SMTP id s2mr34655947wjq.53.1463413005895; Mon, 16 May 2016 08:36:45 -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 lf9sm34386875wjc.44.2016.05.16.08.36.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 May 2016 08:36:45 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 16 May 2016 17:35:50 +0200 Message-Id: <1463412982-6681-19-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1463412982-6681-1-git-send-email-pbonzini@redhat.com> References: <1463412982-6681-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::243 Subject: [Qemu-devel] [PATCH 18/50] 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 90045a9..cd350b4 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);