From patchwork Wed Jul 21 06:41:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 483247 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5908119jao; Tue, 20 Jul 2021 23:51:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJrMYQo4bMuG3xns/0+TepLvEUUcCspBcj6ynuMpEwkPUTHhANEM3RQ/ymei+7xDP+ljZQ X-Received: by 2002:a05:620a:54c:: with SMTP id o12mr24635998qko.88.1626850275000; Tue, 20 Jul 2021 23:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626850274; cv=none; d=google.com; s=arc-20160816; b=q3eQ9vpUjp237vmLJC0MIZDGWHDDyVUenzytGuXN+kJJtdf0Lm5WNzcH2ljlqsUI1X hGWxHS5ahniBJ5t0+MSMXTJ0KAlfQ7dJOnz16ePoprhhxjZyuuhbGVRa4dd0d3oo/0sQ DodUtKHO9cg0lEyel9MDBn0pwVuypoNYOvKquTu9i7W1m/4PPLQiR/qi54kwou2jxVUq fC87VErd/bF9IRfU+NgAAfcC6HP371cH9jB1top1EENotP8WrYm9bG0FoXWRn0utO1j8 h6OpN90CSAqFS8NtDAV0VyhysMJfrlZM7yoE28Y/klQFExIR6TPert56FS8WQ7sKg/Qh VopQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=hdcHXTBndQJ60bOp5yOpBpWN/uojHbOe/orD+nT3HGI=; b=f03/8ns+BIHnA2TcXAGmFmRgrvqaSmGV7uPPHYMNgfDGdFvnSW8ZowC7SUZJIxl2si u31ztrz5vBh14oKOksti/4KXS1t+hYV5ii4HwAvUdH1+8om/mzZkkpH2N4PsKXn+dk7Q iHFs1a1rIQKUw2vIFNvgahR4lDjvJ7u3EYVVkcZXdVQVjYvVAoO1XnjoZ8fvL1Dgy8c9 IcPqJZSMY3WuEnYHVVH0U57jwd8/Jc1eQoxHC+wXMQ6EW1UK2oLcpGgvcoSYGt80WRsA Q/PewrRjz9bQnTlfdhOMwNK1gmkKvEi2Qz4hf1LqoMjHpTeiTqXNBNVVKc3R5FZoiq3U Q+MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pXps9aDu; 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 m3si17985664qkd.94.2021.07.20.23.51.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Jul 2021 23:51:14 -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=pXps9aDu; 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]:35638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m664Y-0000iz-9t for patch@linaro.org; Wed, 21 Jul 2021 02:51:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m65vj-00054u-F4 for qemu-devel@nongnu.org; Wed, 21 Jul 2021 02:42:07 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:39926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m65vh-0005Q1-QA for qemu-devel@nongnu.org; Wed, 21 Jul 2021 02:42:07 -0400 Received: by mail-pj1-x102d.google.com with SMTP id p14-20020a17090ad30eb02901731c776526so3409786pju.4 for ; Tue, 20 Jul 2021 23:42:05 -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:mime-version :content-transfer-encoding; bh=hdcHXTBndQJ60bOp5yOpBpWN/uojHbOe/orD+nT3HGI=; b=pXps9aDuEWzbbhgK3IRRjZk8SRlnocDTC9MgLErvLxRVEtLwMMOe5aK38OjcpZWzeU i7HKW1e5j73085gkdAaHCOp6Zzji0Vznmf/l4rnd/9CbrHgpcr02VJGsdcKhTZVt+JZI JeKy0AbgfCg+OQS8mY/53FoYuhv4P7K9/V/lTTm6t2PcdIA1DBGqNx4MEhzFAjYb8QtH 1KiJDXQO89O/jF78Nhua13qxhl0bvKnlo4R17QCO3J4VxLwoVIIuYdQfW3ZC151T2n5Q KvwLkbaUKqxPLMjfyFmzSybYiBhqCztDRVz5QEq+5tMBd2bfx9XcRRc1VkL1tovbkSE7 uiCg== 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:mime-version:content-transfer-encoding; bh=hdcHXTBndQJ60bOp5yOpBpWN/uojHbOe/orD+nT3HGI=; b=tJf6uGVXg4j/JFRYh9QDWfKz6wnAR+PWSmqHccJOInr2QcKnqfTKHCxGLNGkDNAmH6 7YVyG2RIp9Fe9ra6wHWLxKSxUb+cMaqVwLi0ZoYX46+tO7i4Ola/pi89KNKJZU1DZegI 1rDp1ZYNc64PRD4720xXWFjXghgBdNgNYv5nDQPETHLa6Uqk0HzwWGdbsWU1qcKOWP3O hEcNNA9iMKaISyV8rcm5KzT4Lbl8nobDuUtHxp/HlAkNOXG+UM5YWQbWMtL2vV+UuUDb MHw0z5AO2OUE4ZbZlWH+EjXnhdUE2XcSgMBPSoLWFFCSA0SzmzO0fK0KUn1IU5uDH25O ZZ9w== X-Gm-Message-State: AOAM530Pl6WEpGrEWDt2FVKhjJ0+/LuI39GM3Y305hkcPdQj4i7r7uIp UuMhF91TbMJ+1QtN5kTEvIrH4f/CPRrFYw== X-Received: by 2002:a17:902:b941:b029:12b:81c3:6919 with SMTP id h1-20020a170902b941b029012b81c36919mr14184101pls.7.1626849724515; Tue, 20 Jul 2021 23:42:04 -0700 (PDT) Received: from localhost.localdomain (204-210-126-223.res.spectrum.com. [204.210.126.223]) by smtp.gmail.com with ESMTPSA id q17sm21146132pjd.42.2021.07.20.23.42.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 23:42:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 06/23] target/arm: Drop checks for singlestep_enabled Date: Tue, 20 Jul 2021 20:41:38 -1000 Message-Id: <20210721064155.645508-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210721064155.645508-1-richard.henderson@linaro.org> References: <20210721064155.645508-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" GDB single-stepping is now handled generically. Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 10 ++-------- target/arm/translate.c | 36 ++++++------------------------------ 2 files changed, 8 insertions(+), 38 deletions(-) -- 2.25.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 422e2ac0c9..a7da3c5d45 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -404,8 +404,6 @@ static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest) gen_a64_set_pc_im(dest); if (s->ss_active) { gen_step_complete_exception(s); - } else if (s->base.singlestep_enabled) { - gen_exception_internal(EXCP_DEBUG); } else { tcg_gen_lookup_and_goto_ptr(); s->base.is_jmp = DISAS_NORETURN; @@ -14874,7 +14872,7 @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) { DisasContext *dc = container_of(dcbase, DisasContext, base); - if (unlikely(dc->base.singlestep_enabled || dc->ss_active)) { + if (unlikely(dc->ss_active)) { /* Note that this means single stepping WFI doesn't halt the CPU. * For conditional branch insns this is harmless unreachable code as * gen_goto_tb() has already handled emitting the debug exception @@ -14886,11 +14884,7 @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) /* fall through */ case DISAS_EXIT: case DISAS_JUMP: - if (dc->base.singlestep_enabled) { - gen_exception_internal(EXCP_DEBUG); - } else { - gen_step_complete_exception(dc); - } + gen_step_complete_exception(dc); break; case DISAS_NORETURN: break; diff --git a/target/arm/translate.c b/target/arm/translate.c index 351afa43a2..4fb2b846a3 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -338,7 +338,7 @@ static void gen_exception_internal(int excp) tcg_temp_free_i32(tcg_excp); } -static void gen_step_complete_exception(DisasContext *s) +static void gen_singlestep_exception(DisasContext *s) { /* We just completed step of an insn. Move from Active-not-pending * to Active-pending, and then also take the swstep exception. @@ -354,30 +354,6 @@ static void gen_step_complete_exception(DisasContext *s) s->base.is_jmp = DISAS_NORETURN; } -static void gen_singlestep_exception(DisasContext *s) -{ - /* Generate the right kind of exception for singlestep, which is - * either the architectural singlestep or EXCP_DEBUG for QEMU's - * gdb singlestepping. - */ - if (s->ss_active) { - gen_step_complete_exception(s); - } else { - gen_exception_internal(EXCP_DEBUG); - } -} - -static inline bool is_singlestepping(DisasContext *s) -{ - /* Return true if we are singlestepping either because of - * architectural singlestep or QEMU gdbstub singlestep. This does - * not include the command line '-singlestep' mode which is rather - * misnamed as it only means "one instruction per TB" and doesn't - * affect the code we generate. - */ - return s->base.singlestep_enabled || s->ss_active; -} - void clear_eci_state(DisasContext *s) { /* @@ -834,7 +810,7 @@ static inline void gen_bx_excret_final_code(DisasContext *s) /* Is the new PC value in the magic range indicating exception return? */ tcg_gen_brcondi_i32(TCG_COND_GEU, cpu_R[15], min_magic, excret_label); /* No: end the TB as we would for a DISAS_JMP */ - if (is_singlestepping(s)) { + if (s->ss_active) { gen_singlestep_exception(s); } else { tcg_gen_exit_tb(NULL, 0); @@ -2603,7 +2579,7 @@ static void gen_goto_tb(DisasContext *s, int n, target_ulong dest) /* Jump, specifying which TB number to use if we gen_goto_tb() */ static inline void gen_jmp_tb(DisasContext *s, uint32_t dest, int tbno) { - if (unlikely(is_singlestepping(s))) { + if (unlikely(s->ss_active)) { /* An indirect jump so that we still trigger the debug exception. */ gen_set_pc_im(s, dest); s->base.is_jmp = DISAS_JUMP; @@ -9360,7 +9336,7 @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) dc->page_start = dc->base.pc_first & TARGET_PAGE_MASK; /* If architectural single step active, limit to 1. */ - if (is_singlestepping(dc)) { + if (dc->ss_active) { dc->base.max_insns = 1; } @@ -9684,7 +9660,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) * insn codepath itself. */ gen_bx_excret_final_code(dc); - } else if (unlikely(is_singlestepping(dc))) { + } else if (unlikely(dc->ss_active)) { /* Unconditional and "condition passed" instruction codepath. */ switch (dc->base.is_jmp) { case DISAS_SWI: @@ -9779,7 +9755,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) /* "Condition failed" instruction codepath for the branch/trap insn */ gen_set_label(dc->condlabel); gen_set_condexec(dc); - if (unlikely(is_singlestepping(dc))) { + if (unlikely(dc->ss_active)) { gen_set_pc_im(dc, dc->base.pc_next); gen_singlestep_exception(dc); } else {