From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YywUA-0001lW-26 for qemu-devel@nongnu.org; Sun, 31 May 2015 02:12:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YywU8-0000XT-SI for qemu-devel@nongnu.org; Sun, 31 May 2015 02:12:38 -0400 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]:32807) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YywU8-0000XD-L7 for qemu-devel@nongnu.org; Sun, 31 May 2015 02:12:36 -0400 Received: by padj3 with SMTP id j3so21084772pad.0 for ; Sat, 30 May 2015 23:12:36 -0700 (PDT) From: Peter Crosthwaite Date: Sat, 30 May 2015 23:11:41 -0700 Message-Id: <2bf38ab7b248733e71dcda93d34e7cb63321884c.1433052532.git.crosthwaite.peter@gmail.com> In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [RFC v2 08/34] translate-all: Move tcg_handle_interrupt to -common List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Peter Crosthwaite , pbonzini@redhat.com, edgar.iglesias@gmail.com, afaerber@suse.de, rth@twiddle.net Move this function to common code. It has no arch specific dependencies. Prepares support for multi-arch where the translate-all interface needs to be virtualised. One less thing to virtualise. Signed-off-by: Peter Crosthwaite --- translate-all.c | 30 ------------------------------ translate-common.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/translate-all.c b/translate-all.c index b2edfb4..7d27c5d 100644 --- a/translate-all.c +++ b/translate-all.c @@ -1447,36 +1447,6 @@ void tb_check_watchpoint(CPUState *cpu) } #ifndef CONFIG_USER_ONLY -/* mask must never be zero, except for A20 change call */ -static void tcg_handle_interrupt(CPUState *cpu, int mask) -{ - int old_mask; - - old_mask = cpu->interrupt_request; - cpu->interrupt_request |= mask; - - /* - * If called from iothread context, wake the target cpu in - * case its halted. - */ - if (!qemu_cpu_is_self(cpu)) { - qemu_cpu_kick(cpu); - return; - } - - if (use_icount) { - cpu->icount_decr.u16.high = 0xffff; - if (!cpu_can_do_io(cpu) - && (mask & ~old_mask) != 0) { - cpu_abort(cpu, "Raised interrupt while not in I/O function"); - } - } else { - cpu->tcg_exit_req = 1; - } -} - -CPUInterruptHandler cpu_interrupt_handler = tcg_handle_interrupt; - /* in deterministic execution mode, instructions doing device I/Os must be at the end of the TB */ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) diff --git a/translate-common.c b/translate-common.c index 563ae5a..806b36e 100644 --- a/translate-common.c +++ b/translate-common.c @@ -1,6 +1,7 @@ /* * Host code generation common components * + * Copyright (c) 2003 Fabrice Bellard * Copyright (c) 2015 Peter Crosthwaite * * This library is free software; you can redistribute it and/or @@ -18,6 +19,40 @@ */ #include "qemu-common.h" +#include "qom/cpu.h" + +#ifndef CONFIG_USER_ONLY +/* mask must never be zero, except for A20 change call */ +static void tcg_handle_interrupt(CPUState *cpu, int mask) +{ + int old_mask; + + old_mask = cpu->interrupt_request; + cpu->interrupt_request |= mask; + + /* + * If called from iothread context, wake the target cpu in + * case its halted. + */ + if (!qemu_cpu_is_self(cpu)) { + qemu_cpu_kick(cpu); + return; + } + + if (use_icount) { + cpu->icount_decr.u16.high = 0xffff; + if (!cpu_can_do_io(cpu) + && (mask & ~old_mask) != 0) { + cpu_abort(cpu, "Raised interrupt while not in I/O function"); + } + } else { + cpu->tcg_exit_req = 1; + } +} + +CPUInterruptHandler cpu_interrupt_handler = tcg_handle_interrupt; + +#endif typedef struct TCGExecInitFn { void (*do_tcg_exec_init)(unsigned long tb_size); -- 1.9.1