From nobody Mon Feb 9 14:38:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150011322468847.37069984101595; Sat, 15 Jul 2017 03:07:04 -0700 (PDT) Received: from localhost ([::1]:41403 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dWJyZ-0000wS-Fo for importer@patchew.org; Sat, 15 Jul 2017 06:07:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dWJbw-0004Km-RW for qemu-devel@nongnu.org; Sat, 15 Jul 2017 05:43:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dWJbu-0003Tc-43 for qemu-devel@nongnu.org; Sat, 15 Jul 2017 05:43:40 -0400 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:33040) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dWJbt-0003TQ-UG for qemu-devel@nongnu.org; Sat, 15 Jul 2017 05:43:38 -0400 Received: by mail-pg0-x244.google.com with SMTP id 123so1668491pgd.0 for ; Sat, 15 Jul 2017 02:43:37 -0700 (PDT) Received: from bigtime.twiddle.net (rrcs-173-197-98-123.west.biz.rr.com. [173.197.98.123]) by smtp.gmail.com with ESMTPSA id c63sm27368589pfk.79.2017.07.15.02.43.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Jul 2017 02:43:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WhyxoCzEQSXdeoMa7zkoZRJPzYAuyILLZsb9qGEte4s=; b=gcwNvhtHIA5X0yvk83JwXdUDTRQMYwW+quQbEwwA2ILptTAJqIrj6ycsKMyeQnh8QJ 5LUz37Y4zMldKlNm8ir3u2jbn8xtBb4oK6nsd8YWw/tQYW4QgX4B9IfAWQlISdySqns9 ncUtb4J7wiX+3z5L0hN5fYhpUwBL0rPH9uYoOeQflfxeZbaeyV+nUUFkl+u+bM+nujwv igZZnQpUKKMrtx38caFramGKoRMACKQ0IvxOljoW7DEKGLfLzeteEDpjf/N1Kuq9nV77 fSbIA7fcu0gMC2I7UXA0s2uZKurHEVlIBYItCor3Hz08C9QLi2/3ww4wOU7W8AwmG8AQ U1rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=WhyxoCzEQSXdeoMa7zkoZRJPzYAuyILLZsb9qGEte4s=; b=QtwAKLZY2lkvUn7ds85lMiLM7O3VUJipPOIlkUCkgXmsP3i1aCuD4C89xeypfMbKm4 mrIvc5LEJ+oSoG7uXlCQKW5GE+YAhHQt3k16WFzkBVbo5s4xJuvL/XSl2PKb/KI1y9sc 0WJ/CGDQYlG4jvTz+CU18/v4kbJf6A6vUr8eFuMw5GDkfRbnTmslZVbRylMtktgW4l9N K6xAzOwa0ER0pzfNGOwbplVIvKMqHoJjt9U/ScGgDbN1E7NehDJw79xMlyyASR2Xxe4J vVljBx903rEKwrgptyCrnjvF+aAyZNa6TQrCP62JNzduAcatp/4S/J5C7f2F4retue/f 4Maw== X-Gm-Message-State: AIVw110ezh7NHoktsLk9ow49mFdZG5hpPktoAlhgjxQjJIgn93WmoXZr 8b8ePj4/hDkE8sFKX8I= X-Received: by 10.99.63.206 with SMTP id m197mr18956411pga.170.1500111816781; Sat, 15 Jul 2017 02:43:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 14 Jul 2017 23:42:32 -1000 Message-Id: <20170715094243.28371-24-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170715094243.28371-1-rth@twiddle.net> References: <20170715094243.28371-1-rth@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PATCH v14 23/34] target/arm: [tcg, a64] Port to breakpoint_check 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: , Cc: pbonzini@redhat.com, cota@braap.org, alex.bennee@linaro.org, vilanova@ac.upc.edu, crosthwaite.peter@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Llu=C3=ADs Vilanova Incrementally paves the way towards using the generic instruction translati= on loop. Signed-off-by: Llu=C3=ADs Vilanova Reviewed-by: Richard Henderson Message-Id: <150002461630.22386.14827196109258040543.stgit@frigg.lan> [rth: Use DISAS_TOO_MANY for "execute only one more" after bp.] Signed-off-by: Richard Henderson Reviewed-by: Emilio G. Cota --- target/arm/translate-a64.c | 49 +++++++++++++++++++++++++++++-------------= ---- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index dca5825..1541bf0 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -11257,6 +11257,30 @@ static void aarch64_tr_insn_start(DisasContextBase= *dcbase, CPUState *cpu) tcg_gen_insn_start(dc->pc, 0, 0); } =20 +static bool aarch64_tr_breakpoint_check(DisasContextBase *dcbase, CPUState= *cpu, + const CPUBreakpoint *bp) +{ + DisasContext *dc =3D container_of(dcbase, DisasContext, base); + + if (bp->flags & BP_CPU) { + gen_a64_set_pc_im(dc->pc); + gen_helper_check_breakpoints(cpu_env); + /* End the TB early; it likely won't be executed */ + dc->base.is_jmp =3D DISAS_TOO_MANY; + } else { + gen_exception_internal_insn(dc, 0, EXCP_DEBUG); + /* The address covered by the breakpoint must be + included in [tb->pc, tb->pc + tb->size) in order + to for it to be properly cleared -- thus we + increment the PC here so that the logic setting + tb->size below does the right thing. */ + dc->pc +=3D 4; + dc->base.is_jmp =3D DISAS_NORETURN; + } + + return true; +} + void gen_intermediate_code_a64(DisasContextBase *dcbase, CPUState *cs, TranslationBlock *tb) { @@ -11293,26 +11317,15 @@ void gen_intermediate_code_a64(DisasContextBase *= dcbase, CPUState *cs, if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { CPUBreakpoint *bp; QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { - if (bp->pc =3D=3D dc->pc) { - if (bp->flags & BP_CPU) { - gen_a64_set_pc_im(dc->pc); - gen_helper_check_breakpoints(cpu_env); - /* End the TB early; it likely won't be executed */ - dc->base.is_jmp =3D DISAS_UPDATE; - } else { - gen_exception_internal_insn(dc, 0, EXCP_DEBUG); - dc->base.is_jmp =3D DISAS_NORETURN; - /* The address covered by the breakpoint must be - included in [dc->base.tb->pc, dc->base.tb->pc += dc->base.tb->size) in order - to for it to be properly cleared -- thus we - increment the PC here so that the logic setting - dc->base.tb->size below does the right thing. = */ - dc->pc +=3D 4; - goto done_generating; + if (bp->pc =3D=3D dc->base.pc_next) { + if (aarch64_tr_breakpoint_check(&dc->base, cs, bp)) { + break; } - break; } } + if (dc->base.is_jmp > DISAS_TOO_MANY) { + break; + } } =20 if (dc->base.num_insns =3D=3D max_insns && (dc->base.tb->cflags & = CF_LAST_IO)) { @@ -11383,6 +11396,7 @@ void gen_intermediate_code_a64(DisasContextBase *dc= base, CPUState *cs, } else { switch (dc->base.is_jmp) { case DISAS_NEXT: + case DISAS_TOO_MANY: gen_goto_tb(dc, 1, dc->pc); break; default: @@ -11420,7 +11434,6 @@ void gen_intermediate_code_a64(DisasContextBase *dc= base, CPUState *cs, } } =20 -done_generating: gen_tb_end(tb, dc->base.num_insns); =20 #ifdef DEBUG_DISAS --=20 2.9.4