From patchwork Fri Apr 8 20:28:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 608176 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 3qhWRj5X63z9sCg for ; Sat, 9 Apr 2016 06:35:13 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=nWy6UCqa; dkim-atps=neutral Received: from localhost ([::1]:58094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod7X-0007ds-Lc for incoming@patchwork.ozlabs.org; Fri, 08 Apr 2016 16:35:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod25-0003vD-Nl for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aod24-00025c-Og for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:33 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:36466) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod24-00025U-IC for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:32 -0400 Received: by mail-wm0-x243.google.com with SMTP id l6so6824137wml.3 for ; Fri, 08 Apr 2016 13:29:32 -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=nWy6UCqa4fzU2Q/YnfnVMZ9ItbiMjro91Uu+UjZnb0eVk3VsApS1BqWsLzcn9iuoMp /4IQHfjVxcN33ZtDbu0eMGVNPLdEsPkHWgqUz9C08EcN5F4QpWmITk8TvswQsGO3BV2U Y3i+k5aIce/oqqBdr/OgHtFibhzN3eGH+JqCSsvurJ+NkNQECa1ZIzrgYmsYiXZ2ygrs QTDy5HbwpOz8HYCncPHhdOlFgFp7bM4GsOmheY/wWGUrV8SBd66S1ol1erKvy4211vcm BHC/lUf+hDyuyVoWYXHuxiKzTdcz3hAVuyvDXGWvEr622eeaMkUFvr7DwoNXHibCeTSY Mhtw== 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=h1XX6m0zbroOhXAn/hiSbiMl+M8uuxMwSSV5yrV5VofQv0v7/ydiRJ0VzV93jWvTi0 tW5UDZEwAT4DCxzYucg+VOv03gs/FQYW5E/y+sfec7c2F98mayAOhbf0jq/BZ9iLqMJ3 YDUk7bMyeG513B/zZNDIKq6lKqY65Rwip+Vrfd8JmTAB9+++ivuxZE+taPXBNVs5lnsH KJze/+M5sCmqF6LJ8ZaJ/A0YZmiv/rHtESRmKDigDAg3lJ+j/GFiAoNvIgFpd6pMRYEq nw/FcOijCffF7yIi3TcAKAgA6caAQXCOgr/3iG+IJmzfMyZLSvcxuIpQAZTi5zjztkzV LTJg== X-Gm-Message-State: AD7BkJKg7TnDgjbE/6pG8W23WJJpzGrno7ZTO0xoVxIlY2f9c1vc8T85dNIasG8C0xdgFA== X-Received: by 10.28.189.10 with SMTP id n10mr5933730wmf.101.1460147372012; Fri, 08 Apr 2016 13:29:32 -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.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Apr 2016 13:29:31 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 8 Apr 2016 22:28:38 +0200 Message-Id: <1460147350-7601-19-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::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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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);