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: Michael Walle
Subject: Re: [Qemu-devel] [PATCH 02/17] lm32: translation routines
Date: Tue, 8 Feb 2011 22:32:34 +0100
User-agent: KMail/1.13.5 (Linux/2.6.32-5-686-bigmem; KDE/4.4.5; i686; ; )

Am Dienstag 08 Februar 2011, 18:32:57 schrieb Richard Henderson:
> 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.
fixed, thanks

> BTW, why the extensive extra LOG_DIS code?  Why not just run the regular
> disassembler, like other ports?
There is no built in disassembler for qemu (yet). The lm32 binutils port uses 
cgen for parsing, so the lm32-dis.c is not self contained. Either i need to 
embed cgen into the lm32-dis.c, write my own disassembler or qemu needs to 
link again libopcodes). I didn't like any of these solutions :)

> > +    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?
The LM32 processor does not raise an exception in that case. If there is an 
unknown opcode its behaviour is undefined on real hardware.

> 
> > +        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.
fixed too, unfortunately there is no variant with an immediate.

> > +    /* 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.
fixed too. Again, if there is no match, the VM will be killed.

-- 
thanks michael



reply via email to

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