From patchwork Fri Apr 8 20:28:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8785631 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 04C1C9F71A for ; Fri, 8 Apr 2016 20:32:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 460232024D for ; Fri, 8 Apr 2016 20:32:40 +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 8C5D320204 for ; Fri, 8 Apr 2016 20:32:39 +0000 (UTC) Received: from localhost ([::1]:58066 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod54-0001cG-L3 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 08 Apr 2016 16:32:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod21-0003mX-TF for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aod1x-00022m-Ox for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:29 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:36454) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aod1x-00022g-F3 for qemu-devel@nongnu.org; Fri, 08 Apr 2016 16:29:25 -0400 Received: by mail-wm0-x241.google.com with SMTP id l6so6823554wml.3 for ; Fri, 08 Apr 2016 13:29:25 -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=e6zEqOyEtOfM/S0LQ+jUO7ODQ8XLLhPUma3w77rdGwY=; b=fObCq8Lt1wEP4CUoGyPzTcvobbcuybJP8qnKxT9BY8Z3ans4nd2ul+J6j1ox7/CGWU oB0vqsqAXrc9WB8xscd0ToDuOnicplX0uWu435511bbyzk52sf5ILHnsavj3lwxEFKFA TRyErFgb087OcA2gIEZzCAXlgF3STMBYIVVaIIlptofEvI7QRJ4YZp5BgN/Grg+oRyiR VyRetBA2kgPXhRaROue8kqaciDCiNaUaQnDVDgk6lJqxqXOXxJDcYc6HC5Fv1t2/j7ah 9nNSSAIcGJSnmA2yESSlE51V360xojUqPmB9R4r5IkhvgAwrAv38s3WWQolX9FSP8Z53 VGww== 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=e6zEqOyEtOfM/S0LQ+jUO7ODQ8XLLhPUma3w77rdGwY=; b=gLwi/bmuxxS/OVxd8b88pi0bhLY+Iux6lXjM/0jlIcvnEr3STNjngosI4EDzpwyrSo qopEJ0Sp7UObjuGkKq8nVGOIgreo3X1jWRAkkZMEm3GJuMMIj2VO9LayjZG8IfyK0m+K Sr5eC8xAqW22N1AhG6LVtN4y3oCn+VUM6VMPi6c6lIhaqUB5MXNrU4aHegrfho1GXMEg XZK+2A/3iMXJriFE04PSwke0VHaLUbAhqLJ+2MmPgrMMO4t/fBbrEFY9Y6WhXFDABX+b BMiIcUEz0bZRD4IXLJYS6huevq8I/8o2Kj/8AQaPriyxuncvRw85zKi3WnyJy/66353C cqOg== X-Gm-Message-State: AD7BkJJOY97ySc7BX+2xwyKIJnKqVuwmmvn5/s4S3AiJIfjkMV3oFVdVdVXo4d+J1M7PxQ== X-Received: by 10.28.147.8 with SMTP id v8mr5507767wmd.92.1460147364934; Fri, 08 Apr 2016 13:29:24 -0700 (PDT) Received: from 640k.lan (94-39-141-76.adsl-ull.clienti.tiscali.it. [94.39.141.76]) by smtp.gmail.com with ESMTPSA id w10sm3849168wjz.9.2016.04.08.13.29.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Apr 2016 13:29:24 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 8 Apr 2016 22:28:31 +0200 Message-Id: <1460147350-7601-12-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1460147350-7601-1-git-send-email-pbonzini@redhat.com> References: <1460147350-7601-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 11/50] target-microblaze: 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 MicroBlazeCPU 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-microblaze/cpu-qom.h | 44 +------------------------------------------- target-microblaze/cpu.h | 45 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 44 deletions(-) diff --git a/target-microblaze/cpu-qom.h b/target-microblaze/cpu-qom.h index 34f6273..1a61db7 100644 --- a/target-microblaze/cpu-qom.h +++ b/target-microblaze/cpu-qom.h @@ -47,48 +47,6 @@ typedef struct MicroBlazeCPUClass { void (*parent_reset)(CPUState *cpu); } MicroBlazeCPUClass; -/** - * MicroBlazeCPU: - * @env: #CPUMBState - * - * A MicroBlaze CPU. - */ -typedef struct MicroBlazeCPU { - /*< private >*/ - CPUState parent_obj; - - /*< public >*/ - - /* Microblaze Configuration Settings */ - struct { - bool stackprot; - uint32_t base_vectors; - uint8_t use_fpu; - bool use_mmu; - bool dcache_writeback; - bool endi; - char *version; - uint8_t pvr; - } cfg; - - CPUMBState env; -} MicroBlazeCPU; - -static inline MicroBlazeCPU *mb_env_get_cpu(CPUMBState *env) -{ - return container_of(env, MicroBlazeCPU, env); -} - -#define ENV_GET_CPU(e) CPU(mb_env_get_cpu(e)) - -#define ENV_OFFSET offsetof(MicroBlazeCPU, env) - -void mb_cpu_do_interrupt(CPUState *cs); -bool mb_cpu_exec_interrupt(CPUState *cs, int int_req); -void mb_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, - int flags); -hwaddr mb_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); -int mb_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); -int mb_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); +typedef struct MicroBlazeCPU MicroBlazeCPU; #endif diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index 2f7335e..4c4db7f 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -20,6 +20,7 @@ #define CPU_MICROBLAZE_H #include "qemu-common.h" +#include "cpu-qom.h" #define TARGET_LONG_BITS 32 @@ -274,7 +275,49 @@ struct CPUMBState { } pvr; }; -#include "cpu-qom.h" +/** + * MicroBlazeCPU: + * @env: #CPUMBState + * + * A MicroBlaze CPU. + */ +struct MicroBlazeCPU { + /*< private >*/ + CPUState parent_obj; + + /*< public >*/ + + /* Microblaze Configuration Settings */ + struct { + bool stackprot; + uint32_t base_vectors; + uint8_t use_fpu; + bool use_mmu; + bool dcache_writeback; + bool endi; + char *version; + uint8_t pvr; + } cfg; + + CPUMBState env; +}; + +static inline MicroBlazeCPU *mb_env_get_cpu(CPUMBState *env) +{ + return container_of(env, MicroBlazeCPU, env); +} + +#define ENV_GET_CPU(e) CPU(mb_env_get_cpu(e)) + +#define ENV_OFFSET offsetof(MicroBlazeCPU, env) + +void mb_cpu_do_interrupt(CPUState *cs); +bool mb_cpu_exec_interrupt(CPUState *cs, int int_req); +void mb_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, + int flags); +hwaddr mb_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +int mb_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); +int mb_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); void mb_tcg_init(void); MicroBlazeCPU *cpu_mb_init(const char *cpu_model);