qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] This is a bug, isn't it?


From: Martin Husemann
Subject: [Qemu-devel] This is a bug, isn't it?
Date: Sun, 24 Jun 2012 21:19:11 +0200
User-agent: Mutt/1.4.2.3i

Can somebody explain this code sniplet from hw/sparc32_dma.c to me?
Either it is some hidden threaded gem (in which case s->dmaregs need to be
volatile at least), or some tests are a bit confused and any reasonably
optimizing compiler will create code that apparently the author did not
intend:

static void dma_set_irq(void *opaque, int irq, int level)
{
    DMAState *s = opaque;
    if (level) {
        s->dmaregs[0] |= DMA_INTR;
        if (s->dmaregs[0] & DMA_INTREN) {
            trace_sparc32_dma_set_irq_raise();
            qemu_irq_raise(s->irq);
        }   
    } else {
        if (s->dmaregs[0] & DMA_INTR) {
            s->dmaregs[0] &= ~DMA_INTR;
            if (s->dmaregs[0] & DMA_INTREN) {
                trace_sparc32_dma_set_irq_lower();
                qemu_irq_lower(s->irq);
            }
        }
    }
}


Thanks,

Martin



reply via email to

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