From patchwork Wed Mar 16 10:46:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8597661 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 A63CAC0553 for ; Wed, 16 Mar 2016 10:51:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC371202BE for ; Wed, 16 Mar 2016 10:51:28 +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 0795D2026C for ; Wed, 16 Mar 2016 10:51:28 +0000 (UTC) Received: from localhost ([::1]:54940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag931-0001io-Ei for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 Mar 2016 06:51:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8yt-0002cR-Cx for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ag8ys-00020h-Ck for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:11 -0400 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:35932) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8ys-000201-2k for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:10 -0400 Received: by mail-wm0-x235.google.com with SMTP id l124so43273053wmf.1 for ; Wed, 16 Mar 2016 03:47:09 -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=lD+mwXLUWd6BngX18GZP5XFBLbS4ZbEVwgsc6u/JoRI=; b=LUfkGRlX7wlIELPq+3RqLkQFjQUHJ3ls3Pe+fqn6XNGRcOYm0m6+tvYst6Vp2WEMA/ OOI7dF0KcUSm+AeoIaHfLvrRrlOiKIztDFycF13syWZIA4pln6IBhTmv7Uab5LOzyGJu bdPkEF4paL5xV2S33SLPgZPisuLPQ+XFqNqfhoLuyFHbhEQuJcphxfkDRssbi38Ve7+u GKruqKxDNVaaAcQzzAH0YrCizCtxkuPwDRzUnzkT/4JsTusEx+oDbQYtILZUUNMUJRW5 nTztTsM9C/qpmHvp8MjgXelcM2yfx+dKJkUjR+zq9t3y/+Cl/5+J/GcrP38D5rK6J/j4 qfhQ== 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=lD+mwXLUWd6BngX18GZP5XFBLbS4ZbEVwgsc6u/JoRI=; b=KdHONRnJMRFBOWnhd788Khlk49MD9Ecko9IUiv8V9NMArxSu7UUXHSR5O+Q2mxEXCv wANyYmGsh9Z9s+DkTslVotVmb6nlFNijVzafscSx2P+1hM0mZhdVhiRvcIb5c0O8/NyW LMKApLIgxp5XqMQDqCz2DlFpEjaIhpMWGWaWYV4i5d7+jTdWw0KbbNAB9NOvvwKjnsEZ V58GlgY6bhuWPanT82hQjhcsi9u/GS4qlNd9CDjvHO4Md1w/Q2zJONpl+YC18U8wALxp PDv9tIAAi91S9qUaXB0GzA0IIf1uV/T7n13c5lBqLAl0+TRNOvEvD5OESgL/n82Wdd5x p8Ww== X-Gm-Message-State: AD7BkJIxbqz4H5ApC1gRc0VQOhejJ3CtSbxpG2ic4hNgmKOFb7bfnkQd0G0PnnpF0VBx7g== X-Received: by 10.28.212.85 with SMTP id l82mr3679894wmg.82.1458125229292; Wed, 16 Mar 2016 03:47:09 -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.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Mar 2016 03:47:08 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 16 Mar 2016 11:46:15 +0100 Message-Id: <1458125219-131698-6-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::235 Subject: [Qemu-devel] [PATCH 05/49] target-alpha: 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 AlphaCPU 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-alpha/cpu-qom.h | 40 +--------------------------------------- target-alpha/cpu.h | 42 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 40 deletions(-) diff --git a/target-alpha/cpu-qom.h b/target-alpha/cpu-qom.h index cf5264a..bae4945 100644 --- a/target-alpha/cpu-qom.h +++ b/target-alpha/cpu-qom.h @@ -47,44 +47,6 @@ typedef struct AlphaCPUClass { void (*parent_reset)(CPUState *cpu); } AlphaCPUClass; -/** - * AlphaCPU: - * @env: #CPUAlphaState - * - * An Alpha CPU. - */ -typedef struct AlphaCPU { - /*< private >*/ - CPUState parent_obj; - /*< public >*/ - - CPUAlphaState env; - - /* This alarm doesn't exist in real hardware; we wish it did. */ - QEMUTimer *alarm_timer; -} AlphaCPU; - -static inline AlphaCPU *alpha_env_get_cpu(CPUAlphaState *env) -{ - return container_of(env, AlphaCPU, env); -} - -#define ENV_GET_CPU(e) CPU(alpha_env_get_cpu(e)) - -#define ENV_OFFSET offsetof(AlphaCPU, env) - -#ifndef CONFIG_USER_ONLY -extern const struct VMStateDescription vmstate_alpha_cpu; -#endif - -void alpha_cpu_do_interrupt(CPUState *cpu); -bool alpha_cpu_exec_interrupt(CPUState *cpu, int int_req); -void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, - int flags); -hwaddr alpha_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); -int alpha_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); -int alpha_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); -void alpha_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, - int is_write, int is_user, uintptr_t retaddr); +typedef struct AlphaCPU AlphaCPU; #endif diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h index 420f2a5..8353bda 100644 --- a/target-alpha/cpu.h +++ b/target-alpha/cpu.h @@ -21,6 +21,7 @@ #define __CPU_ALPHA_H__ #include "qemu-common.h" +#include "cpu-qom.h" #define TARGET_LONG_BITS 64 #define ALIGNED_ONLY @@ -284,12 +285,51 @@ struct CPUAlphaState { int implver; }; +/** + * AlphaCPU: + * @env: #CPUAlphaState + * + * An Alpha CPU. + */ +struct AlphaCPU { + /*< private >*/ + CPUState parent_obj; + /*< public >*/ + + CPUAlphaState env; + + /* This alarm doesn't exist in real hardware; we wish it did. */ + QEMUTimer *alarm_timer; +}; + +static inline AlphaCPU *alpha_env_get_cpu(CPUAlphaState *env) +{ + return container_of(env, AlphaCPU, env); +} + +#define ENV_GET_CPU(e) CPU(alpha_env_get_cpu(e)) + +#define ENV_OFFSET offsetof(AlphaCPU, env) + +#ifndef CONFIG_USER_ONLY +extern const struct VMStateDescription vmstate_alpha_cpu; +#endif + +void alpha_cpu_do_interrupt(CPUState *cpu); +bool alpha_cpu_exec_interrupt(CPUState *cpu, int int_req); +void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, + int flags); +hwaddr alpha_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +int alpha_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); +int alpha_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); +void alpha_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, + int is_write, int is_user, uintptr_t retaddr); + #define cpu_list alpha_cpu_list #define cpu_exec cpu_alpha_exec #define cpu_signal_handler cpu_alpha_signal_handler #include "exec/cpu-all.h" -#include "cpu-qom.h" enum { FEATURE_ASN = 0x00000001,