From patchwork Thu Mar 28 23:03:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 10876117 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 423D5922 for ; Thu, 28 Mar 2019 23:49:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B3C428AA2 for ; Thu, 28 Mar 2019 23:49:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D58028D9B; Thu, 28 Mar 2019 23:49:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 91E1028D74 for ; Thu, 28 Mar 2019 23:49:43 +0000 (UTC) Received: from localhost ([127.0.0.1]:43592 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9emE-0002bw-VC for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 Mar 2019 19:49:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9eKs-0001yi-LC for qemu-devel@nongnu.org; Thu, 28 Mar 2019 19:21:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9e4V-000333-Em for qemu-devel@nongnu.org; Thu, 28 Mar 2019 19:04:32 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:43670) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h9e4V-00031s-3x for qemu-devel@nongnu.org; Thu, 28 Mar 2019 19:04:31 -0400 Received: by mail-pf1-x441.google.com with SMTP id c8so72178pfd.10 for ; Thu, 28 Mar 2019 16:04:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=fq9koqb5i3Cy/GtsZJmKo47G6cKJtoa0NkkL8LsWj7g=; b=y2oTpINmhtAhTq8LpC7FFVkLOOSCCJUs0sr8QxHB+qkItlW+cvXTQLe+ZpSOO5BeoA mUVILHNQzjCsPAmtJ1Xb++V1RUE0/Bd60e9MdjUXv7B3UxNWqjOEV0jTs49yVkd7Iz8e Zw75xq5dgQ2ESRRmGlTz1XXFzU4VcTSKXF6ymDLDksVdkk0564agS7eqKMPlwYP7SDWG UjcQUTx+ebFbVu2HAoWIjECofH/r7B0LTQF8ys+jWZB8C9yGzZ+vTqwiHMR1jjVjAc15 NiVvdMe+OUbMlf3gH4H+MFD57tsjxHUAb9OBO+Eqwxi15Eur8Evk2Q8YdULtrWvGdAXM OVtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=fq9koqb5i3Cy/GtsZJmKo47G6cKJtoa0NkkL8LsWj7g=; b=aqFZWIwhokevyuixkZykQgq+ZoYD1lAE/uYklVVyjGnyWl+Mp9njfYhIPMREjZI3Jf JlrOd4VOp4JPIlCKQcqpkuLGYHGH73ZS/ezIjiKd+NNEjszxed7ZW210t4qESJQxBXNZ 7rGPG9OTqCatQkMjF0OkQJfaFzfCVbLLfle26lyfoSJM2huKBt5lLlmcNsvr/+/ZBZ2o neHawtzzNrjr+ZG+FfRQ43QTO0tUEuAh6PRpNhrzWaw1AVT/SkwuJqrX7P58QL7mMR/+ YIv2GjE/nUwx1ayDEPAlcpbhf5ZuwFAUCdJ0eykqnO5MZ9iM/A3HrZEaiWu+W1vKywnj AleA== X-Gm-Message-State: APjAAAV1yxAD8nPrv2FfvMK5RElVDNj+V9BaNg4/Ebeb4UubsdGUO+mX WrG58/6UNfvLCkmQF1YdILoNj3ryg1o= X-Google-Smtp-Source: APXvYqzHShwUypbL5DYz2KdpBjZUWKS5leYV5NbwnxtijoAYSAkWKpzbFCpAuHYaG37tKYiVt4Q7EQ== X-Received: by 2002:a65:63d7:: with SMTP id n23mr13986678pgv.26.1553814269793; Thu, 28 Mar 2019 16:04:29 -0700 (PDT) Received: from cloudburst.ASUS (cpe-66-75-72-255.hawaii.res.rr.com. [66.75.72.255]) by smtp.gmail.com with ESMTPSA id f1sm280911pgl.35.2019.03.28.16.04.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Mar 2019 16:04:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 28 Mar 2019 13:03:41 -1000 Message-Id: <20190328230404.12909-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190328230404.12909-1-richard.henderson@linaro.org> References: <20190328230404.12909-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 Subject: [Qemu-devel] [PATCH for-4.1 v2 13/36] target/lm32: Use env_cpu, env_archcpu 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-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/lm32/cpu.h | 5 ----- target/lm32/helper.c | 19 ++++++------------- target/lm32/op_helper.c | 6 +++--- target/lm32/translate.c | 2 +- 4 files changed, 10 insertions(+), 22 deletions(-) diff --git a/target/lm32/cpu.h b/target/lm32/cpu.h index 258f2b4266..69beb16972 100644 --- a/target/lm32/cpu.h +++ b/target/lm32/cpu.h @@ -195,11 +195,6 @@ struct LM32CPU { uint32_t features; }; -static inline LM32CPU *lm32_env_get_cpu(CPULM32State *env) -{ - return container_of(env, LM32CPU, env); -} - #define ENV_OFFSET offsetof(LM32CPU, env) #ifndef CONFIG_USER_ONLY diff --git a/target/lm32/helper.c b/target/lm32/helper.c index a039a993ff..674cbd7fe4 100644 --- a/target/lm32/helper.c +++ b/target/lm32/helper.c @@ -58,28 +58,23 @@ hwaddr lm32_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) void lm32_breakpoint_insert(CPULM32State *env, int idx, target_ulong address) { - LM32CPU *cpu = lm32_env_get_cpu(env); - - cpu_breakpoint_insert(CPU(cpu), address, BP_CPU, + cpu_breakpoint_insert(env_cpu(env), address, BP_CPU, &env->cpu_breakpoint[idx]); } void lm32_breakpoint_remove(CPULM32State *env, int idx) { - LM32CPU *cpu = lm32_env_get_cpu(env); - if (!env->cpu_breakpoint[idx]) { return; } - cpu_breakpoint_remove_by_ref(CPU(cpu), env->cpu_breakpoint[idx]); + cpu_breakpoint_remove_by_ref(env_cpu(env), env->cpu_breakpoint[idx]); env->cpu_breakpoint[idx] = NULL; } void lm32_watchpoint_insert(CPULM32State *env, int idx, target_ulong address, lm32_wp_t wp_type) { - LM32CPU *cpu = lm32_env_get_cpu(env); int flags = 0; switch (wp_type) { @@ -98,26 +93,24 @@ void lm32_watchpoint_insert(CPULM32State *env, int idx, target_ulong address, } if (flags != 0) { - cpu_watchpoint_insert(CPU(cpu), address, 1, flags, - &env->cpu_watchpoint[idx]); + cpu_watchpoint_insert(env_cpu(env), address, 1, flags, + &env->cpu_watchpoint[idx]); } } void lm32_watchpoint_remove(CPULM32State *env, int idx) { - LM32CPU *cpu = lm32_env_get_cpu(env); - if (!env->cpu_watchpoint[idx]) { return; } - cpu_watchpoint_remove_by_ref(CPU(cpu), env->cpu_watchpoint[idx]); + cpu_watchpoint_remove_by_ref(env_cpu(env), env->cpu_watchpoint[idx]); env->cpu_watchpoint[idx] = NULL; } static bool check_watchpoints(CPULM32State *env) { - LM32CPU *cpu = lm32_env_get_cpu(env); + LM32CPU *cpu = env_archcpu(env); int i; for (i = 0; i < cpu->num_watchpoints; i++) { diff --git a/target/lm32/op_helper.c b/target/lm32/op_helper.c index 234d55e056..ebff4c4518 100644 --- a/target/lm32/op_helper.c +++ b/target/lm32/op_helper.c @@ -16,7 +16,7 @@ #if !defined(CONFIG_USER_ONLY) void raise_exception(CPULM32State *env, int index) { - CPUState *cs = CPU(lm32_env_get_cpu(env)); + CPUState *cs = env_cpu(env); cs->exception_index = index; cpu_loop_exit(cs); @@ -29,7 +29,7 @@ void HELPER(raise_exception)(CPULM32State *env, uint32_t index) void HELPER(hlt)(CPULM32State *env) { - CPUState *cs = CPU(lm32_env_get_cpu(env)); + CPUState *cs = env_cpu(env); cs->halted = 1; cs->exception_index = EXCP_HLT; @@ -39,7 +39,7 @@ void HELPER(hlt)(CPULM32State *env) void HELPER(ill)(CPULM32State *env) { #ifndef CONFIG_USER_ONLY - CPUState *cs = CPU(lm32_env_get_cpu(env)); + CPUState *cs = env_cpu(env); fprintf(stderr, "VM paused due to illegal instruction. " "Connect a debugger or switch to the monitor console " "to find out more.\n"); diff --git a/target/lm32/translate.c b/target/lm32/translate.c index b32feb7564..e2163809f2 100644 --- a/target/lm32/translate.c +++ b/target/lm32/translate.c @@ -1052,7 +1052,7 @@ static inline void decode(DisasContext *dc, uint32_t ir) void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) { CPULM32State *env = cs->env_ptr; - LM32CPU *cpu = lm32_env_get_cpu(env); + LM32CPU *cpu = env_archcpu(env); struct DisasContext ctx, *dc = &ctx; uint32_t pc_start; uint32_t page_start;