From: "Lluís Vilanova" <vilanova@ac.upc.edu>
To: Richard Henderson <rth@twiddle.net>
Cc: qemu-devel@nongnu.org, "Emilio G. Cota" <cota@braap.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Peter Crosthwaite" <crosthwaite.peter@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"open list:ARM" <qemu-arm@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v13 18/26] target/arm: [tcg] Port to breakpoint_check
Date: Sat, 15 Jul 2017 10:46:22 +0300 [thread overview]
Message-ID: <87k23ab0s1.fsf@frigg.lan> (raw)
In-Reply-To: <584dade6-5ce0-4950-c0e3-03128bae119e@twiddle.net> (Richard Henderson's message of "Fri, 14 Jul 2017 07:26:01 -1000")
Richard Henderson writes:
> On 07/13/2017 11:26 PM, 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>
>> Reviewed-by: Richard Henderson <rth@twiddle.net>
>> ---
>> target/arm/translate.c | 53 +++++++++++++++++++++++++++++++-----------------
>> 1 file changed, 34 insertions(+), 19 deletions(-)
>>
>> diff --git a/target/arm/translate.c b/target/arm/translate.c
>> index b9183fc511..55bef09739 100644
>> --- a/target/arm/translate.c
>> +++ b/target/arm/translate.c
>> @@ -11917,6 +11917,33 @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
>> #endif
>> }
>> +static bool arm_tr_breakpoint_check(DisasContextBase *dcbase, CPUState
>> *cpu,
>> + const CPUBreakpoint *bp)
>> +{
>> + DisasContext *dc = container_of(dcbase, DisasContext, base);
>> +
>> + if (bp->flags & BP_CPU) {
>> + gen_set_condexec(dc);
>> + gen_set_pc_im(dc, dc->pc);
>> + gen_helper_check_breakpoints(cpu_env);
>> + /* End the TB early; it's likely not going to be executed */
>> + dc->base.is_jmp = DISAS_UPDATE;
>> + } 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. */
>> + /* TODO: Advance PC by correct instruction length to
>> + * avoid disassembler error messages */
>> + dc->pc += 2;
>> + dc->base.is_jmp = DISAS_NORETURN;
>> + }
>> +
>> + return true;
>> +}
>> +
>> /* generate intermediate code for basic block 'tb'. */
>> void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
>> {
>> @@ -11965,28 +11992,16 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
>> if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) {
>> CPUBreakpoint *bp;
>> QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
>> - if (bp->pc == dc->pc) {
>> - if (bp->flags & BP_CPU) {
>> - gen_set_condexec(dc);
>> - gen_set_pc_im(dc, dc->pc);
>> - gen_helper_check_breakpoints(cpu_env);
>> - /* End the TB early; it's likely not going to be executed */
>> - dc->base.is_jmp = DISAS_UPDATE;
> Oh I see what you're doing there in the main loop.
> And I see that you're copying existing behaviour.
> That said, I do wonder if there's a better way.
> Looking back at the original patch (5d98bf8f), there do not
> seem to have been any other side effects intended; simply
> "single step" any insn for which this bp condition is met.
> Another way to handle this would be if we could adjust max_insns = num_insns.
> That would cause the loop to exit after the current insn, with DISAS_TOO_MANY if
> nothing else.
But adjusting num_insns (I guess passed as a pointer to breakpoint_check()) will
stop *after* translating the instructions, instead of before as some targets do
currently.
I'd really prefer to keep the current behaviour, and if in the end we see that
the use of DISAS_NORETURN in all targets is safe to switch into DISAS_TOO_MANY,
we can do so in a future patch.
Cheers,
Lluis
next prev parent reply other threads:[~2017-07-15 7:46 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-14 8:13 [Qemu-devel] [PATCH v13 00/26] translate: [tcg] Generic translation framework Lluís Vilanova
2017-07-14 8:17 ` [Qemu-devel] [PATCH v13 01/26] Pass generic CPUState to gen_intermediate_code() Lluís Vilanova
2017-07-14 8:21 ` [Qemu-devel] [PATCH v13 02/26] target: [tcg] Use a generic enum for DISAS_ values Lluís Vilanova
2017-07-14 8:25 ` [Qemu-devel] [PATCH v13 03/26] target: [tcg] Add generic translation framework Lluís Vilanova
2017-07-14 16:48 ` Richard Henderson
2017-07-15 7:34 ` Lluís Vilanova
2017-07-14 8:29 ` [Qemu-devel] [PATCH v13 04/26] target/i386: [tcg] Port to DisasContextBase Lluís Vilanova
2017-07-14 8:33 ` [Qemu-devel] [PATCH v13 05/26] target/i386: [tcg] Port to init_disas_context Lluís Vilanova
2017-07-14 8:37 ` [Qemu-devel] [PATCH v13 06/26] target/i386: [tcg] Port to insn_start Lluís Vilanova
2017-07-14 8:41 ` [Qemu-devel] [PATCH v13 07/26] target/i386: [tcg] Port to breakpoint_check Lluís Vilanova
2017-07-14 8:45 ` [Qemu-devel] [PATCH v13 08/26] target/i386: [tcg] Port to translate_insn Lluís Vilanova
2017-07-14 8:49 ` [Qemu-devel] [PATCH v13 09/26] target/i386: [tcg] Port to tb_stop Lluís Vilanova
2017-07-14 8:53 ` [Qemu-devel] [PATCH v13 10/26] target/i386: [tcg] Port to disas_log Lluís Vilanova
2017-07-14 8:57 ` [Qemu-devel] [PATCH v13 11/26] target/i386: [tcg] Port to generic translation framework Lluís Vilanova
2017-07-14 9:01 ` [Qemu-devel] [PATCH v13 12/26] target/arm: [tcg] Port to DisasContextBase Lluís Vilanova
2017-07-14 9:06 ` [Qemu-devel] [PATCH v13 13/26] target/arm: [tcg] Port to init_disas_context Lluís Vilanova
2017-07-14 9:10 ` [Qemu-devel] [PATCH v13 14/26] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-14 9:14 ` [Qemu-devel] [PATCH v13 15/26] target/arm: [tcg] Port to tb_start Lluís Vilanova
2017-07-14 9:18 ` [Qemu-devel] [PATCH v13 16/26] target/arm: [tcg] Port to insn_start Lluís Vilanova
2017-07-14 9:22 ` [Qemu-devel] [PATCH v13 17/26] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-14 9:26 ` [Qemu-devel] [PATCH v13 18/26] target/arm: [tcg] Port to breakpoint_check Lluís Vilanova
2017-07-14 17:26 ` Richard Henderson
2017-07-14 17:42 ` Richard Henderson
2017-07-15 7:56 ` Lluís Vilanova
2017-07-15 17:52 ` Richard Henderson
2017-07-15 7:46 ` Lluís Vilanova [this message]
2017-07-14 9:30 ` [Qemu-devel] [PATCH v13 19/26] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-14 9:34 ` [Qemu-devel] [PATCH v13 20/26] target/arm: [tcg] Port to translate_insn Lluís Vilanova
2017-07-14 9:38 ` [Qemu-devel] [PATCH v13 21/26] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-14 9:42 ` [Qemu-devel] [PATCH v13 22/26] target/arm: [tcg] Port to tb_stop Lluís Vilanova
2017-07-14 17:33 ` Richard Henderson
2017-07-15 7:56 ` Lluís Vilanova
2017-07-15 17:54 ` Richard Henderson
2017-07-14 9:46 ` [Qemu-devel] [PATCH v13 23/26] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-14 9:50 ` [Qemu-devel] [PATCH v13 24/26] target/arm: [tcg] Port to disas_log Lluís Vilanova
2017-07-14 9:54 ` [Qemu-devel] [PATCH v13 25/26] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-14 9:58 ` [Qemu-devel] [PATCH v13 26/26] target/arm: [tcg] Port to generic translation framework Lluís Vilanova
2017-07-14 12:06 ` [Qemu-devel] [PATCH v13 00/26] translate: [tcg] Generic " no-reply
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=87k23ab0s1.fsf@frigg.lan \
--to=vilanova@ac.upc.edu \
--cc=alex.bennee@linaro.org \
--cc=cota@braap.org \
--cc=crosthwaite.peter@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).