From patchwork Thu May 19 11:18:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 9126881 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 2F8E5BF29F for ; Thu, 19 May 2016 11:36:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7E4A420211 for ; Thu, 19 May 2016 11:36:51 +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 C53262020F for ; Thu, 19 May 2016 11:36:50 +0000 (UTC) Received: from localhost ([::1]:49773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3MG1-0003Dg-Ro for patchwork-qemu-devel@patchwork.kernel.org; Thu, 19 May 2016 07:36:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Lyy-0004D3-FO for qemu-devel@nongnu.org; Thu, 19 May 2016 07:19:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3Lyu-00046M-Aq for qemu-devel@nongnu.org; Thu, 19 May 2016 07:19:12 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:35290) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Lyu-00046E-3l for qemu-devel@nongnu.org; Thu, 19 May 2016 07:19:08 -0400 Received: by mail-wm0-x244.google.com with SMTP id s63so5550858wme.2 for ; Thu, 19 May 2016 04:19:08 -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=Qv5OE3HFb/moIPLpg12hz8W32pyR1d5Rp+79FHF9R8E=; b=Bmuo51rucAmRXRnuebbYUTZydYKxVDk1YHxJQPk9YjAGNSNWinTmuCmIdU/J9JN9RL 4zq9ol2CcK30wbbTCZ54AVnGkxPCr+GVDani7lKqsYgI+1D3Tx2LerOxZfZy3Tn0p2dz AIS6KZsJCtxKYlaOaFYZdXTD6YqrpinkS+a8wJTyKxaF/XG+GCMwGUnygUlIC7elAApk Xh3J6RRGn/SlolfqAeymJ1KTtCA3ItIdJm/RXNZb9sS1F71BbhKGm9S3oO5wZ9upCQ4p KldQRCSMBgIpemrRhU4DAqCZVboeJM7EOAa2p6qEjxZdcU3U4+JKkreCEbxXam2Wh5UG hlqw== 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=Qv5OE3HFb/moIPLpg12hz8W32pyR1d5Rp+79FHF9R8E=; b=jpOS0l6P7nam431SHM1aJQvn57xT61WPiM8SExHg9tEXgcKuVlkv6/0PWRxECpD/Ut XRdZ6G8DgSMl4/t3/pqNmoB98e0n6nDDgmlRrEW6xa+1Z5CP1xVaxETZOjuJL9t0qJCa n5ewlRTqlvoL/yfrnagtsULOnY3/40szbDjN7Xhs29KWr/s4dWMHOjmRRYfi/D2PMExI SBDlcDYnRXrdDMJ/Jk5wEMHEPpI05Ih/6qCsdpn0mKYbTbGlZghqW5DayDZUU4E8KfO+ /2a1EXqXD9pYX4twHRbJhg0tMOsNspU9e7YWuimYLykGWEhTd7aJpfhcE0kAEi4l2wdI pz8g== X-Gm-Message-State: AOPr4FUezhSl/tLAwMjkSjOaKrURMmvvE7L2VgsCuF3cfOLZ9XEPYNpgmQySv92Ox3/P9A== X-Received: by 10.28.22.134 with SMTP id 128mr12821580wmw.16.1463656747594; Thu, 19 May 2016 04:19:07 -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 c7sm8374317wji.38.2016.05.19.04.19.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2016 04:19:06 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 19 May 2016 13:18:12 +0200 Message-Id: <1463656726-35952-19-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1463656726-35952-1-git-send-email-pbonzini@redhat.com> References: <1463656726-35952-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::244 Subject: [Qemu-devel] [PULL 18/52] 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 10c0191..9bd15b8 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);