From: "Emilio G. Cota" <cota@braap.org>
To: "Lluís Vilanova" <vilanova@ac.upc.edu>
Cc: qemu-devel@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
"Richard Henderson" <rth@twiddle.net>,
"Peter Crosthwaite" <crosthwaite.peter@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v11 09/29] target/i386: [tcg] Refactor breakpoint_check
Date: Thu, 29 Jun 2017 20:24:54 -0400 [thread overview]
Message-ID: <20170630002454.GI13979@flamenco> (raw)
In-Reply-To: <149865437871.17063.9119703949695421203.stgit@frigg.lan>
On Wed, Jun 28, 2017 at 15:52:58 +0300, Lluís Vilanova wrote:
> Incrementally paves the way towards using the generic instruction translation
> loop.
>
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
> target/i386/translate.c | 59 ++++++++++++++++++++++++++++++++++++++---------
> 1 file changed, 48 insertions(+), 11 deletions(-)
>
> diff --git a/target/i386/translate.c b/target/i386/translate.c
> index ad57be2928..3eee348de7 100644
> --- a/target/i386/translate.c
> +++ b/target/i386/translate.c
> @@ -18,6 +18,7 @@
> */
> #include "qemu/osdep.h"
>
> +#include "qemu/error-report.h"
I can't find why this one is included here.
> #include "qemu/host-utils.h"
> #include "cpu.h"
> #include "disas/disas.h"
> @@ -8458,6 +8459,25 @@ static void i386_trblock_insn_start(DisasContextBase *dcbase, CPUState *cpu)
> tcg_gen_insn_start(dc->base.pc_next, dc->cc_op);
> }
>
> +static BreakpointCheckType i386_trblock_breakpoint_check(
> + DisasContextBase *dcbase, CPUState *cpu, const CPUBreakpoint *bp)
> +{
> + DisasContext *dc = container_of(dcbase, DisasContext, base);
> + /* If RF is set, suppress an internally generated breakpoint. */
> + int flags = dc->base.tb->flags & HF_RF_MASK ? BP_GDB : BP_ANY;
> + if (bp->flags & flags) {
> + gen_debug(dc, dc->base.pc_next - dc->cs_base);
> + /* 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->base.pc_next += 1;
> + return BC_HIT_TB;
> + } else {
> + return BC_MISS;
> + }
> +}
> +
> /* generate intermediate code for basic block 'tb'. */
> void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb)
> {
> @@ -8490,18 +8510,35 @@ void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb)
> i386_trblock_insn_start(&dc->base, cpu);
> num_insns++;
>
> - /* If RF is set, suppress an internally generated breakpoint. */
> - if (unlikely(cpu_breakpoint_test(cpu, dc->base.pc_next,
> - tb->flags & HF_RF_MASK
> - ? BP_GDB : BP_ANY))) {
> - gen_debug(dc, dc->base.pc_next - dc->cs_base);
> - /* 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->base.pc_next += 1;
> - goto done_generating;
> + if (unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) {
> + CPUBreakpoint *bp;
> + QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
> + if (bp->pc == dc->base.pc_next) {
> + BreakpointCheckType bp_check =
> + i386_trblock_breakpoint_check(&dc->base, cpu, bp);
> + switch (bp_check) {
> + case BC_MISS:
> + /* Target ignored this breakpoint, go to next */
> + break;
> + case BC_HIT_INSN:
> + /* Hit, keep translating */
> + /*
> + * TODO: if we're never going to have more than one
> + * BP in a single address, we can simply use a
> + * bool here.
> + */
> + goto done_breakpoints;
BC_HIT_INSN is not needed here, but I see what you're doing.
Reviewed-by: Emilio G. Cota <cota@braap.org>
E.
next prev parent reply other threads:[~2017-06-30 0:25 UTC|newest]
Thread overview: 100+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 12:16 [Qemu-devel] [PATCH v11 00/29] translate: [tcg] Generic translation framework Lluís Vilanova
2017-06-28 12:20 ` [Qemu-devel] [PATCH v11 01/29] Pass generic CPUState to gen_intermediate_code() Lluís Vilanova
2017-06-29 22:52 ` Emilio G. Cota
2017-06-30 18:46 ` Richard Henderson
2017-07-01 22:44 ` Richard Henderson
2017-06-28 12:24 ` [Qemu-devel] [PATCH v11 02/29] cpu-exec: Avoid global variables in icount-related functions Lluís Vilanova
2017-06-29 22:56 ` Emilio G. Cota
2017-06-28 12:28 ` [Qemu-devel] [PATCH v11 03/29] target: [tcg] Use a generic enum for DISAS_ values Lluís Vilanova
2017-06-29 23:09 ` Emilio G. Cota
2017-07-01 22:48 ` Richard Henderson
2017-06-28 12:32 ` [Qemu-devel] [PATCH v11 04/29] target: [tcg] Add generic translation framework Lluís Vilanova
2017-06-30 0:02 ` Emilio G. Cota
2017-07-01 22:57 ` Richard Henderson
2017-06-30 1:18 ` Emilio G. Cota
2017-07-01 23:37 ` Richard Henderson
2017-07-04 18:59 ` Lluís Vilanova
2017-07-04 19:14 ` Peter Maydell
2017-07-04 22:31 ` Richard Henderson
2017-07-04 22:34 ` Peter Maydell
2017-06-28 12:36 ` [Qemu-devel] [PATCH v11 05/29] target/i386: [tcg] Port to DisasContextBase Lluís Vilanova
2017-06-29 23:33 ` Emilio G. Cota
2017-07-01 23:39 ` Richard Henderson
2017-06-28 12:40 ` [Qemu-devel] [PATCH v11 06/29] target/i386: [tcg] Refactor init_disas_context Lluís Vilanova
2017-06-29 23:51 ` Emilio G. Cota
2017-07-07 7:41 ` Lluís Vilanova
2017-07-01 23:50 ` Richard Henderson
2017-06-28 12:44 ` [Qemu-devel] [PATCH v11 07/29] target/i386: [tcg] Refactor init_globals Lluís Vilanova
2017-06-30 0:06 ` Emilio G. Cota
2017-07-02 0:25 ` Richard Henderson
2017-06-28 12:48 ` [Qemu-devel] [PATCH v11 08/29] target/i386: [tcg] Refactor insn_start Lluís Vilanova
2017-06-30 0:08 ` Emilio G. Cota
2017-07-02 0:26 ` Richard Henderson
2017-06-28 12:52 ` [Qemu-devel] [PATCH v11 09/29] target/i386: [tcg] Refactor breakpoint_check Lluís Vilanova
2017-06-30 0:24 ` Emilio G. Cota [this message]
2017-07-02 0:28 ` Richard Henderson
2017-06-28 12:57 ` [Qemu-devel] [PATCH v11 10/29] target/i386: [tcg] Refactor translate_insn Lluís Vilanova
2017-06-30 0:41 ` Emilio G. Cota
2017-07-07 9:25 ` Lluís Vilanova
2017-07-07 15:18 ` Richard Henderson
2017-07-07 17:05 ` Lluís Vilanova
2017-07-02 0:41 ` Richard Henderson
2017-06-28 13:01 ` [Qemu-devel] [PATCH v11 11/29] target/i386: [tcg] Refactor tb_stop Lluís Vilanova
2017-06-30 0:47 ` Emilio G. Cota
2017-07-02 0:47 ` Richard Henderson
2017-06-28 13:05 ` [Qemu-devel] [PATCH v11 12/29] target/i386: [tcg] Refactor disas_log Lluís Vilanova
2017-06-30 0:50 ` Emilio G. Cota
2017-07-02 0:49 ` Richard Henderson
2017-06-28 13:09 ` [Qemu-devel] [PATCH v11 13/29] target/i386: [tcg] Port to generic translation framework Lluís Vilanova
2017-06-30 1:11 ` Emilio G. Cota
2017-07-07 10:27 ` Lluís Vilanova
2017-07-07 10:29 ` Lluís Vilanova
2017-07-02 0:52 ` Richard Henderson
2017-06-28 13:13 ` [Qemu-devel] [PATCH v11 14/29] target/arm: [tcg] Port to DisasContextBase Lluís Vilanova
2017-07-02 1:00 ` Richard Henderson
2017-06-28 13:17 ` [Qemu-devel] [PATCH v11 15/29] target/arm: [tcg] Port to init_disas_context Lluís Vilanova
2017-07-02 1:04 ` Richard Henderson
2017-06-28 13:21 ` [Qemu-devel] [PATCH v11 16/29] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-02 1:13 ` Richard Henderson
2017-06-28 13:25 ` [Qemu-devel] [PATCH v11 17/29] target/arm: [tcg] Port to init_globals Lluís Vilanova
2017-07-02 1:14 ` Richard Henderson
2017-06-28 13:29 ` [Qemu-devel] [PATCH v11 18/29] target/arm: [tcg] Port to tb_start Lluís Vilanova
2017-07-02 1:17 ` Richard Henderson
2017-06-28 13:33 ` [Qemu-devel] [PATCH v11 19/29] target/arm: [tcg] Port to insn_start Lluís Vilanova
2017-07-02 1:18 ` Richard Henderson
2017-06-28 13:37 ` [Qemu-devel] [PATCH v11 20/29] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-02 1:19 ` Richard Henderson
2017-06-28 13:41 ` [Qemu-devel] [PATCH v11 21/29] target/arm: [tcg] Port to breakpoint_check Lluís Vilanova
2017-07-02 1:21 ` Richard Henderson
2017-06-28 13:45 ` [Qemu-devel] [PATCH v11 22/29] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-02 1:22 ` Richard Henderson
2017-06-28 13:49 ` [Qemu-devel] [PATCH v11 23/29] target/arm: [tcg] Port to translate_insn Lluís Vilanova
2017-07-02 1:34 ` Richard Henderson
2017-07-07 11:13 ` Lluís Vilanova
2017-07-07 15:26 ` Richard Henderson
2017-07-07 17:18 ` Lluís Vilanova
2017-07-07 17:38 ` Richard Henderson
2017-07-10 13:47 ` Lluís Vilanova
2017-07-10 15:28 ` Richard Henderson
2017-07-07 17:33 ` Peter Maydell
2017-07-07 17:48 ` Richard Henderson
2017-06-28 13:53 ` [Qemu-devel] [PATCH v11 24/29] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-02 1:42 ` Richard Henderson
2017-07-07 11:18 ` Lluís Vilanova
2017-07-07 15:46 ` Richard Henderson
2017-07-07 16:19 ` Emilio G. Cota
2017-07-07 17:33 ` Lluís Vilanova
2017-07-07 17:32 ` Lluís Vilanova
2017-07-07 17:41 ` Richard Henderson
2017-07-11 15:56 ` Lluís Vilanova
2017-06-28 13:57 ` [Qemu-devel] [PATCH v11 25/29] target/arm: [tcg] Port to tb_stop Lluís Vilanova
2017-07-02 1:45 ` Richard Henderson
2017-06-28 14:01 ` [Qemu-devel] [PATCH v11 26/29] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-02 1:48 ` Richard Henderson
2017-06-28 14:05 ` [Qemu-devel] [PATCH v11 27/29] target/arm: [tcg] Port to disas_log Lluís Vilanova
2017-07-02 1:49 ` Richard Henderson
2017-06-28 14:09 ` [Qemu-devel] [PATCH v11 28/29] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-02 1:50 ` Richard Henderson
2017-06-28 14:13 ` [Qemu-devel] [PATCH v11 29/29] target/arm: [tcg] Port to generic translation framework Lluís Vilanova
2017-07-02 1:54 ` Richard Henderson
2017-07-07 11:26 ` Lluís Vilanova
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170630002454.GI13979@flamenco \
--to=cota@braap.org \
--cc=alex.bennee@linaro.org \
--cc=crosthwaite.peter@gmail.com \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=vilanova@ac.upc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).