From patchwork Thu May 19 11:18:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 9126481 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 02A5CBF29F for ; Thu, 19 May 2016 11:19:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A5AB120219 for ; Thu, 19 May 2016 11:19:43 +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 E5C73201FE for ; Thu, 19 May 2016 11:19:42 +0000 (UTC) Received: from localhost ([::1]:49687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3LzR-000468-VE for patchwork-qemu-devel@patchwork.kernel.org; Thu, 19 May 2016 07:19:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Lyl-000435-Pz for qemu-devel@nongnu.org; Thu, 19 May 2016 07:19:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3Lyk-00043M-JW for qemu-devel@nongnu.org; Thu, 19 May 2016 07:18:59 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:33961) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Lyk-00043B-9U for qemu-devel@nongnu.org; Thu, 19 May 2016 07:18:58 -0400 Received: by mail-wm0-x244.google.com with SMTP id n129so20158860wmn.1 for ; Thu, 19 May 2016 04:18:58 -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=jC2h+QHzsZ2PXBmwz2AmBBEpifsTGpQiNRzgda3uliU=; b=g6Fr5qhUI9TG8VAtMXO53SZxrA+66FiCKYgvicHlBQnq8CTclPfWUNa/tZpPI2NfJu k8hJa74puP2FThKv/IuGhjYJ4TBDL9zJjgBgdg5GabM6eOamGJYujm+L/m4/7/fxSLGI wtj+4IZ3LLoT1o+viPZCCFxMa9zaZqbfnt9USb51lN7lmcsWmQ2d1y75nSJwl5xG1sw1 A5L7+DcINVTVtY+tQliW09InQhJ/n6kzxnacYrwBK3QvPx1BViZcqIfspLEZgQLLj9Wr MkpDvIIfVRDBSsPQ+iZukbD01ij+Q84HXo5SHPZ3qUdIi/+lX46d4pS4Ivj2LCDQ/OG1 ayNA== 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=jC2h+QHzsZ2PXBmwz2AmBBEpifsTGpQiNRzgda3uliU=; b=IEpOvL10mj5r5VoWwY3tZzUMqU1tMJag6X/ay6gKWAkT+cMKPyAlXFVOsnOwjP6K7A G92lEDRlFt8J/yIJCgt9ddaaj4MDFMU3Pf+WCnwt1MIPaF/2JOSG/X3sxOxbqjoRqtcS iNDVEtyZaGb0AFVaAL2N/6mOFNe5bF+dKezhle4A8wZsbklXoxhdTerixaKuRqcA7sNA zBw4WftHsL4lZn4Y2wjPmxI8i21DMvIG3Jqta0lRgRMZFA/PKaXTVR6X7Euo2acGEcP4 WJFWfYR1Cknlne+XOkKOc4tSUhBzcqZLI7GgHdX83wYMJF0YgU9CJZ6bTKErs2lD8MHs bRrA== X-Gm-Message-State: AOPr4FW8Cs2tmb7cDVJhxiefsYpE6GSrVwbnqeq8kJZLBlYZbvHRxY8QvcMZ5X5sbOOjBg== X-Received: by 10.28.12.8 with SMTP id 8mr35686553wmm.6.1463656737734; Thu, 19 May 2016 04:18:57 -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.18.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2016 04:18:56 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 19 May 2016 13:18:02 +0200 Message-Id: <1463656726-35952-9-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 08/52] target-cris: 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 CRISCPU 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-cris/cpu-qom.h | 40 +--------------------------------------- target-cris/cpu.h | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/target-cris/cpu-qom.h b/target-cris/cpu-qom.h index df4c0b5..7556e9f 100644 --- a/target-cris/cpu-qom.h +++ b/target-cris/cpu-qom.h @@ -50,44 +50,6 @@ typedef struct CRISCPUClass { uint32_t vr; } CRISCPUClass; -/** - * CRISCPU: - * @env: #CPUCRISState - * - * A CRIS CPU. - */ -typedef struct CRISCPU { - /*< private >*/ - CPUState parent_obj; - /*< public >*/ - - CPUCRISState env; -} CRISCPU; - -static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env) -{ - return container_of(env, CRISCPU, env); -} - -#define ENV_GET_CPU(e) CPU(cris_env_get_cpu(e)) - -#define ENV_OFFSET offsetof(CRISCPU, env) - -#ifndef CONFIG_USER_ONLY -extern const struct VMStateDescription vmstate_cris_cpu; -#endif - -void cris_cpu_do_interrupt(CPUState *cpu); -void crisv10_cpu_do_interrupt(CPUState *cpu); -bool cris_cpu_exec_interrupt(CPUState *cpu, int int_req); - -void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, - int flags); - -hwaddr cris_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); - -int crisv10_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); -int cris_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); -int cris_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); +typedef struct CRISCPU CRISCPU; #endif diff --git a/target-cris/cpu.h b/target-cris/cpu.h index a492fc6..8cc8bf5 100644 --- a/target-cris/cpu.h +++ b/target-cris/cpu.h @@ -21,6 +21,7 @@ #define CPU_CRIS_H #include "qemu-common.h" +#include "cpu-qom.h" #define TARGET_LONG_BITS 32 @@ -171,7 +172,45 @@ typedef struct CPUCRISState { void *load_info; } CPUCRISState; -#include "cpu-qom.h" +/** + * CRISCPU: + * @env: #CPUCRISState + * + * A CRIS CPU. + */ +struct CRISCPU { + /*< private >*/ + CPUState parent_obj; + /*< public >*/ + + CPUCRISState env; +}; + +static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env) +{ + return container_of(env, CRISCPU, env); +} + +#define ENV_GET_CPU(e) CPU(cris_env_get_cpu(e)) + +#define ENV_OFFSET offsetof(CRISCPU, env) + +#ifndef CONFIG_USER_ONLY +extern const struct VMStateDescription vmstate_cris_cpu; +#endif + +void cris_cpu_do_interrupt(CPUState *cpu); +void crisv10_cpu_do_interrupt(CPUState *cpu); +bool cris_cpu_exec_interrupt(CPUState *cpu, int int_req); + +void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, + int flags); + +hwaddr cris_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); + +int crisv10_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); +int cris_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); +int cris_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); CRISCPU *cpu_cris_init(const char *cpu_model); int cpu_cris_exec(CPUState *cpu);