From patchwork Mon Jun 10 02:01:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 166251 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp466105ilk; Sun, 9 Jun 2019 19:13:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGnle0G0rUA+Y3s62cQtXwwm7CD7h8VsfJXcNTwTZqZCnuecVTG4qFhRKDlz5eTQuMV25w X-Received: by 2002:a37:aa0d:: with SMTP id t13mr53591398qke.167.1560132826390; Sun, 09 Jun 2019 19:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560132826; cv=none; d=google.com; s=arc-20160816; b=f8biwwczeT57gFRyH700GDQA7WGewl4eHvlWZVS6npOF1G2kM3XZCOi/v6ZrCrR0gD G6fFXQz4XHIOJkJPZGrCNmq9C15CivUbxsr+6R8lRgAijnpi9sSmH0hyuEEgFy4nhyVe XDJeT2u3z9faFvvqbzC74C7PRPfh8jCNWalb6+36aikdw6CvsXu+pqkGSqGPSONsLdyD B3auYS3Ojwdf65gXn1tDajJxj8CQMRpqLqocRcQiYYns0P205+TEDZcDB8QJft8nZEK0 rWLQm06RhP8Zl3in9D8eLgUbD5vJ5wx77VbTIoQArsenNWcbc3ZtHyzgq8j7DYN3J+NY gcGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=TkngbE1sypwzNw5h/VQnw7E5NCmBkYtpc+Uhii5AlrQ=; b=ZccKSq9r4gIC7Pbd/X6yVXPOz1n8IHdjM/SAnzuhcmBizw7vSYF5OSFIjOsq5wH6zN Q76Jg86mK+SYByutW3is79io/H9JmCs7dKFT/gp594GR1X+ai9ocO1CeDbV9rtsbOBph eVKs2KwgDp5MJ5Ok0pnaYCoe0Fuv3FDlmZAbrBViQNNYmPE2UvK1lWYEtZAuWVp5u3z/ MeAYqt1kS+SiV+p+obHrorJPGX1Vi4Y80O33n+0cpPoZHkS+uu8MT0zR4l9MQrDKgy5g xEVbGs+YSk7MZ9EwX0O8hQnW/VABTv6XjFFNNlBrYU5V8i16e+nRj8Jl824baVSMzR4u TdwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XwIZ90hB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e7si6231300qtq.16.2019.06.09.19.13.46 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jun 2019 19:13:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XwIZ90hB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39666 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ha9of-0006rB-Rs for patch@linaro.org; Sun, 09 Jun 2019 22:13:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53051) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ha9dx-00062L-K8 for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ha9dw-0001it-7w for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:41 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:33931) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ha9dw-0001iS-15 for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:40 -0400 Received: by mail-pl1-x62e.google.com with SMTP id i2so2995222plt.1 for ; Sun, 09 Jun 2019 19:02:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TkngbE1sypwzNw5h/VQnw7E5NCmBkYtpc+Uhii5AlrQ=; b=XwIZ90hB2CIGWSqQcEgNJC4CmbYZApVA+zixo4kT+7ltge4skV/DmOeG61fhd52mn0 qnXG1fB5s1rUDljJEmh4Yixngl4yuqwDBAZCBv8fuw8Njco8HXN5024VL52jscZrPg4/ n2otznL32FwvVhJgwHJQKvI9VtgoO6m1gvlPo5xcT+0zwFSEMWZQ5clHn95QmkVxfh8Z /O8V0mSgp9vbOe+pZBfWFj3iiVZ/h8WLuQi3mDn5zuzj0mIW4/0iQLDSw7MXlEcJ+DUb 7soVGz6diYtu0LxfVdchRzzw29vlt3TlIQymqzNDF52D6/m9tcZ0aBZEQr78zNOupNi/ Obfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TkngbE1sypwzNw5h/VQnw7E5NCmBkYtpc+Uhii5AlrQ=; b=ArgAsJ8e7xOQhdMu10EH2w1kwhMlw5DhGSO7+YGlfvvjl72Vzkpda2O+a2vh6irbx4 oM1QTK/lfWNOk0M+cImaLm+tyn7ubnYbWFGYRwcSjcZtOZTXJfCoiFZE0hicWfV6hX67 EQ/ySlwbfnnaHXneI2dFBj9KdZYGkNdH1nYxneQOENVIaBz+HNYG1Itq3M7wWsY7vfpo AX6ga2mRqfdEAVV0BfrDJQbU4S4bNHDaMNWZu22C7Xh8g6PM7ZR3bqfOya+Xq+Q7EC8h Ofqwr10JQCPbhQ4Rp+JekLYtPnFCqCiooirsoU8mTKJDAqwlBFRMnBwjH1DWYx60R5h4 Me5g== X-Gm-Message-State: APjAAAUBk2p43Hz0R/BkUirCue0AZbU4JiZN1C9ImuB70whsILeSja9o JPOPeBCFqYJZraqS8TnJs0NG9whxM1k= X-Received: by 2002:a17:902:26c:: with SMTP id 99mr69928531plc.215.1560132158733; Sun, 09 Jun 2019 19:02:38 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id l63sm9749013pfl.181.2019.06.09.19.02.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Jun 2019 19:02:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 9 Jun 2019 19:01:54 -0700 Message-Id: <20190610020218.9228-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610020218.9228-1-richard.henderson@linaro.org> References: <20190610020218.9228-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::62e Subject: [Qemu-devel] [PULL 15/39] target/lm32: Use env_cpu, env_archcpu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Cleanup in the boilerplate that each target must define. Replace lm32_env_get_cpu with env_archcpu. The combination CPU(lm32_env_get_cpu) should have used ENV_GET_CPU to begin; use env_cpu now. Reviewed-by: Alistair Francis Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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(-) -- 2.17.1 diff --git a/target/lm32/cpu.h b/target/lm32/cpu.h index ad9452eb9f..7fb65fb4b6 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 8cd4840052..9f3b107474 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 be12b11b02..d184550a7b 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 f0e0e7058e..b9f2f2c4a7 100644 --- a/target/lm32/translate.c +++ b/target/lm32/translate.c @@ -1053,7 +1053,7 @@ static inline void decode(DisasContext *dc, uint32_t ir) void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) { 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;