From patchwork Sat Mar 23 19:09:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160983 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2193531jan; Sat, 23 Mar 2019 12:41:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLaQg8Ud+FRhnrEl460c13VRElgbK9oyARyQ6iszh80CnKKfqDhZBqRVIfIBv/zuuFW4Nb X-Received: by 2002:a81:7357:: with SMTP id o84mr14285164ywc.317.1553370067595; Sat, 23 Mar 2019 12:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553370067; cv=none; d=google.com; s=arc-20160816; b=LLFt2666wEBV5p7Ulq5xobuP5jjskJiMhRh7GSnrVcVupSKqFm7ew1JRyDlct7ofq7 Gde/TNVJpxVjbTnKrwMHIrmmKHIOBgmfs98bP3CqMEVta25o3q8O43JWhyWenv1H3LXU GaHA5uRIup1cBEUKmEDgHMsRAh8foLqAQ5vdlMC+sYS0+7/PuHJu5W+H5Oa1ZaOjsBST JL8RqzN7NlhNM9Wj/dM5wvI+KfIKUSYajYrI95M6t00ZBCAvPP2yeQ84tNgeUYEzSudg BfsIJ3J7EYii2/d8oAHmcbFTBzavvPDc+8UMG0mgOxCSYTdh9u+tGpCk/6xZXU5pG8uC 0o2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=fq9koqb5i3Cy/GtsZJmKo47G6cKJtoa0NkkL8LsWj7g=; b=yg8BWlDZyrnif6HzeKCJTUSmP4JfpX2FfyYOIi80s8uZxtlD5GLVoJhXmm8v2atP87 s2INKcyxVV71k3lmKV9yO9PISWJNIiCCqqDhnD1fS2nN2cie4kCcfkya+lRtG5tM9vN8 B1sunKa+V0CSutuDKdQgD8A8iS1FImLEImisYaW26j7PTF3pvAW/rQFx++8ajlpuqlXD N8qcXcct8kHF7EVFvXJgoH8cvn6ITMdKw3qIHn/ZrpzaSr4z6ty9x08/fZnWHf3Fs7YI SupNct0riFCXhNN/K82NWPn6siL7AT0qi8kSiHBVgeLJV4Xt58lf/sV1fqZb7g3x7ESr BMiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XZvvE3mz; 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 k67si6761263ybb.231.2019.03.23.12.41.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 23 Mar 2019 12:41:07 -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=XZvvE3mz; 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 ([127.0.0.1]:47187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7mVv-0005Oi-2i for patch@linaro.org; Sat, 23 Mar 2019 15:41:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7mG4-0008Km-DG for qemu-devel@nongnu.org; Sat, 23 Mar 2019 15:24:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h7m1f-0006vw-Rr for qemu-devel@nongnu.org; Sat, 23 Mar 2019 15:09:53 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:37591) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h7m1a-0006sf-B5 for qemu-devel@nongnu.org; Sat, 23 Mar 2019 15:09:47 -0400 Received: by mail-pg1-x544.google.com with SMTP id q206so3709063pgq.4 for ; Sat, 23 Mar 2019 12:09:46 -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=XZvvE3mzWoDCBYpQIL0NpGLZP24F5nuPM1m8nZ17sMNQ0ceup16gzarjjQP5HPJR+7 3CL9DexQDP0s1Iw+iqs339VtQXKdZa0zm6kJjU9/SS8pVt5RZE8g28k+j7CUk1F3H6KJ CmcU/c1x5UDEnHYm5vnEtWTBeezY3tOOMCEBUZEcLQo6oQ0GDvLEm9YOQ7IbjLs9jlnD XsRJ9icGpZb3H1i+2D8eTWYLICG1gdOHDRgxBABxxxEVx8Grop4QmlsTQ1g73WUIfBh4 cJFJde0MQclt5VOnGUv5D2C0Nh+taEQnxTougtpUVhA/+usAyarcoB7iUxu/zWbAV7MR jIBA== 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=oVGd05q8N3AmyroyrjZOQxSDI55jU0doxY6N3u3/tZLT9OV7dJxuSe0Dx2Lm/Z6OMa WhHPhM07BvpQGK0TYoqN1giue92otEgs7hxcHIcuCP5slN5bgjl5pDjm07lycavBOG7A zUR5/19fsL+QsO82yLQCD5a4Z0vEtM864jrgS/hxK5JODH+ioesmjRmUauVEnazdE2AA 8EPREGIKf0OQbSXWGvj3x+rRZY0hkxIHBM+Up1F+ubTi+V6h4e6NDuMJP3PlCUds/q43 GmsiKK3hcpmUu6VmVv+fR4OZjjkq7gOxFaoDuu8Fl2MEpX7X5lNFQ8UR3aKxczUBYDLY AvQw== X-Gm-Message-State: APjAAAU627MyGY7hY38+EsMmw5NY9SDg62d9OG41vS0B30NxCBouXuNh JLsz9ce8+pojGtyYBu0cOHE5FlktK2E= X-Received: by 2002:a63:7154:: with SMTP id b20mr8723072pgn.359.1553368185036; Sat, 23 Mar 2019 12:09:45 -0700 (PDT) Received: from localhost.localdomain (174-21-5-201.tukw.qwest.net. [174.21.5.201]) by smtp.gmail.com with ESMTPSA id h184sm25990703pfc.78.2019.03.23.12.09.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Mar 2019 12:09:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 23 Mar 2019 12:09:03 -0700 Message-Id: <20190323190925.21324-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190323190925.21324-1-richard.henderson@linaro.org> References: <20190323190925.21324-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::544 Subject: [Qemu-devel] [PATCH 13/35] 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 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;