qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 6/8] cpu: make CPU_INTERRUPT_RESET available


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 6/8] cpu: make CPU_INTERRUPT_RESET available on all targets
Date: Sat, 24 May 2014 14:59:48 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

Il 24/05/2014 10:30, Peter Maydell ha scritto:
> Well, I'm planning to move the bodies of all the ifdefs into
> a cpu_check_interrupts() provided by the target's cpu.h[*].
> This x86 bit is just awkward because it means there's
> x86 stuff both before and after the generic reset code.

What about

        if (interrupt_request & CPU_INTERRUPT_DEBUG) {
            cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG;
            cpu->exception_index = EXCP_DEBUG;
            cpu_loop_exit(cpu);
        }
        if (!cpu_check_interrupts(...)) {
            if (interrupt_request & CPU_INTERRUPT_HALT) {
                cpu->interrupt_request &= ~CPU_INTERRUPT_HALT;
                cpu->halted = 1;
                cpu->exception_index = EXCP_HLT;
                cpu_loop_exit(cpu);
            }
            if (interrupt_request & CPU_INTERRUPT_RESET) {
                cpu_reset(cpu);
            }
        }

Then:
- only X86 returns 1 for CPU_INTERRUPT_RESET 
- all except ARM/SPARC/MIPS/PPC/Alpha/cris/MicroBlaze/LM32/Unicore32
return 1 for CPU_INTERRUPT_HALT

> [*] not a cpu method since it seemed like it would be
> a bad idea to have a function pointer call every
> time round the main loop when there's a blocked
> interrupt...

We have that already for cc->do_interrupt, which could be
"devirtualized" if you add a check_interrupts method...  In
the end you'd be adding a function pointer call for all
interrupt requests but removing one for CPU_INTERRUPT_HARD
(and FIQ too on ARM).  That should be a wash.

Paolo



reply via email to

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