From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Lluís Vilanova" <vilanova@ac.upc.edu>
Cc: qemu-devel@nongnu.org, "Emilio G. Cota" <cota@braap.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 v12 06/27] target/i386: [tcg] Port to init_disas_context
Date: Wed, 12 Jul 2017 10:20:54 +0100 [thread overview]
Message-ID: <877eze9fk9.fsf@linaro.org> (raw)
In-Reply-To: <149942909046.8972.7267856934982201630.stgit@frigg.lan>
Lluís Vilanova <vilanova@ac.upc.edu> writes:
> 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>
Hah, I see now ;-)
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> target/i386/translate.c | 41 +++++++++++++++++++++++------------------
> 1 file changed, 23 insertions(+), 18 deletions(-)
>
> diff --git a/target/i386/translate.c b/target/i386/translate.c
> index f61f5c7227..7819545e37 100644
> --- a/target/i386/translate.c
> +++ b/target/i386/translate.c
> @@ -8379,20 +8379,12 @@ void tcg_x86_init(void)
> }
> }
>
> -/* generate intermediate code for basic block 'tb'. */
> -void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
> +static void i386_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
> {
> - CPUX86State *env = cs->env_ptr;
> - DisasContext dc1, *dc = &dc1;
> - uint32_t flags;
> - target_ulong cs_base;
> - int num_insns;
> - int max_insns;
> -
> - /* generate intermediate code */
> - dc->base.pc_first = tb->pc;
> - cs_base = tb->cs_base;
> - flags = tb->flags;
> + DisasContext *dc = container_of(dcbase, DisasContext, base);
> + CPUX86State *env = cpu->env_ptr;
> + uint32_t flags = dc->base.tb->flags;
> + target_ulong cs_base = dc->base.tb->cs_base;
>
> dc->pe = (flags >> HF_PE_SHIFT) & 1;
> dc->code32 = (flags >> HF_CS32_SHIFT) & 1;
> @@ -8403,11 +8395,9 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
> dc->cpl = (flags >> HF_CPL_SHIFT) & 3;
> dc->iopl = (flags >> IOPL_SHIFT) & 3;
> dc->tf = (flags >> TF_SHIFT) & 1;
> - dc->base.singlestep_enabled = cs->singlestep_enabled;
> dc->cc_op = CC_OP_DYNAMIC;
> dc->cc_op_dirty = false;
> dc->cs_base = cs_base;
> - dc->base.tb = tb;
> dc->popl_esp_hack = 0;
> /* select memory access functions */
> dc->mem_index = 0;
> @@ -8425,7 +8415,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
> dc->code64 = (flags >> HF_CS64_SHIFT) & 1;
> #endif
> dc->flags = flags;
> - dc->jmp_opt = !(dc->tf || cs->singlestep_enabled ||
> + dc->jmp_opt = !(dc->tf || dc->base.singlestep_enabled ||
> (flags & HF_INHIBIT_IRQ_MASK));
> /* Do not optimize repz jumps at all in icount mode, because
> rep movsS instructions are execured with different paths
> @@ -8437,7 +8427,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
> record/replay modes and there will always be an
> additional step for ecx=0 when icount is enabled.
> */
> - dc->repz_opt = !dc->jmp_opt && !(tb->cflags & CF_USE_ICOUNT);
> + dc->repz_opt = !dc->jmp_opt && !(dc->base.tb->cflags & CF_USE_ICOUNT);
> #if 0
> /* check addseg logic */
> if (!dc->addseg && (dc->vm86 || !dc->pe || !dc->code32))
> @@ -8456,9 +8446,24 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
> cpu_ptr0 = tcg_temp_new_ptr();
> cpu_ptr1 = tcg_temp_new_ptr();
> cpu_cc_srcT = tcg_temp_local_new();
> +}
>
> +/* generate intermediate code for basic block 'tb'. */
> +void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
> +{
> + CPUX86State *env = cs->env_ptr;
> + DisasContext dc1, *dc = &dc1;
> + int num_insns;
> + int max_insns;
> +
> + /* generate intermediate code */
> + dc->base.singlestep_enabled = cs->singlestep_enabled;
> + dc->base.tb = tb;
> dc->base.is_jmp = DISAS_NEXT;
> + dc->base.pc_first = tb->pc;
> dc->base.pc_next = dc->base.pc_first;
> + i386_tr_init_disas_context(&dc->base, cs);
> +
> num_insns = 0;
> max_insns = tb->cflags & CF_COUNT_MASK;
> if (max_insns == 0) {
> @@ -8500,7 +8505,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
> the flag and abort the translation to give the irqs a
> change to be happen */
> if (dc->tf || dc->base.singlestep_enabled ||
> - (flags & HF_INHIBIT_IRQ_MASK)) {
> + (dc->base.tb->flags & HF_INHIBIT_IRQ_MASK)) {
> gen_jmp_im(dc->base.pc_next - dc->cs_base);
> gen_eob(dc);
> break;
--
Alex Bennée
next prev parent reply other threads:[~2017-07-12 9:22 UTC|newest]
Thread overview: 87+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-07 11:40 [Qemu-devel] [PATCH v12 00/27] translate: [tcg] Generic translation framework Lluís Vilanova
2017-07-07 11:44 ` [PATCH v12 01/27] Pass generic CPUState to gen_intermediate_code() Lluís Vilanova
2017-07-07 11:44 ` [Qemu-devel] " Lluís Vilanova
2017-07-11 19:22 ` Alex Bennée
2017-07-11 19:22 ` [Qemu-devel] " Alex Bennée
2017-07-07 11:48 ` [Qemu-devel] [PATCH v12 02/27] cpu-exec: Avoid global variables in icount-related functions Lluís Vilanova
2017-07-11 19:25 ` Alex Bennée
2017-07-12 8:42 ` Lluís Vilanova
2017-07-12 22:06 ` Emilio G. Cota
2017-07-07 11:52 ` [PATCH v12 03/27] target: [tcg] Use a generic enum for DISAS_ values Lluís Vilanova
2017-07-07 11:52 ` [Qemu-devel] " Lluís Vilanova
2017-07-12 9:10 ` Alex Bennée
2017-07-12 9:10 ` [Qemu-devel] " Alex Bennée
2017-07-12 10:56 ` Lluís Vilanova
2017-07-12 10:56 ` Lluís Vilanova
2017-07-12 16:53 ` Richard Henderson
2017-07-12 16:53 ` [Qemu-devel] " Richard Henderson
2017-07-07 11:56 ` [Qemu-devel] [PATCH v12 04/27] target: [tcg] Add generic translation framework Lluís Vilanova
2017-07-07 18:42 ` Richard Henderson
2017-07-11 16:40 ` Lluís Vilanova
2017-07-11 17:21 ` Richard Henderson
2017-07-12 8:50 ` Lluís Vilanova
2017-07-11 18:17 ` Alex Bennée
2017-07-12 8:59 ` Lluís Vilanova
2017-07-12 9:13 ` Alex Bennée
2017-07-07 12:00 ` [Qemu-devel] [PATCH v12 05/27] target/i386: [tcg] Port to DisasContextBase Lluís Vilanova
2017-07-12 9:18 ` Alex Bennée
2017-07-12 11:00 ` Lluís Vilanova
2017-07-07 12:04 ` [Qemu-devel] [PATCH v12 06/27] target/i386: [tcg] Port to init_disas_context Lluís Vilanova
2017-07-12 9:20 ` Alex Bennée [this message]
2017-07-07 12:08 ` [Qemu-devel] [PATCH v12 07/27] target/i386: [tcg] Port to insn_start Lluís Vilanova
2017-07-12 9:21 ` Alex Bennée
2017-07-07 12:13 ` [Qemu-devel] [PATCH v12 08/27] target/i386: [tcg] Port to breakpoint_check Lluís Vilanova
2017-07-07 12:17 ` [Qemu-devel] [PATCH v12 09/27] target/i386: [tcg] Port to translate_insn Lluís Vilanova
2017-07-07 12:21 ` [Qemu-devel] [PATCH v12 10/27] target/i386: [tcg] Port to tb_stop Lluís Vilanova
2017-07-07 12:25 ` [Qemu-devel] [PATCH v12 11/27] target/i386: [tcg] Port to disas_log Lluís Vilanova
2017-07-07 12:29 ` [Qemu-devel] [PATCH v12 12/27] target/i386: [tcg] Port to generic translation framework Lluís Vilanova
2017-07-07 12:33 ` [PATCH v12 13/27] target/arm: [tcg] Port to DisasContextBase Lluís Vilanova
2017-07-07 12:33 ` [Qemu-devel] " Lluís Vilanova
2017-07-12 9:25 ` Alex Bennée
2017-07-12 9:25 ` [Qemu-devel] " Alex Bennée
2017-07-07 12:37 ` [PATCH v12 14/27] target/arm: [tcg] Port to init_disas_context Lluís Vilanova
2017-07-07 12:37 ` [Qemu-devel] " Lluís Vilanova
2017-07-12 9:27 ` Alex Bennée
2017-07-12 9:27 ` [Qemu-devel] " Alex Bennée
2017-07-07 12:41 ` [PATCH v12 15/27] target/arm: [tcg,a64] " Lluís Vilanova
2017-07-07 12:41 ` [Qemu-devel] [PATCH v12 15/27] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-12 9:30 ` [PATCH v12 15/27] target/arm: [tcg,a64] " Alex Bennée
2017-07-12 9:30 ` [Qemu-devel] [PATCH v12 15/27] target/arm: [tcg, a64] " Alex Bennée
2017-07-07 12:46 ` [PATCH v12 16/27] target/arm: [tcg] Port to tb_start Lluís Vilanova
2017-07-07 12:46 ` [Qemu-devel] " Lluís Vilanova
2017-07-12 9:31 ` Alex Bennée
2017-07-12 9:31 ` [Qemu-devel] " Alex Bennée
2017-07-07 12:50 ` [PATCH v12 17/27] target/arm: [tcg] Port to insn_start Lluís Vilanova
2017-07-07 12:50 ` [Qemu-devel] " Lluís Vilanova
2017-07-12 9:32 ` Alex Bennée
2017-07-12 9:32 ` [Qemu-devel] " Alex Bennée
2017-07-07 12:54 ` [PATCH v12 18/27] target/arm: [tcg,a64] " Lluís Vilanova
2017-07-07 12:54 ` [Qemu-devel] [PATCH v12 18/27] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-12 9:32 ` [PATCH v12 18/27] target/arm: [tcg,a64] " Alex Bennée
2017-07-12 9:32 ` [Qemu-devel] [PATCH v12 18/27] target/arm: [tcg, a64] " Alex Bennée
2017-07-07 12:58 ` [PATCH v12 19/27] target/arm: [tcg] Port to breakpoint_check Lluís Vilanova
2017-07-07 12:58 ` [Qemu-devel] " Lluís Vilanova
2017-07-07 13:02 ` [PATCH v12 20/27] target/arm: [tcg,a64] " Lluís Vilanova
2017-07-07 13:02 ` [Qemu-devel] [PATCH v12 20/27] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-07 13:06 ` [PATCH v12 21/27] target/arm: [tcg] Port to translate_insn Lluís Vilanova
2017-07-07 13:06 ` [Qemu-devel] " Lluís Vilanova
2017-07-12 9:39 ` Alex Bennée
2017-07-12 9:39 ` [Qemu-devel] " Alex Bennée
2017-07-12 11:05 ` Lluís Vilanova
2017-07-12 11:05 ` Lluís Vilanova
2017-07-07 13:10 ` [PATCH v12 22/27] target/arm: [tcg,a64] " Lluís Vilanova
2017-07-07 13:10 ` [Qemu-devel] [PATCH v12 22/27] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-07 13:14 ` [PATCH v12 23/27] target/arm: [tcg] Port to tb_stop Lluís Vilanova
2017-07-07 13:14 ` [Qemu-devel] " Lluís Vilanova
2017-07-07 13:18 ` [PATCH v12 24/27] target/arm: [tcg,a64] " Lluís Vilanova
2017-07-07 13:18 ` [Qemu-devel] [PATCH v12 24/27] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-07 13:23 ` [PATCH v12 25/27] target/arm: [tcg] Port to disas_log Lluís Vilanova
2017-07-07 13:23 ` [Qemu-devel] " Lluís Vilanova
2017-07-12 9:41 ` Alex Bennée
2017-07-12 9:41 ` [Qemu-devel] " Alex Bennée
2017-07-07 13:27 ` [PATCH v12 26/27] target/arm: [tcg,a64] " Lluís Vilanova
2017-07-07 13:27 ` [Qemu-devel] [PATCH v12 26/27] target/arm: [tcg, a64] " Lluís Vilanova
2017-07-07 13:31 ` [PATCH v12 27/27] target/arm: [tcg] Port to generic translation framework Lluís Vilanova
2017-07-07 13:31 ` [Qemu-devel] " Lluís Vilanova
2017-07-12 9:47 ` [Qemu-devel] [PATCH v12 00/27] translate: [tcg] Generic " Alex Bennée
2017-07-12 11:10 ` 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=877eze9fk9.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=cota@braap.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.