From patchwork Wed Mar 16 10:46:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 598245 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qQ7bX1Ns5z9sdQ for ; Wed, 16 Mar 2016 21:52:08 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=xZSQ/7e3; dkim-atps=neutral Received: from localhost ([::1]:54948 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag93e-0003Fn-30 for incoming@patchwork.ozlabs.org; Wed, 16 Mar 2016 06:52:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8z7-00034X-Na for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ag8z6-00026H-Kg for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:25 -0400 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]:34143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8z6-000261-F3 for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:24 -0400 Received: by mail-wm0-x230.google.com with SMTP id p65so183588510wmp.1 for ; Wed, 16 Mar 2016 03:47:24 -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=GQh6SFQhXFTR+TS/0nrG1bcFwyio2bg3ULDP0/O0G74=; b=xZSQ/7e3lBrGiZzb7a/qHkqkXp+cY5brPc/G4o+D7Jc/TcweGReFBf1dHDkAbWUXWs RI8V08C2Hd6VZN5Jgyvz4pQIpDN+VYquVUN5GeLWUkAfDmOaU8fAStcB4SAOFA0taUtn sIeUyAjprJtxkgbc3Gs5lgboOTcWwIubmtnVxMnJQTw+WymGFbR8bjxX8Dm4gcW9X9lq pr2IrPrzYpTHB0K3Yx7Csoo0pC3QVeV8o0fkyoXf0ky4FjuyrD0qyKLBEyiL0mZFX9Bj U8//J5fYCEKez9HgXmvfL4Vb+qaT63tqhPKI38CptqHTXHwmugW7FpQtql1RzHTGTSx9 dJLQ== 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=GQh6SFQhXFTR+TS/0nrG1bcFwyio2bg3ULDP0/O0G74=; b=LhZjD4/+7rP2mPNvIdg1CN46mkWbzFYiHrHu3u5o+LQKqkFriF40tGEjDIDfs46GbO oZjWgji0Y1DMIV1h7i2VKO+5kl2we0ButGfDU2+JBk76Mr0k/oLzXrA1dQT9RgQjRJa3 71uqiPx1VgAJ7auYNusGMMnZ2hB70TF7L5JAZjvOw5+eDaz2LiX8yaoWLkyffVqRFYxx 7Vv0J5v5K/ycE9I60m35EDRNTBSEalKS/Scig9UNTTBQiKE0dT8h55CFy3B5w3fatLtz pytoK+8/hEDxNUpiQ8F7nH5fG7cFkE27G+vvD/HELI6gw/pS9u6XnAlrUPkkeLERBYkS iWbw== X-Gm-Message-State: AD7BkJLPgKanK4pvKZHMDWZR79vhv3DC5JJkEoLN5lRfafDhF6OfuOrr5pEbBmcznpNAQw== X-Received: by 10.28.46.5 with SMTP id u5mr3748042wmu.75.1458125243758; Wed, 16 Mar 2016 03:47:23 -0700 (PDT) Received: from 640k.lan (94-39-161-17.adsl-ull.clienti.tiscali.it. [94.39.161.17]) by smtp.gmail.com with ESMTPSA id wr2sm2418094wjc.49.2016.03.16.03.47.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Mar 2016 03:47:23 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 16 Mar 2016 11:46:28 +0100 Message-Id: <1458125219-131698-19-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1458125219-131698-1-git-send-email-pbonzini@redhat.com> References: <1458125219-131698-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::230 Subject: [Qemu-devel] [PATCH 18/49] target-tricore: make cpu-qom.h not target specific X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 5fee376..f0da68c 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" @@ -199,6 +200,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 @@ -339,7 +368,6 @@ enum { uint32_t psw_read(CPUTriCoreState *env); void psw_write(CPUTriCoreState *env, uint32_t val); -#include "cpu-qom.h" #define MMU_USER_IDX 2 void tricore_cpu_list(FILE *f, fprintf_function cpu_fprintf);