[Milkymist-devel] QEMU/LM32

Fabrice Bellard fabrice at bellard.org
Thu Mar 4 09:54:06 PST 2010


Hi,

On 03/04/10 15:03, Sébastien Bourdeauducq wrote:
> Hi Fabrice,
>
> Looking forward to a possible merge in mainline QEMU, can you review the
> LatticeMico32 target support developed by Michael Walle and available at:
> http://git.serverraum.org/?p=mw/qemu-lm32.git;a=summary
> (git clone http://git.serverraum.org/git/mw/qemu-lm32.git)
>
> A few points need to be sorted out before the merge is done:
> - Michael is unsure about the interrupt handling. Esp. if it is
> possible to manipulate env->interrupt_request within a translation block.
> Could you check that?

The following code in the PIC is almost surely incorrect:

     if ((env->ie & IE_IE) && (env->ip & env->im))
         cpu_interrupt(env, CPU_INTERRUPT_HARD);

CPU_INTERRUPT_HARD means that a hardware interrupt is pending. When it 
is set, QEMU will exit the current translated block as soon as possible. 
You should not test the CPU irq masking state before setting it 
otherwise the CPU will miss interrupts.

The code should be something like that:

if (env->ip & env->im)
         cpu_interrupt(env, CPU_INTERRUPT_HARD);
else
	cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);

In cpu-exec.c you should do:

if ((interrupt_request & CPU_INTERRUPT_HARD)) && (env->ie & IE_IE)) {
   [...]
}

(Testing (env->ip & env->im) is not necessary because CPU_INTERRUPT_HARD 
gives its state).

You should also remove helper_update_interrupt().

> - Support for the variants of LatticeMico32 (with/without barrel shifter,
> multiplier and divider) is missing.

You should use "cpu_model" in cpu_lm32_init() to handle CPU model options.

> - Branches "master" (for the original LatticeMico32 system) and "milkymist"
> should be merged.
>
> The last 2 points should be fixed soon, but in the meantime can you have a
> look at the code and tell us if it is OK to merge it in QEMU?

As it seems that you did not modify code for other targets in QEMU, I 
think it can be merged. But as I not longer follow the QEMU development, 
I cannot help you much !

Regards,

Fabrice.


More information about the Devel mailing list