From patchwork Sat Oct 16 18:15:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 515886 Delivered-To: patch@linaro.org Received: by 2002:ac0:cd8c:0:0:0:0:0 with SMTP id d12csp137204imp; Sat, 16 Oct 2021 11:27:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKz4NiZ3nQZIZcHYYU9cqnEdYL/UDbcDd3fVXmyEAGwvaj+Gzk3XDu6TwbPQ5jzqT2kaEl X-Received: by 2002:a25:b447:: with SMTP id c7mr20148280ybg.214.1634408863738; Sat, 16 Oct 2021 11:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634408863; cv=none; d=google.com; s=arc-20160816; b=W4kkd/YPoUMilq7wdPZ024ZbQ2aK1gaUUN0UrS0Y7E+1vYWE7vq0hcZCH86I8kIpEH Q3Ziw6juIyikgalRpBSok7tlfD73NcNI3c7fHteDSIMUdw/1TIYZPLeoPHdX2TRTpQc9 b0HRt4GXsSGNwyWgA8zQro0A18XQb7VlGi3MED0GdcZtTAzOgX8MtEKCtQLTr/cLu1AT tFgQ47ElOmTjLd5APMXe9KrXYPOg5iDSBzZTIB6P+lC3hYGgVlbUoHBVUJ5lN5DjcIKC g63sCJJcc4JiBEUozbIsPo1jfwCvH98h6M82femap2YY+R8ZvaPefFYLPUEcnYz0a8TX 1LIw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=c5EhHQQDifSPFgUkD65aCkDjg20V3dEMIS1pmXt2CpQ=; b=pIYK9iQAnLCu9tTxi2uY1Pg3fniEmKYMUErSc9vF2wA9ixaE9bcrHrhrTgw1aNXKKU bYHsQs1siCIEGhj+woIvu5glPfBrN3pC9SDImYlGPgUYycMgg3VfeBscKKisBCLTLCJx vUU/kTRSFlVmxXbh9J9Fk0ceE7GGZ4D0rP+qPPCRG0gdSaZIsORofIZBoWjSuARfwaLz tvXiZTBejM29387bzzGpksxlOG8gRyKN0m8ckyg5gdEhNNAnugl5SS4sq6U4sVs1/RYg iklT2qyau0Fi2hWCpY2fnYGkKKP+OPBTlEuUyOYt7EmtuMuIZP+GZCKgJgj/jKn25KeW PLEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lDSC4dey; 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=pass (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 z9si12105491ybn.126.2021.10.16.11.27.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Oct 2021 11:27:43 -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=pass header.i=@linaro.org header.s=google header.b=lDSC4dey; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mboPH-0000Lg-3h for patch@linaro.org; Sat, 16 Oct 2021 14:27:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mboDc-0008OL-Mz for qemu-devel@nongnu.org; Sat, 16 Oct 2021 14:15:41 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:39884) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mboDX-00025J-E9 for qemu-devel@nongnu.org; Sat, 16 Oct 2021 14:15:40 -0400 Received: by mail-pj1-x1029.google.com with SMTP id ls18-20020a17090b351200b001a00250584aso11653913pjb.4 for ; Sat, 16 Oct 2021 11:15:33 -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 :mime-version:content-transfer-encoding; bh=c5EhHQQDifSPFgUkD65aCkDjg20V3dEMIS1pmXt2CpQ=; b=lDSC4deyx0uyu1gpqEqS0tOuiUWZ/iSmL1Z55oBD6wvyKNWgSiDSD3EIgiL9SCTa1Q lIcPb60BXg3/C6ALNK08pf6SFBdWQDYRX0lFoFv2zV5yzNkRRyQdSjgr3AYnGqrl2aDx Mwd4EpurkIG0erMJOHmsh6RyJM6M1Hp1gSqUmJpU1WTmlrzz1MUk3+KftBgzIZqAuKg8 yez9QT/S+8F4XhNjxQdgHv6EEjkyEmSPjR1agOOeKIiZ9B//LUf/ZaBmsu2wYfAkiwpG kvu9FA5A2muBidASfv/e4LAB0dUZlJeUNuh6sPnVSFVV/1OwSK5KG0ry3/XbXb8lcLIm dCmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c5EhHQQDifSPFgUkD65aCkDjg20V3dEMIS1pmXt2CpQ=; b=BnRZTOT5dGD4DiJNRVORPUeEg7jkUuSzZqPChEEXd+cjQ+JDqGtApqpHqcFnQWp2gD cqq2i6gNAGgdYiER1KVK/kvuXNepFuU4Hjf32tKORO9pWoMaOOsNtL5pXsRnKxmR5S4l dKPkBsM15rq+2yiHbpz7cRxfiKlRmDG+FAc5/cgS2hrxfipqZ/5cvCvbUhYYg/WdaezA juelF0GkkRNtt7zItNQCgAUfKlsxOqSTx12F/wN2RZ6SzAD7EqrM/jT6rWULizdiC/9f JIkA83zQeplintAr12PpOa6nvtXtDikmr/1A2c4pFl/8zC2KH92MOEfrgaiizQNmSCAP l80g== X-Gm-Message-State: AOAM533M6uYgrpc12LPIfdMhMvZAHLXwXvBlp32VC0FQkJe9yt6RsRSV tiPtx8eXaccEnJW6wMJ3uD4c0sTGwyHC9g== X-Received: by 2002:a17:90a:51:: with SMTP id 17mr21926206pjb.185.1634408132218; Sat, 16 Oct 2021 11:15:32 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id ob5sm5075097pjb.2.2021.10.16.11.15.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 11:15:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 18/24] target/riscv: Remove exit_tb and lookup_and_goto_ptr Date: Sat, 16 Oct 2021 11:15:08 -0700 Message-Id: <20211016181514.3165661-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211016181514.3165661-1-richard.henderson@linaro.org> References: <20211016181514.3165661-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Alistair Francis Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" GDB single-stepping is now handled generically, which means we don't need to do anything in the wrappers. Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/translate.c | 27 +------------------ .../riscv/insn_trans/trans_privileged.c.inc | 4 +-- target/riscv/insn_trans/trans_rvi.c.inc | 8 +++--- target/riscv/insn_trans/trans_rvv.c.inc | 2 +- 4 files changed, 7 insertions(+), 34 deletions(-) -- 2.25.1 diff --git a/target/riscv/translate.c b/target/riscv/translate.c index d2442f0cf5..6d7fbca1fa 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -149,31 +149,6 @@ static void generate_exception_mtval(DisasContext *ctx, int excp) ctx->base.is_jmp = DISAS_NORETURN; } -static void gen_exception_debug(void) -{ - gen_helper_raise_exception(cpu_env, tcg_constant_i32(EXCP_DEBUG)); -} - -/* Wrapper around tcg_gen_exit_tb that handles single stepping */ -static void exit_tb(DisasContext *ctx) -{ - if (ctx->base.singlestep_enabled) { - gen_exception_debug(); - } else { - tcg_gen_exit_tb(NULL, 0); - } -} - -/* Wrapper around tcg_gen_lookup_and_goto_ptr that handles single stepping */ -static void lookup_and_goto_ptr(DisasContext *ctx) -{ - if (ctx->base.singlestep_enabled) { - gen_exception_debug(); - } else { - tcg_gen_lookup_and_goto_ptr(); - } -} - static void gen_exception_illegal(DisasContext *ctx) { generate_exception(ctx, RISCV_EXCP_ILLEGAL_INST); @@ -192,7 +167,7 @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) tcg_gen_exit_tb(ctx->base.tb, n); } else { tcg_gen_movi_tl(cpu_pc, dest); - lookup_and_goto_ptr(ctx); + tcg_gen_lookup_and_goto_ptr(); } } diff --git a/target/riscv/insn_trans/trans_privileged.c.inc b/target/riscv/insn_trans/trans_privileged.c.inc index a7afcb15ce..75c6ef80a6 100644 --- a/target/riscv/insn_trans/trans_privileged.c.inc +++ b/target/riscv/insn_trans/trans_privileged.c.inc @@ -78,7 +78,7 @@ static bool trans_sret(DisasContext *ctx, arg_sret *a) if (has_ext(ctx, RVS)) { gen_helper_sret(cpu_pc, cpu_env, cpu_pc); - exit_tb(ctx); /* no chaining */ + tcg_gen_exit_tb(NULL, 0); /* no chaining */ ctx->base.is_jmp = DISAS_NORETURN; } else { return false; @@ -94,7 +94,7 @@ static bool trans_mret(DisasContext *ctx, arg_mret *a) #ifndef CONFIG_USER_ONLY tcg_gen_movi_tl(cpu_pc, ctx->base.pc_next); gen_helper_mret(cpu_pc, cpu_env, cpu_pc); - exit_tb(ctx); /* no chaining */ + tcg_gen_exit_tb(NULL, 0); /* no chaining */ ctx->base.is_jmp = DISAS_NORETURN; return true; #else diff --git a/target/riscv/insn_trans/trans_rvi.c.inc b/target/riscv/insn_trans/trans_rvi.c.inc index 920ae0edb3..a6a57c94bb 100644 --- a/target/riscv/insn_trans/trans_rvi.c.inc +++ b/target/riscv/insn_trans/trans_rvi.c.inc @@ -71,9 +71,7 @@ static bool trans_jalr(DisasContext *ctx, arg_jalr *a) if (a->rd != 0) { tcg_gen_movi_tl(cpu_gpr[a->rd], ctx->pc_succ_insn); } - - /* No chaining with JALR. */ - lookup_and_goto_ptr(ctx); + tcg_gen_lookup_and_goto_ptr(); if (misaligned) { gen_set_label(misaligned); @@ -421,7 +419,7 @@ static bool trans_fence_i(DisasContext *ctx, arg_fence_i *a) * however we need to end the translation block */ tcg_gen_movi_tl(cpu_pc, ctx->pc_succ_insn); - exit_tb(ctx); + tcg_gen_exit_tb(NULL, 0); ctx->base.is_jmp = DISAS_NORETURN; return true; } @@ -430,7 +428,7 @@ static bool do_csr_post(DisasContext *ctx) { /* We may have changed important cpu state -- exit to main loop. */ tcg_gen_movi_tl(cpu_pc, ctx->pc_succ_insn); - exit_tb(ctx); + tcg_gen_exit_tb(NULL, 0); ctx->base.is_jmp = DISAS_NORETURN; return true; } diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc index fa451938f1..081a5ca34d 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -41,7 +41,7 @@ static bool trans_vsetvl(DisasContext *ctx, arg_vsetvl *a) gen_set_gpr(ctx, a->rd, dst); tcg_gen_movi_tl(cpu_pc, ctx->pc_succ_insn); - lookup_and_goto_ptr(ctx); + tcg_gen_lookup_and_goto_ptr(); ctx->base.is_jmp = DISAS_NORETURN; return true; }