From patchwork Wed Mar 16 10:46:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8597831 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 9ED229F44D for ; Wed, 16 Mar 2016 10:56:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E0146202F2 for ; Wed, 16 Mar 2016 10:56:10 +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 311FB202BE for ; Wed, 16 Mar 2016 10:56:10 +0000 (UTC) Received: from localhost ([::1]:54988 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag97Z-0001pa-L6 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 Mar 2016 06:56:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36912) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8z7-00034V-N7 for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ag8z4-00025U-Bt for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:25 -0400 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:35612) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8z4-00025N-4W for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:22 -0400 Received: by mail-wm0-x22e.google.com with SMTP id l68so183359805wml.0 for ; Wed, 16 Mar 2016 03:47:21 -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=ZdQT6EmUvthqprk1jpccF3YHLpyYh534/5DqMbZZiVitfKevj/o7TC5Aw6Wk9euxcr qq1iQGng8jpazaT4HkCEhy8mtqjKG1LFHF/DaIWsZoKNUij5p6+A22/Kavo/WJB32MLZ 76x+cWF58MQNxAsz6SUoCg8Wb81/KNfCh8xwAADuqG7hugcRAPQ32jkHuBFn2erbFk8s XFVbLPfRi3E3jbuqufnN3rfmrjg8QO63zG5eMtGboCU+hDUl0bCywQgW8Xi1OQKpUE21 foJrqVSRyGsH9YFzFJAqDt1t7OBgLCrxvYC04LvAGqdbDURdUpfFFl/71lNPZwfu3Lzl JuAg== 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=SHXnoH6m9OZy5euYtxmLGdICSNLRTrs00gbPYYYBJWVaW22TMTC08AndKU7V0tP8qE 66JNTcZvc0tkt1F+h4fLZzDjoLuBM/jNwF6gLnaLWoIJnMdZsJ+L14pSkciqleFd8luE HfobmV0AN2ZFJgmqEy2c02sFo6wJDR+40QuoaRaddHPrngedS9i+50fq9m54p27dIrgr Qzjw3ynJGgEFA+6yOWr7An1/HRiGbXTeXi6HQcq7Pxm/ZefWDrx8GxQqPt4nMLNIsd03 O9/W7nJjfOV7S/dEI1hfXhkF6popBzdbOw0BeGdNZU2kxlxP7nKhouW/s55l3xLGtxpb CUMA== X-Gm-Message-State: AD7BkJIh4h9gA6hfe16zZGE0FW/mBLsVzBklttHXLMUZJf1mN9tPzW2LdcfvVTS66x2fcQ== X-Received: by 10.28.130.67 with SMTP id e64mr29067157wmd.6.1458125241498; Wed, 16 Mar 2016 03:47:21 -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.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Mar 2016 03:47:20 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 16 Mar 2016 11:46:26 +0100 Message-Id: <1458125219-131698-17-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::22e Subject: [Qemu-devel] [PATCH 16/49] target-sh4: 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 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);