On Sat, May 23, 2015 at 12:13 AM, Peter Maydell <peter.mayd...@linaro.org> wrote:
> On 22 May 2015 at 16:36, Jun Koi <junkoi2...@gmail.com> wrote: > > In general, we would have timer & code execution run in parallel, > > No code has to actually run when there's an active timer; > the event loop thread mostly sits blocked waiting for > something interesting to happen (io or a timer firing). > When it does then the event loop thread will call the > generic timer code, which will call the callback function > for that timer. Typically this is inside the device model > for whatever timer the hardware you're modelling is. It > will then (assuming it really wants to create a simulated > interrupt) call qemu_irq_set() What is the exact name of this function? There is no such qemu_irq_set() in the latest 2.3.0 source. Thanks! Jun to set its outbound IRQ > line. This will then end up calling into the emulated > interrupt controller and eventually (if the irq is not > masked by the interrupt controller) into the emulated > CPU, which calls cpu_interrupt(). In TCG that ends up > calling tcg_handle_interrupt(), which sets cpu->tcg_exit_req. > Every block of translated code has an initial part > (written by gen_tb_start()) which checks this flag, and > returns to the TCG main loop (in cpu-exec.c) if it is set. > Every time round the TCG main loop we check if there are > any pending interrupts, and if so we call the appropriate > CPU function to emulate the "take an interrupt" behaviour > of the target CPU. > > -- PMM > >