From nobody Tue Feb 10 13:37:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1559680657; cv=none; d=zoho.com; s=zohoarc; b=mPZ59v/5BpBHgoLMoCB984km4SHbV9IJpTcdBjmSZk4wYaFstUFXhF9yRX78P6QxEK+mfFrnKhe9gVgtkkKqCHIm4c3FQws9xa4Gt83m03kolXZwHClJ2Bw2R5qTaq3eiKnbQpBKzLJe83V5lwHLFc1POivjRKypujPO+1dYR0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559680657; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=TkngbE1sypwzNw5h/VQnw7E5NCmBkYtpc+Uhii5AlrQ=; b=GeMI5taR1F9Pdpo2a6iDnc9RSHQU/iDI3odfkzqbjT3jztgp+UGVXYzuygsYlK7rYJXmqXYLuGEGlQVnifOPSBFmqufibddoDYlOjh+0AaU6/78Idu0HFL5/FrTvI7Bo25cZc+mJN81r3mguEw0VtDwcJsDRWhHuq6aDZz8jPu8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559680657471561.2659427063378; Tue, 4 Jun 2019 13:37:37 -0700 (PDT) Received: from localhost ([127.0.0.1]:57624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYGBX-0003RN-B6 for importer@patchew.org; Tue, 04 Jun 2019 16:37:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYG8U-0001A2-IF for qemu-devel@nongnu.org; Tue, 04 Jun 2019 16:34:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYG8T-0004HB-BX for qemu-devel@nongnu.org; Tue, 04 Jun 2019 16:34:22 -0400 Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343]:44166) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hYG8T-0004Gi-6l for qemu-devel@nongnu.org; Tue, 04 Jun 2019 16:34:21 -0400 Received: by mail-ot1-x343.google.com with SMTP id b7so7252002otl.11 for ; Tue, 04 Jun 2019 13:34:20 -0700 (PDT) Received: from localhost.localdomain (200-56-192-86-cable.cybercable.net.mx. [200.56.192.86]) by smtp.gmail.com with ESMTPSA id h1sm5979901otj.78.2019.06.04.13.34.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jun 2019 13:34:19 -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=TkngbE1sypwzNw5h/VQnw7E5NCmBkYtpc+Uhii5AlrQ=; b=GJobI6GdOpbwAfuPyeym7Clk4GjX2Vx31FB2NEmuZkrJ4yQotula7TKIWsO1js+eLa RvTZcitUnsRXWZnDx1Q94lWUSffXSiTOrAs62PlKPVS7lQfHEd6Jk7kkgNo/7DpjCOrK T11ZJaibMe7d6g687A+HBCNFWpz2F1TdOn62ctDp/IbTL863fI5wleWcBt8fMdVabmMa g+ABxrQRFmC8fdKQXk6GQdZL/BabDw7Rv09lWHMDoabvmoWcnuTTg4ZuaFjcVslu91ox ekbYSXJaURvwExRIVN1iGhHYOD9QtnfOGv8X3m6Q3UgQheBm+GWo0L1aUNkkr6/U5FHp ZAsg== 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=TkngbE1sypwzNw5h/VQnw7E5NCmBkYtpc+Uhii5AlrQ=; b=ZzXUR8KkiXGoyqlk/ShpylAAbLT2oRpmYSNDTbmHKCq4Hk5TXO7RCgxzbB4DC0mdqp gQl/8kXuWmf2RL/SMBloSp9Emu0lUiP1s9A/N4gvwILR21FNgS02/hy/5a3fCVeOeSIz NFw8a+8H0Avpo7VyOV/x2+YXlEZgJiOzD7t5I1VK8VPTXg9mv/dIdBKnMwD4dK4o1ZBY hxxpz4h6CsyPUOWXkAvCcEohAw0vgVutzi7Z+5IzaLRE4N6wa950UEMR6GQMTji3zxUM EVFiL0h3y3CfNs8mNp7FvafDYB80L1vectO0TfjLgQGmOxrQCbm5qEHA9Kqs1cLDQMdT io9g== X-Gm-Message-State: APjAAAVskf6cetX93UQ0KReFi8Jvib5Pue/Au9y1REzCrag+fgt7S19I XI2EqHY1KIv7iNgqyK1bt9SuthdhEseCYw== X-Google-Smtp-Source: APXvYqz+ggfrvJU5LGP6ISY4hEOFbXI3NmR1elxd0XC5EiIqm7xgOCq19Mi48VADFpdAihet5ASwPg== X-Received: by 2002:a9d:5e83:: with SMTP id f3mr1884658otl.90.1559680459991; Tue, 04 Jun 2019 13:34:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 4 Jun 2019 15:33:27 -0500 Message-Id: <20190604203351.27778-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604203351.27778-1-richard.henderson@linaro.org> References: <20190604203351.27778-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::343 Subject: [Qemu-devel] [PATCH v4 15/39] 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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(-) 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; }; =20 -static inline LM32CPU *lm32_env_get_cpu(CPULM32State *env) -{ - return container_of(env, LM32CPU, env); -} - #define ENV_OFFSET offsetof(LM32CPU, env) =20 #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) =20 void lm32_breakpoint_insert(CPULM32State *env, int idx, target_ulong addre= ss) { - LM32CPU *cpu =3D 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]); } =20 void lm32_breakpoint_remove(CPULM32State *env, int idx) { - LM32CPU *cpu =3D lm32_env_get_cpu(env); - if (!env->cpu_breakpoint[idx]) { return; } =20 - 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] =3D NULL; } =20 void lm32_watchpoint_insert(CPULM32State *env, int idx, target_ulong addre= ss, lm32_wp_t wp_type) { - LM32CPU *cpu =3D lm32_env_get_cpu(env); int flags =3D 0; =20 switch (wp_type) { @@ -98,26 +93,24 @@ void lm32_watchpoint_insert(CPULM32State *env, int idx,= target_ulong address, } =20 if (flags !=3D 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]); } } =20 void lm32_watchpoint_remove(CPULM32State *env, int idx) { - LM32CPU *cpu =3D lm32_env_get_cpu(env); - if (!env->cpu_watchpoint[idx]) { return; } =20 - 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] =3D NULL; } =20 static bool check_watchpoints(CPULM32State *env) { - LM32CPU *cpu =3D lm32_env_get_cpu(env); + LM32CPU *cpu =3D env_archcpu(env); int i; =20 for (i =3D 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 =3D CPU(lm32_env_get_cpu(env)); + CPUState *cs =3D env_cpu(env); =20 cs->exception_index =3D index; cpu_loop_exit(cs); @@ -29,7 +29,7 @@ void HELPER(raise_exception)(CPULM32State *env, uint32_t = index) =20 void HELPER(hlt)(CPULM32State *env) { - CPUState *cs =3D CPU(lm32_env_get_cpu(env)); + CPUState *cs =3D env_cpu(env); =20 cs->halted =3D 1; cs->exception_index =3D EXCP_HLT; @@ -39,7 +39,7 @@ void HELPER(hlt)(CPULM32State *env) void HELPER(ill)(CPULM32State *env) { #ifndef CONFIG_USER_ONLY - CPUState *cs =3D CPU(lm32_env_get_cpu(env)); + CPUState *cs =3D 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_ins= ns) { CPULM32State *env =3D cs->env_ptr; - LM32CPU *cpu =3D lm32_env_get_cpu(env); + LM32CPU *cpu =3D env_archcpu(env); struct DisasContext ctx, *dc =3D &ctx; uint32_t pc_start; uint32_t page_start; --=20 2.17.1