From patchwork Wed Mar 16 10:46:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8599941 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 EDFB2C0553 for ; Wed, 16 Mar 2016 13:11:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4111620251 for ; Wed, 16 Mar 2016 13:11:26 +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 85EA5201C8 for ; Wed, 16 Mar 2016 13:11:25 +0000 (UTC) Received: from localhost ([::1]:55004 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag9AH-0004Uj-HL for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 Mar 2016 06:58:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8z9-00036v-4B for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ag8z8-00027V-4z for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:27 -0400 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:34152) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8z7-00026g-KT for qemu-devel@nongnu.org; Wed, 16 Mar 2016 06:47:26 -0400 Received: by mail-wm0-x231.google.com with SMTP id p65so183589253wmp.1 for ; Wed, 16 Mar 2016 03:47: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=afu8Wpc7TsfXLStPpLHn8/bt2ap8+l+MN4nPUN/5Nx4=; b=oi8r4Q0ZlJ6J2wkRt+NGcvL9xvmRsdJzfCGWL6T+M6/uyU+3rmbCSYRF4NDEXBCUYB tAvGWR5yLDTjWhLVsaAeUow+h/oJ6+/4WT8hKYKYLZTkbPNkjL02Kks9jRpV6dwelC42 aT22o5ijivCdmyGEPZ1kwa5WBCJLxxrl6zlFnjw3VhL/Gw/OmFCjn/LXLaOu6qSYA853 M/mMf3exviTOmJ9FLajU1Fuq4jeOugPU9zK1GVDIZnG3QzaCdW09xz2p3TGWdo9DzTad P4rRKaJzZpLDj/+2S4XWfkSgRHLx9BimqicwJuqYVV80067gVnPtxh24rgHmXlrf1Ymn aI/A== 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=afu8Wpc7TsfXLStPpLHn8/bt2ap8+l+MN4nPUN/5Nx4=; b=TbB6cMQY5OYbnhFKSwyQTvVd7HajXaYrMgL/HsSKBoZ1g5eDkzX7rSI7//xTULfgfB KFmd29gLpXiieSDRiFwAMdEhid9mjKtP+5WIkGYwqYC1yTE5n3fba97y/ril6p87+Gcj cjsBM2H2D/PPWPBJ5Td4llbhHrUAWZovCHINrRjWIms/kFy9Wphr6BhH3uTU1/Jwzfxq xJ6gQ9Mj8I9hm02RNkDNjuwZaBt8ev4NSlSdh7Ys4FIPVPRbddGMjD9iZK6RR43jjeqH HZJe3yP5QpgwEAEXruIvN9rcE8qd5YnHe9DmqhykYGD6mKkElaCDGLX2ZlpZs6fwSXg3 Yl7w== X-Gm-Message-State: AD7BkJJj6NRABj9CCLwV5Nvs0Tpz1wCZp50CBX5QMydiYiK8tjZPzufLmvz6ZHbOMSbd0A== X-Received: by 10.28.14.140 with SMTP id 134mr27731200wmo.39.1458125245003; Wed, 16 Mar 2016 03:47:25 -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.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Mar 2016 03:47:24 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 16 Mar 2016 11:46:29 +0100 Message-Id: <1458125219-131698-20-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::231 Subject: [Qemu-devel] [PATCH 19/49] target-unicore32: 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=unavailable 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 UniCore32CPU 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-unicore32/cpu-qom.h | 29 +---------------------------- target-unicore32/cpu.h | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/target-unicore32/cpu-qom.h b/target-unicore32/cpu-qom.h index e554f1f..bc68e78 100644 --- a/target-unicore32/cpu-qom.h +++ b/target-unicore32/cpu-qom.h @@ -36,33 +36,6 @@ typedef struct UniCore32CPUClass { DeviceRealize parent_realize; } UniCore32CPUClass; -/** - * UniCore32CPU: - * @env: #CPUUniCore32State - * - * A UniCore32 CPU. - */ -typedef struct UniCore32CPU { - /*< private >*/ - CPUState parent_obj; - /*< public >*/ - - CPUUniCore32State env; -} UniCore32CPU; - -static inline UniCore32CPU *uc32_env_get_cpu(CPUUniCore32State *env) -{ - return container_of(env, UniCore32CPU, env); -} - -#define ENV_GET_CPU(e) CPU(uc32_env_get_cpu(e)) - -#define ENV_OFFSET offsetof(UniCore32CPU, env) - -void uc32_cpu_do_interrupt(CPUState *cpu); -bool uc32_cpu_exec_interrupt(CPUState *cpu, int int_req); -void uc32_cpu_dump_state(CPUState *cpu, FILE *f, - fprintf_function cpu_fprintf, int flags); -hwaddr uc32_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +typedef struct UniCore32CPU UniCore32CPU; #endif diff --git a/target-unicore32/cpu.h b/target-unicore32/cpu.h index 9c1fbf9..22a0aef 100644 --- a/target-unicore32/cpu.h +++ b/target-unicore32/cpu.h @@ -20,6 +20,7 @@ #define CPUArchState struct CPUUniCore32State #include "qemu-common.h" +#include "cpu-qom.h" #include "exec/cpu-defs.h" #include "fpu/softfloat.h" @@ -71,6 +72,35 @@ typedef struct CPUUniCore32State { } CPUUniCore32State; +/** + * UniCore32CPU: + * @env: #CPUUniCore32State + * + * A UniCore32 CPU. + */ +struct UniCore32CPU { + /*< private >*/ + CPUState parent_obj; + /*< public >*/ + + CPUUniCore32State env; +}; + +static inline UniCore32CPU *uc32_env_get_cpu(CPUUniCore32State *env) +{ + return container_of(env, UniCore32CPU, env); +} + +#define ENV_GET_CPU(e) CPU(uc32_env_get_cpu(e)) + +#define ENV_OFFSET offsetof(UniCore32CPU, env) + +void uc32_cpu_do_interrupt(CPUState *cpu); +bool uc32_cpu_exec_interrupt(CPUState *cpu, int int_req); +void uc32_cpu_dump_state(CPUState *cpu, FILE *f, + fprintf_function cpu_fprintf, int flags); +hwaddr uc32_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); + #define ASR_M (0x1f) #define ASR_MODE_USER (0x10) #define ASR_MODE_INTR (0x12) @@ -134,7 +164,6 @@ static inline int cpu_mmu_index(CPUUniCore32State *env, bool ifetch) } #include "exec/cpu-all.h" -#include "cpu-qom.h" #include "exec/exec-all.h" int uc32_cpu_exec(CPUState *s);