From patchwork Fri Apr 8 20:28:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 608174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 3qhWQr1c3Wz9sCg for ; Sat, 9 Apr 2016 06:34:28 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=u2/eBooX; dkim-atps=neutral Received: from localhost ([::1]:58083 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod6o-00062y-3Y for incoming@patchwork.ozlabs.org; Fri, 08 Apr 2016 16:34:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod1s-0003Rk-Iw for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aod1r-00021G-IN for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:20 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:34343) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod1r-00020u-8O for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:19 -0400 Received: by mail-wm0-x241.google.com with SMTP id n3so6849099wmn.1 for ; Fri, 08 Apr 2016 13:29:19 -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=u2/eBooX+UZbkmcbPYdbWOP2MooWnB2ZyY/1ip8m/dXvtmlE9vaCnRmD4Uks5Fehg8 6EWORQyJqQ3taBYmt///2IU4tY7IJ3LPe8813Yv9yJqvfaJS6U+sIuAy5cLzHAOnY9ix pFyz3WKO5AnGc+pbk7Z+umCn0X0TdUiJVx/LAUk2NWM7JIcQsB1rr7c3OLNjxwQTTDjl 5xqtjW39F3zdeO3GYofeeNlopFptd7qu0X3oHa1xm9eCwQfaKQxauelzg178S/7yEN/d C28EWANPplL1WxYcOrHs5HIV+UgfrgL9vKm6vK8ShlKaageuAj0gyq6HnsV7hSdeVSd6 g29A== 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=SdNhK71bv9hhTrNTuF3Vso3fK3yFKBl/TGatQHAuGJfU7hTvGm1Wy+8O/zljHAvnMO SeEnXvIFGSqpD6jjKxKgLimcKaEdvOF8k8xU1P52uv/XQEMZ7iZ0gh9nlgHFKMS6+SAK NFt5/0gI5aUPArCdU4BBIZmS6STzR2TZ5ULvXkoUWHYjzwy1IFgd0gz0P7b5S3fng9+U SB6ywYmnkbpOreq3Ujv2bk+mStFrSmHFV/jJ4wgoEYwOyr5F8rYE4EKrSb4ccwGAsKQU SP59LOiegDUM2ydSKKQTBAbNtie4TVk341Lt1mw8Q1p8aygGbKsKYqa5Lxp3jdjXdr0U +mvQ== X-Gm-Message-State: AD7BkJIzQom6zrqet4/5NRyEl5yjO/tSe9B1ba98dbn35HcNiPHjRK9K3hEukDFs0/QBKw== X-Received: by 10.194.171.130 with SMTP id au2mr10675076wjc.99.1460147358718; Fri, 08 Apr 2016 13:29:18 -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.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Apr 2016 13:29:18 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 8 Apr 2016 22:28:25 +0200 Message-Id: <1460147350-7601-6-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::241 Subject: [Qemu-devel] [PATCH 05/50] target-alpha: 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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,