From patchwork Wed Mar 16 10:46:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8597781 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 03AC29F44D for ; Wed, 16 Mar 2016 10:54:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 483FE2026C for ; Wed, 16 Mar 2016 10:54:07 +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 B4302202BE for ; Wed, 16 Mar 2016 10:54:01 +0000 (UTC) Received: from localhost ([::1]:54963 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag95V-0006U7-56 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 Mar 2016 06:54:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8z7-00034Y-Nk for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ag8z5-00025u-SS for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:25 -0400 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]:34137) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8z5-00025o-Hu for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:23 -0400 Received: by mail-wm0-x22c.google.com with SMTP id p65so183587984wmp.1 for ; Wed, 16 Mar 2016 03:47:23 -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=rqRc9vNokFGZIHaM2jz3xJANrSgEnALVC3qLRBmK7Yg=; b=Hm+OcIXZ9NnXuBzjCMwf7YezC6B5NjDNuinEfeonQ+PTqGdxId62qTbkJkQnwI7Jnc VO0LJNqqSz3KYTomPhmfIOX3fqakISfJiAA89JltsMXB8953Aba6GQFbu7GdeUgrfs56 Eec0fptbuC1IZqx6/vhuQQcdjeyeczzpoWizPrue9nBi/5utDHNG2p0OTK4AGZx/KWkN CueINEzUbV8jOdG308V3OupsRAjqBYPnFW4FEXkL8zK7q6WPSaR5av0Z5FXAELO+9ipY eSkdJaOXijwICPg8nyzj0hwkl1nLtiMFWF9+ym59wBcNBV7EVaxRZtAQ8A5zOoQo8R9J Pc0w== 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=rqRc9vNokFGZIHaM2jz3xJANrSgEnALVC3qLRBmK7Yg=; b=CWzUQrQwFjaAVoiv4YMCx22AK487Wfao596m3sWXCWNILnalQvstJEAwSH3sQ8vpv5 UKlTyAiBp7gW6Y8A4Tlf310iHujp1Ic6dqxsETdZzQPUH28Y+Lz54vVZzVE/ylLjminP Hw+X/kmnNp7k5X70axAixjri0WlZG3TTdNsw5I1ADtGlD73xmxoocpne14fJEszuYZEa ReD6vQcIc+rdin7skqtQykhyRKFXtW/pRtUXFfY3L0oYzhJOYbZTEm4nkJPwSuzxQ8PJ ROjFOEuoQC13OB4au0TI41Eb3FBO+3Tm+LDAdRII20e5XjAR54mRpCEa4kS3yRJJQNqf dIMQ== X-Gm-Message-State: AD7BkJJdHM5Gls8fwq0m4ge0LFXCIl6w6SAy/wiHMLJZs0wPiXSmmmeA0Gz7aUNrQBi2RA== X-Received: by 10.28.179.84 with SMTP id c81mr28526618wmf.13.1458125242821; Wed, 16 Mar 2016 03:47:22 -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.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Mar 2016 03:47:21 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 16 Mar 2016 11:46:27 +0100 Message-Id: <1458125219-131698-18-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::22c Subject: [Qemu-devel] [PATCH 17/49] target-sparc: 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 SPARCCPU 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-sparc/cpu-qom.h | 37 +------------------------------------ target-sparc/cpu.h | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 37 deletions(-) diff --git a/target-sparc/cpu-qom.h b/target-sparc/cpu-qom.h index 174dfd3..f63af72 100644 --- a/target-sparc/cpu-qom.h +++ b/target-sparc/cpu-qom.h @@ -51,41 +51,6 @@ typedef struct SPARCCPUClass { void (*parent_reset)(CPUState *cpu); } SPARCCPUClass; -/** - * SPARCCPU: - * @env: #CPUSPARCState - * - * A SPARC CPU. - */ -typedef struct SPARCCPU { - /*< private >*/ - CPUState parent_obj; - /*< public >*/ - - CPUSPARCState env; -} SPARCCPU; - -static inline SPARCCPU *sparc_env_get_cpu(CPUSPARCState *env) -{ - return container_of(env, SPARCCPU, env); -} - -#define ENV_GET_CPU(e) CPU(sparc_env_get_cpu(e)) - -#define ENV_OFFSET offsetof(SPARCCPU, env) - -#ifndef CONFIG_USER_ONLY -extern const struct VMStateDescription vmstate_sparc_cpu; -#endif - -void sparc_cpu_do_interrupt(CPUState *cpu); -void sparc_cpu_dump_state(CPUState *cpu, FILE *f, - fprintf_function cpu_fprintf, int flags); -hwaddr sparc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); -int sparc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); -int sparc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); -void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cpu, - vaddr addr, int is_write, - int is_user, uintptr_t retaddr); +typedef struct SPARCCPU SPARCCPU; #endif diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index dc46122..55981b5 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -3,6 +3,7 @@ #include "qemu-common.h" #include "qemu/bswap.h" +#include "cpu-qom.h" #define ALIGNED_ONLY @@ -506,7 +507,42 @@ struct CPUSPARCState { uint32_t cache_control; }; -#include "cpu-qom.h" +/** + * SPARCCPU: + * @env: #CPUSPARCState + * + * A SPARC CPU. + */ +struct SPARCCPU { + /*< private >*/ + CPUState parent_obj; + /*< public >*/ + + CPUSPARCState env; +}; + +static inline SPARCCPU *sparc_env_get_cpu(CPUSPARCState *env) +{ + return container_of(env, SPARCCPU, env); +} + +#define ENV_GET_CPU(e) CPU(sparc_env_get_cpu(e)) + +#define ENV_OFFSET offsetof(SPARCCPU, env) + +#ifndef CONFIG_USER_ONLY +extern const struct VMStateDescription vmstate_sparc_cpu; +#endif + +void sparc_cpu_do_interrupt(CPUState *cpu); +void sparc_cpu_dump_state(CPUState *cpu, FILE *f, + fprintf_function cpu_fprintf, int flags); +hwaddr sparc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +int sparc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); +int sparc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); +void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cpu, + vaddr addr, int is_write, + int is_user, uintptr_t retaddr); #ifndef NO_CPU_IO_DEFS /* cpu_init.c */