From patchwork Fri Apr 8 20:28:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8785941 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 59EA39F659 for ; Fri, 8 Apr 2016 20:44:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 99B7D202B8 for ; Fri, 8 Apr 2016 20:44:55 +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 DE77120172 for ; Fri, 8 Apr 2016 20:44:54 +0000 (UTC) Received: from localhost ([::1]:58178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aodGw-0001la-4b for patchwork-qemu-devel@patchwork.kernel.org; Fri, 08 Apr 2016 16:44:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod24-0003tQ-RZ for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aod23-00024Z-Pd for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:32 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:33075) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod23-00024M-G5 for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:31 -0400 Received: by mail-wm0-x243.google.com with SMTP id y144so6822883wmd.0 for ; Fri, 08 Apr 2016 13:29:31 -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=z6R8ankW62xrcTzkV4cbJoLu4o1+HGi6kezBZ4ontadQGieSnXo6cK2+ckGNkRQypZ iDyyFqmo31XcjGaHNdhc6sjP1hNiffcxzOeIM4bR8VMFrqqIEMfuPZp7AapQVyVZOTBd qlBoqYOBzyll43+eMGDpqwuEZobLVhgFeWuAojuhFL/Sux1x1js8hpl5KFzTU/poblha fLIh+bTNMo7IcGGJWEY28c7klixTz1sAL+Mpuktv+i+jqEgm/9z8duPLPm1JhAaQe9S6 IzWu7gH1d0Quz7kn5w+9Y6KxqYnW0I4vpcvu2VXNd9ckOTvADoYWmRTcEFl5Ca+ce446 YXrw== 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=ebAGsQIvfp0/UKPSQ4niMJGGqKzKb85U9AZbMnclTdYB0EmF2PgSqGSfjyxsRPoZ2K pm+HYF3Bfn2AYZLIyOxP4380iXS6ejlkXx4SQ01HmvHcu1b7/4Ki4TWrIKpRnrYDZSxz yBJNb9LebvFCxQ/emesIBmaJYpDL6dKuViaehj2BV5YICp2JxMZfvxQ3/eBxLYrBHwai 04kZgnNZ1Q3Tx9TMAiOUlm3vuLJmmheZpQAPklmLP/5waHL47kKtbwb14wMt+cnYgRNc HdEIv8vjfrtyB0Xa0Pbnpo8tBfB6b651oYJXJv44WKzgxAKc7KKMxbvWyorU/nFiFYSj nNGA== X-Gm-Message-State: AD7BkJLvRhRI/ajw10mE0hzkHBT7UBq3fbphYsdvsLxHhQVDtIPYsxUEpXvzxNPrsGS8SQ== X-Received: by 10.194.59.138 with SMTP id z10mr11416576wjq.74.1460147370974; Fri, 08 Apr 2016 13:29:30 -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.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Apr 2016 13:29:30 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 8 Apr 2016 22:28:37 +0200 Message-Id: <1460147350-7601-18-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 17/50] target-sparc: 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 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 */