From patchwork Mon May 16 15:35:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 9103981 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 F3461BF29F for ; Mon, 16 May 2016 15:43:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4473A202BE for ; Mon, 16 May 2016 15:43:54 +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 886F2202A1 for ; Mon, 16 May 2016 15:43:53 +0000 (UTC) Received: from localhost ([::1]:44475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KgS-0005E3-Of for patchwork-qemu-devel@patchwork.kernel.org; Mon, 16 May 2016 11:43:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KZb-0001dz-LN for qemu-devel@nongnu.org; Mon, 16 May 2016 11:36:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2KZZ-0006ZM-9X for qemu-devel@nongnu.org; Mon, 16 May 2016 11:36:46 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:34347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KZY-0006Z5-Ee for qemu-devel@nongnu.org; Mon, 16 May 2016 11:36:45 -0400 Received: by mail-wm0-x241.google.com with SMTP id n129so18905062wmn.1 for ; Mon, 16 May 2016 08:36:44 -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=aAsSvvo4inwWe9BhRMJIzhObNl6C1i2MQnXcoBfrlVM=; b=V6er3tTP1dOl42PtNUAUUe6D5el2UdbH4esYHwRtzT/RCw7CsuYeshFnPzWGuS4Px5 7TYT4EGo43uaJPPvnJZfA/OIBy1SZW68PKCfaZR0SYlARiHfgcpxdzrXf1G0bCf+bypi lZd6fpncF3eFLSsbsY7+xEGjcsloOcRQrosZGBSSn/eluba82E34lut5k28g8Q6GcXk0 QBLB1m8c8wmaVxBb77ZkLiGhj2cv1EXNcGaLK0uwmyDg+zpcxrj7YqdFTboDipEox9L/ 9y57nVcBKF5ahaY10kM8HXGKdXjoX5BigaG9btSDI6LHJuA0UUT3ln30Lgn/NBE2VwPG NqCQ== 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=aAsSvvo4inwWe9BhRMJIzhObNl6C1i2MQnXcoBfrlVM=; b=bLdw3ZKIvPN3+eULBikbSpp1GopwszhPglg7FD/8L5aWr+e2gi80xy3/sAzvoh+Kh+ TC1SujyNYjsWERJnpjjOUWKggDqxHlSzqFX5L5bkZcPoJSZ69wq3UsqSRy2wT/6GfEO4 5r/si4eL1oKPub/3KWNlsfPCFTYF64T6TvRaOafNT8GFkrw9CYeEWpSb6XY+JvPOnGAC IxWCZopsGxIQTzAMp3PqbCDkQSiTum42SGoAoeuM87d6LET8hNWD0cwaesiAh/mY7DGh 4kPWP64YUwRWhavdzKZ5dRWN+c4FXijpIAf8V1kbRsc19LCHV4/6RxRfYmAYk/6+Qpcb Pexw== X-Gm-Message-State: AOPr4FVzHwKVZBG2zeGCVgJs9Ri2b4GMwqGtpeHhUe3y2MPyTE6KZugpbn0hTLw50dwqiQ== X-Received: by 10.28.135.135 with SMTP id j129mr19333585wmd.101.1463413003845; Mon, 16 May 2016 08:36:43 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-252-58.clienti.tiscali.it. [78.12.252.58]) by smtp.gmail.com with ESMTPSA id lf9sm34386875wjc.44.2016.05.16.08.36.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 May 2016 08:36:42 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 16 May 2016 17:35:48 +0200 Message-Id: <1463412982-6681-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1463412982-6681-1-git-send-email-pbonzini@redhat.com> References: <1463412982-6681-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 16/50] target-sh4: 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 SuperHCPU 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-sh4/cpu-qom.h | 31 +------------------------------ target-sh4/cpu.h | 32 +++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/target-sh4/cpu-qom.h b/target-sh4/cpu-qom.h index 6341238..01abb20 100644 --- a/target-sh4/cpu-qom.h +++ b/target-sh4/cpu-qom.h @@ -60,35 +60,6 @@ typedef struct SuperHCPUClass { uint32_t cvr; } SuperHCPUClass; -/** - * SuperHCPU: - * @env: #CPUSH4State - * - * A SuperH CPU. - */ -typedef struct SuperHCPU { - /*< private >*/ - CPUState parent_obj; - /*< public >*/ - - CPUSH4State env; -} SuperHCPU; - -static inline SuperHCPU *sh_env_get_cpu(CPUSH4State *env) -{ - return container_of(env, SuperHCPU, env); -} - -#define ENV_GET_CPU(e) CPU(sh_env_get_cpu(e)) - -#define ENV_OFFSET offsetof(SuperHCPU, env) - -void superh_cpu_do_interrupt(CPUState *cpu); -bool superh_cpu_exec_interrupt(CPUState *cpu, int int_req); -void superh_cpu_dump_state(CPUState *cpu, FILE *f, - fprintf_function cpu_fprintf, int flags); -hwaddr superh_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); -int superh_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); -int superh_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); +typedef struct SuperHCPU SuperHCPU; #endif diff --git a/target-sh4/cpu.h b/target-sh4/cpu.h index 3b23e96..0acb60c 100644 --- a/target-sh4/cpu.h +++ b/target-sh4/cpu.h @@ -20,6 +20,7 @@ #define _CPU_SH4_H #include "qemu-common.h" +#include "cpu-qom.h" #define TARGET_LONG_BITS 32 @@ -187,7 +188,36 @@ typedef struct CPUSH4State { memory_content **movcal_backup_tail; } CPUSH4State; -#include "cpu-qom.h" +/** + * SuperHCPU: + * @env: #CPUSH4State + * + * A SuperH CPU. + */ +struct SuperHCPU { + /*< private >*/ + CPUState parent_obj; + /*< public >*/ + + CPUSH4State env; +}; + +static inline SuperHCPU *sh_env_get_cpu(CPUSH4State *env) +{ + return container_of(env, SuperHCPU, env); +} + +#define ENV_GET_CPU(e) CPU(sh_env_get_cpu(e)) + +#define ENV_OFFSET offsetof(SuperHCPU, env) + +void superh_cpu_do_interrupt(CPUState *cpu); +bool superh_cpu_exec_interrupt(CPUState *cpu, int int_req); +void superh_cpu_dump_state(CPUState *cpu, FILE *f, + fprintf_function cpu_fprintf, int flags); +hwaddr superh_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +int superh_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); +int superh_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); void sh4_translate_init(void); SuperHCPU *cpu_sh4_init(const char *cpu_model);