From patchwork Wed Mar 16 10:46:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8597721 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 6AC009F44D for ; Wed, 16 Mar 2016 10:53:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7763202FE for ; Wed, 16 Mar 2016 10:53:30 +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 EBF2C202F2 for ; Wed, 16 Mar 2016 10:53:29 +0000 (UTC) Received: from localhost ([::1]:54957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag94z-0005Wd-Cj for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 Mar 2016 06:53:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8yy-0002ns-SU for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ag8yu-00021Z-Um for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:16 -0400 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:37775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8yu-00021R-Cx for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:12 -0400 Received: by mail-wm0-x229.google.com with SMTP id p65so66032233wmp.0 for ; Wed, 16 Mar 2016 03:47:12 -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=vGRO0BNNfuaWwOviiPqMVVvRqzrwoct1qDDVuXNhoSrI7zLbfTobl9BOJfr4SeFltu 9zsPclnPBfZgkv+4QMuhzK4BWNGrFQzJU1Vxb/7vS5xG1v01Z0ximIAg1M47lG5qeSX7 6A/w5vxVT8UV8ntXCtc1CPi59BxlsvuUvLPu/XJD/uqUqkgaT9dfZiKfTPDFQeYc9T0g ubQ5KN1J/9Fulfpdlb53284BBO06jDZ53YKlYVVLcThJnjtcw/HgyT1nXEGYJLr3ztdK iNgnfoH6K4JkVypSOlhbXoyrcXensJulMUilbud/Yyhg4sfmiReSVFWs40BVL6FoCOS/ hZYg== 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=K5UPQFwwmPbE8QjIxTGu/8ewjWdKzC4qxktik8WJyRz8QbaqRwRWA8sebTllPRtdM5 FQ9qJnZM3U9dqnkPxTBbEyaAV53TZ7rzjo27jwFUWyQd4KeAmWD9/Unb0+CLlpDV401U AxlV38bFzXE+KLisaRyVwUIikbkGFyqu4lORm8YOee9EbgG3BBQ35k4vHcTdNqrbVFvE 1hrWXjebFmXdEVvzBDuHDozlm2wZnTmlXrVOgPCKBgmrwhOjXvhqSUcs4+v8a217huXo zg1wfv95OmmMzyvxe7lyjqiR/EKu6v4db/8Z/jFT2mgi7OATLF1RDFm7fQtjHYJhq+Ww sWVQ== X-Gm-Message-State: AD7BkJLyHQ8N6gM/96Ozynl7938fZVqJyKt1sZgBdCGMVh6ByiDjOZe0BqTiZYBAU3TCvw== X-Received: by 10.28.48.136 with SMTP id w130mr29843332wmw.54.1458125231711; Wed, 16 Mar 2016 03:47:11 -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.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Mar 2016 03:47:10 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 16 Mar 2016 11:46:17 +0100 Message-Id: <1458125219-131698-8-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::229 Subject: [Qemu-devel] [PATCH 07/49] target-cris: 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org 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);