qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 02/17] lm32: translation routines


From: Edgar E. Iglesias
Subject: Re: [Qemu-devel] [PATCH 02/17] lm32: translation routines
Date: Tue, 8 Feb 2011 21:00:23 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

On Tue, Feb 08, 2011 at 09:32:57AM -0800, Richard Henderson wrote:
> On 01/30/2011 04:30 PM, Michael Walle wrote:
> > +    if (dc->format == OP_FMT_RI) {
> > +        tcg_gen_brcondi_tl(cond, cpu_R[rY], sign_extend(dc->imm16, 16), 
> > l1);
> > +    } else {
> > +        tcg_gen_brcond_tl(cond, cpu_R[rY], cpu_R[rZ], l1);
> > +    }
> > +    tcg_gen_movi_tl(cpu_R[rX], 0);
> > +    tcg_gen_br(l2);
> > +    gen_set_label(l1);
> > +    tcg_gen_movi_tl(cpu_R[rX], 1);
> > +    gen_set_label(l2);
> 
> This is tcg_gen_setcond_tl.
> 
> BTW, why the extensive extra LOG_DIS code?  Why not just run the regular 
> disassembler, like other ports?

FWIW, I used the same macros in the CRIS & MicroBlaze translators because
I found using the translators decoding useful to compare with the regular
disassembler's when looking for decoding errors. Also, some times I used
the translators disasm because it is faster (it doesn't have to decode
the insns twice), although not as readable. It was a while ago though...


> > +    if (!(dc->env->features & LM32_FEATURE_MULTIPLY)) {
> > +        cpu_abort(dc->env, "hardware multiplier is not available\n");
> > +    }
> 
> Aborting the VM, rather than raising an exception?
> 
> > +        tcg_gen_xor_tl(cpu_R[dc->r2], cpu_R[dc->r0], cpu_R[dc->r1]);
> > +        tcg_gen_not_tl(cpu_R[dc->r2], cpu_R[dc->r2]);
> 
> This is tcg_gen_eqv_tl.
> 
> > +    /* Large switch for all insns.  */
> > +    for (i = 0; i < ARRAY_SIZE(decinfo); i++) {
> > +        if ((dc->opcode & decinfo[i].mask) == decinfo[i].bits) {
> > +            decinfo[i].dec(dc);
> > +            break;
> > +        }
> > +    }
> > +}
> 
> No check that *some* opcode matched?  It would seem like a "return"
> here instead of a break, and then an illegal opcode exception after
> the loop would be in order.

Good catch!

Other ports using the same decoding approach have a "match all" entry
in the decinfo table to catch illegal insns..

Cheers



reply via email to

[Prev in Thread] Current Thread [Next in Thread]