From 8c2e1b0093aa4a89548df47d969217d8b0dfd070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 25 Aug 2013 18:53:55 +0200 Subject: cpu: Turn cpu_has_work() into a CPUClass hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Default to false. Tidy variable naming and inline cast uses while at it. Tested-by: Jia Liu (or32) Signed-off-by: Andreas Färber --- target-sparc/cpu.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'target-sparc/cpu.c') diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c index 5806e59af3..6cf7e371f0 100644 --- a/target-sparc/cpu.c +++ b/target-sparc/cpu.c @@ -739,6 +739,15 @@ static void sparc_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb) cpu->env.npc = tb->cs_base; } +static bool sparc_cpu_has_work(CPUState *cs) +{ + SPARCCPU *cpu = SPARC_CPU(cs); + CPUSPARCState *env = &cpu->env; + + return (cs->interrupt_request & CPU_INTERRUPT_HARD) && + cpu_interrupts_enabled(env); +} + static void sparc_cpu_realizefn(DeviceState *dev, Error **errp) { SPARCCPUClass *scc = SPARC_CPU_GET_CLASS(dev); @@ -782,6 +791,7 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) scc->parent_reset = cc->reset; cc->reset = sparc_cpu_reset; + cc->has_work = sparc_cpu_has_work; cc->do_interrupt = sparc_cpu_do_interrupt; cc->dump_state = sparc_cpu_dump_state; #if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY) -- cgit v1.2.3