From patchwork Wed Mar 16 10:46:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8597801 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 E156CC0554 for ; Wed, 16 Mar 2016 10:55:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2489A20304 for ; Wed, 16 Mar 2016 10:55:33 +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 1CCA4202F0 for ; Wed, 16 Mar 2016 10:55:32 +0000 (UTC) Received: from localhost ([::1]:54981 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag96x-0000rR-GX for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 Mar 2016 06:55:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8z0-0002ra-S2 for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ag8yz-00023z-Qv for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:18 -0400 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:33565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8yz-00023r-GP for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:17 -0400 Received: by mail-wm0-x22e.google.com with SMTP id l68so183838685wml.0 for ; Wed, 16 Mar 2016 03:47:17 -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=TC6uak4TSbmYN+2iL7Mi3dvzfRwTla1VOjnOvXg9uqw=; b=OMlg7zf7NejRyFcf8fP1wzH+ceT8cCGx+RzhYmjkxvHEF24di1G6gNApQY5s8+M/PV FyCAlqBZnc2icZmRlYk0RMw1Ph9ppvgTLzgT8FCO93zNvOHGsShO6Upb4jmCd5Tn4vha 8UZzqR1em/C3of4ftm6oAK0DIHX3Ynx3DcandXAcKv+y25xYrvPJTD09a+AIWdxcuEvH Xs/JTYwhfb7X5etesB1Dp13kpZwamGvr5cNMiA00bnVMVJ9j2RKN5cJC8DfVjSn9fNuP 1n9z7F5/fI3yau3tv1KxrOK/P8BhcZglVbP74hOaHBptyJV3Gnd8vDeN9z5/DmuprR6m DQ1g== 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=TC6uak4TSbmYN+2iL7Mi3dvzfRwTla1VOjnOvXg9uqw=; b=IcgsjLZtKyEUGGRpRtWqbkPMrGDSTH6fcTBka2ThLHiviOalQVX/CjdYHnYlEgy9hL BqxmbkwlY8fGKkJkjgeTP+EyC/6k16X4dfBIYTwNv2bOhRyjU1/rJQYSvY5C+FTF5kXK 4W9SmEqwBdKVUwgQyPp3qfpX+iuGwyvZkWRX2Aeq7TuSCP59LxIaUV7ngwiZNcQ5aYKt BB6ll1GovspQKYoM5ilM94I3Sm1YY4A+vMHxibcXh1+KV83XdoVqAw0pOh2l90pb36rP eXgY1wqAsIUFMbVhKrrPXI3BLLjRW3rA610izkwmUaOz/XCOwGkOhs9S7DiguLIJhSRn UmJQ== X-Gm-Message-State: AD7BkJKlbzfVeIOvKv/oB+hBlR33FcCoHtWIUsS3uLeZBIJ6ii6Uj6uc/qO75IWKG8HNQg== X-Received: by 10.194.123.35 with SMTP id lx3mr2958619wjb.132.1458125236814; Wed, 16 Mar 2016 03:47:16 -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.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Mar 2016 03:47:16 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 16 Mar 2016 11:46:22 +0100 Message-Id: <1458125219-131698-13-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 12/49] target-mips: 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 MIPSCPU 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-mips/cpu-qom.h | 37 +------------------------------------ target-mips/cpu.h | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 37 deletions(-) diff --git a/target-mips/cpu-qom.h b/target-mips/cpu-qom.h index 4d6f9de..3f5bf23 100644 --- a/target-mips/cpu-qom.h +++ b/target-mips/cpu-qom.h @@ -51,41 +51,6 @@ typedef struct MIPSCPUClass { void (*parent_reset)(CPUState *cpu); } MIPSCPUClass; -/** - * MIPSCPU: - * @env: #CPUMIPSState - * - * A MIPS CPU. - */ -typedef struct MIPSCPU { - /*< private >*/ - CPUState parent_obj; - /*< public >*/ - - CPUMIPSState env; -} MIPSCPU; - -static inline MIPSCPU *mips_env_get_cpu(CPUMIPSState *env) -{ - return container_of(env, MIPSCPU, env); -} - -#define ENV_GET_CPU(e) CPU(mips_env_get_cpu(e)) - -#define ENV_OFFSET offsetof(MIPSCPU, env) - -#ifndef CONFIG_USER_ONLY -extern const struct VMStateDescription vmstate_mips_cpu; -#endif - -void mips_cpu_do_interrupt(CPUState *cpu); -bool mips_cpu_exec_interrupt(CPUState *cpu, int int_req); -void mips_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, - int flags); -hwaddr mips_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); -int mips_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); -int mips_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); -void mips_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, - int is_write, int is_user, uintptr_t retaddr); +typedef struct MIPSCPU MIPSCPU; #endif diff --git a/target-mips/cpu.h b/target-mips/cpu.h index 1e2b070..1baa57a 100644 --- a/target-mips/cpu.h +++ b/target-mips/cpu.h @@ -8,6 +8,7 @@ #define CPUArchState struct CPUMIPSState #include "qemu-common.h" +#include "cpu-qom.h" #include "mips-defs.h" #include "exec/cpu-defs.h" #include "fpu/softfloat.h" @@ -601,7 +602,42 @@ struct CPUMIPSState { QEMUTimer *timer; /* Internal timer */ }; -#include "cpu-qom.h" +/** + * MIPSCPU: + * @env: #CPUMIPSState + * + * A MIPS CPU. + */ +struct MIPSCPU { + /*< private >*/ + CPUState parent_obj; + /*< public >*/ + + CPUMIPSState env; +}; + +static inline MIPSCPU *mips_env_get_cpu(CPUMIPSState *env) +{ + return container_of(env, MIPSCPU, env); +} + +#define ENV_GET_CPU(e) CPU(mips_env_get_cpu(e)) + +#define ENV_OFFSET offsetof(MIPSCPU, env) + +#ifndef CONFIG_USER_ONLY +extern const struct VMStateDescription vmstate_mips_cpu; +#endif + +void mips_cpu_do_interrupt(CPUState *cpu); +bool mips_cpu_exec_interrupt(CPUState *cpu, int int_req); +void mips_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, + int flags); +hwaddr mips_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +int mips_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); +int mips_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); +void mips_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, + int is_write, int is_user, uintptr_t retaddr); #if !defined(CONFIG_USER_ONLY) int no_mmu_map_address (CPUMIPSState *env, hwaddr *physical, int *prot,