From patchwork Mon May 16 15:35:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 9103861 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 4A288BF29F for ; Mon, 16 May 2016 15:38:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8E59820274 for ; Mon, 16 May 2016 15:38:56 +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 9CDD5202A1 for ; Mon, 16 May 2016 15:38:55 +0000 (UTC) Received: from localhost ([::1]:44432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2Kbe-00052j-Ro for patchwork-qemu-devel@patchwork.kernel.org; Mon, 16 May 2016 11:38:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KZR-0001Nh-0W for qemu-devel@nongnu.org; Mon, 16 May 2016 11:36:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2KZO-0006WR-MG for qemu-devel@nongnu.org; Mon, 16 May 2016 11:36:35 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:36149) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KZO-0006WM-C2 for qemu-devel@nongnu.org; Mon, 16 May 2016 11:36:34 -0400 Received: by mail-wm0-x244.google.com with SMTP id w143so18871164wmw.3 for ; Mon, 16 May 2016 08:36:34 -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=gvY8z/5LvOmBNmI+yCv/maloSuSjjMHKvxwGHMLz3Kg=; b=Zy1SQwTNKAtUPc85qXAVCXStCh9xFcAgWx/yZdI4g+TLWMaT86Ch23VOhsKu+TftIP u313c6rFNDArU3MBCJ4JqHfIU81LH7RJk+uQZ+aSutL+p1UpKY3TVLlY6CD2FWqM9WjR Q53qCS+Az1dIDy8vfbShsu1GFQ+k90rOa78w9lMdwzL82ewyKT92ypMMssgwM+wwhuAe ifO5wun+MsIDZ/1mGtNCh6kpiBCBHqgl8d3Z45FwJIj5pig3u55hfo2DdZ2sA0gp5h5A rhKRVPDSwbHCN1cD7C3bRNbs2af6Tl8ofE2UmLBUHBuAsZCs3WMuBZ9CB2dme4F1JTue iQDg== 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=gvY8z/5LvOmBNmI+yCv/maloSuSjjMHKvxwGHMLz3Kg=; b=OIqHQXuVNcFI3W2jhdEGUbz5e5wNMD4pNeCmNRc42kTbpjJjoNLQW/n8RrEcWFs299 Ntq1tnZuqnmdUUJMkXHYodlpAsyaHOavqK4zjb84j2Lh69t8U8f2A0iEcyvRFp+5yvaw xpe9dy47XY2TH0f811dvyRsAFMvtjXYvI3sWDwVzB/Jcc/GEHLOgdiVi/8VK1Afz7Yvu 046Omi+le20TpZbRwQb1iirmC/p9Tp4aQKAuZZ2b7zjQKl22k0pkX1EEBLIrp0tRssZg +b45HY2+GHSVAMM/dFxK/0aQi2aSpjIEJm8oSlLJY+eS0wz3G84WEIR/gjrSc7DFMMdT lNzg== X-Gm-Message-State: AOPr4FURjrKYPaQIU4rnGnvWoHlmJI9DvWN2hHfuNDUX8g4IiF/1lXBh3JWUdFRLfNatqw== X-Received: by 10.194.166.3 with SMTP id zc3mr30983909wjb.104.1463412993785; Mon, 16 May 2016 08:36:33 -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.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 May 2016 08:36:33 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 16 May 2016 17:35:39 +0200 Message-Id: <1463412982-6681-8-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::244 Subject: [Qemu-devel] [PATCH 07/50] target-cris: 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 CRISCPU 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-cris/cpu-qom.h | 40 +--------------------------------------- target-cris/cpu.h | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/target-cris/cpu-qom.h b/target-cris/cpu-qom.h index df4c0b5..7556e9f 100644 --- a/target-cris/cpu-qom.h +++ b/target-cris/cpu-qom.h @@ -50,44 +50,6 @@ typedef struct CRISCPUClass { uint32_t vr; } CRISCPUClass; -/** - * CRISCPU: - * @env: #CPUCRISState - * - * A CRIS CPU. - */ -typedef struct CRISCPU { - /*< private >*/ - CPUState parent_obj; - /*< public >*/ - - CPUCRISState env; -} CRISCPU; - -static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env) -{ - return container_of(env, CRISCPU, env); -} - -#define ENV_GET_CPU(e) CPU(cris_env_get_cpu(e)) - -#define ENV_OFFSET offsetof(CRISCPU, env) - -#ifndef CONFIG_USER_ONLY -extern const struct VMStateDescription vmstate_cris_cpu; -#endif - -void cris_cpu_do_interrupt(CPUState *cpu); -void crisv10_cpu_do_interrupt(CPUState *cpu); -bool cris_cpu_exec_interrupt(CPUState *cpu, int int_req); - -void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, - int flags); - -hwaddr cris_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); - -int crisv10_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); -int cris_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); -int cris_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); +typedef struct CRISCPU CRISCPU; #endif diff --git a/target-cris/cpu.h b/target-cris/cpu.h index 415cf91..e3411687 100644 --- a/target-cris/cpu.h +++ b/target-cris/cpu.h @@ -21,6 +21,7 @@ #define CPU_CRIS_H #include "qemu-common.h" +#include "cpu-qom.h" #define TARGET_LONG_BITS 32 @@ -171,7 +172,45 @@ typedef struct CPUCRISState { void *load_info; } CPUCRISState; -#include "cpu-qom.h" +/** + * CRISCPU: + * @env: #CPUCRISState + * + * A CRIS CPU. + */ +struct CRISCPU { + /*< private >*/ + CPUState parent_obj; + /*< public >*/ + + CPUCRISState env; +}; + +static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env) +{ + return container_of(env, CRISCPU, env); +} + +#define ENV_GET_CPU(e) CPU(cris_env_get_cpu(e)) + +#define ENV_OFFSET offsetof(CRISCPU, env) + +#ifndef CONFIG_USER_ONLY +extern const struct VMStateDescription vmstate_cris_cpu; +#endif + +void cris_cpu_do_interrupt(CPUState *cpu); +void crisv10_cpu_do_interrupt(CPUState *cpu); +bool cris_cpu_exec_interrupt(CPUState *cpu, int int_req); + +void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, + int flags); + +hwaddr cris_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); + +int crisv10_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); +int cris_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); +int cris_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); CRISCPU *cpu_cris_init(const char *cpu_model); int cpu_cris_exec(CPUState *cpu);