From patchwork Sun Jun 9 19:12:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 250138 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 46E232C02A3 for ; Mon, 10 Jun 2013 06:30:09 +1000 (EST) Received: from localhost ([::1]:38408 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ull7x-0006IL-4V for incoming@patchwork.ozlabs.org; Sun, 09 Jun 2013 15:18:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ull3u-00083q-5Z for qemu-devel@nongnu.org; Sun, 09 Jun 2013 15:13:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ull3s-0000Tf-AI for qemu-devel@nongnu.org; Sun, 09 Jun 2013 15:13:58 -0400 Received: from cantor2.suse.de ([195.135.220.15]:44356 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ull3r-0000Sp-Sj; Sun, 09 Jun 2013 15:13:56 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2F16EA398F; Sun, 9 Jun 2013 21:13:55 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Sun, 9 Jun 2013 21:12:40 +0200 Message-Id: <1370805206-26574-14-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1370805206-26574-1-git-send-email-afaerber@suse.de> References: <1370805206-26574-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Anthony Liguori , Riku Voipio , Alexander Graf , =?UTF-8?q?Andreas=20F=C3=A4rber?= , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , "open list:PReP" , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Aurelien Jarno Subject: [Qemu-devel] [PATCH qom-cpu 13/59] cpu: Change cpu_exit() argument to CPUState X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It no longer depends on CPUArchState, so move it to qom/cpu.c. Signed-off-by: Andreas Färber --- cpus.c | 4 ++-- exec.c | 8 -------- gdbstub.c | 2 +- hw/i386/pc.c | 2 +- hw/mips/mips_fulong2e.c | 2 +- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/ppc/prep.c | 2 +- include/exec/cpu-all.h | 2 -- include/qom/cpu.h | 8 ++++++++ linux-user/main.c | 2 +- linux-user/signal.c | 2 +- qom/cpu.c | 6 ++++++ 13 files changed, 24 insertions(+), 20 deletions(-) diff --git a/cpus.c b/cpus.c index a8572a9..b2b20c3 100644 --- a/cpus.c +++ b/cpus.c @@ -477,7 +477,7 @@ static void cpu_handle_guest_debug(CPUArchState *env) static void cpu_signal(int sig) { if (cpu_single_env) { - cpu_exit(cpu_single_env); + cpu_exit(ENV_GET_CPU(cpu_single_env)); } exit_request = 1; } @@ -1089,7 +1089,7 @@ void cpu_stop_current(void) CPUState *cpu_single_cpu = ENV_GET_CPU(cpu_single_env); cpu_single_cpu->stop = false; cpu_single_cpu->stopped = true; - cpu_exit(cpu_single_env); + cpu_exit(cpu_single_cpu); qemu_cond_signal(&qemu_pause_cond); } } diff --git a/exec.c b/exec.c index 5b8b40d..c0fa5a3 100644 --- a/exec.c +++ b/exec.c @@ -515,14 +515,6 @@ void cpu_single_step(CPUArchState *env, int enabled) #endif } -void cpu_exit(CPUArchState *env) -{ - CPUState *cpu = ENV_GET_CPU(env); - - cpu->exit_request = 1; - cpu->tcg_exit_req = 1; -} - void cpu_abort(CPUArchState *env, const char *fmt, ...) { va_list ap; diff --git a/gdbstub.c b/gdbstub.c index 92ecdcb..7744456 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2652,7 +2652,7 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...) is still in the running state, which can cause packets to be dropped and state transition 'T' packets to be sent while the syscall is still being processed. */ - cpu_exit(s->c_cpu); + cpu_exit(ENV_GET_CPU(s->c_cpu)); #endif } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 553becb..145efce 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1103,7 +1103,7 @@ static void cpu_request_exit(void *opaque, int irq, int level) CPUX86State *env = cpu_single_env; if (env && level) { - cpu_exit(env); + cpu_exit(CPU(x86_env_get_cpu(env))); } } diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 1aac93a..00c9071 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -253,7 +253,7 @@ static void cpu_request_exit(void *opaque, int irq, int level) CPUMIPSState *env = cpu_single_env; if (env && level) { - cpu_exit(env); + cpu_exit(CPU(mips_env_get_cpu(env))); } } diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 94d9570..2ad0c0b 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -102,7 +102,7 @@ static void cpu_request_exit(void *opaque, int irq, int level) CPUMIPSState *env = cpu_single_env; if (env && level) { - cpu_exit(env); + cpu_exit(CPU(mips_env_get_cpu(env))); } } diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 5033d51..8a4459d 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -773,7 +773,7 @@ static void cpu_request_exit(void *opaque, int irq, int level) CPUMIPSState *env = cpu_single_env; if (env && level) { - cpu_exit(env); + cpu_exit(CPU(mips_env_get_cpu(env))); } } diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index be8a50e..4dbb36e 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -420,7 +420,7 @@ static void cpu_request_exit(void *opaque, int irq, int level) CPUPPCState *env = cpu_single_env; if (env && level) { - cpu_exit(env); + cpu_exit(CPU(ppc_env_get_cpu(env))); } } diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index bd09cd1..f0a5931 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -420,8 +420,6 @@ DECLARE_TLS(CPUArchState *,cpu_single_env); | CPU_INTERRUPT_TGT_EXT_3 \ | CPU_INTERRUPT_TGT_EXT_4) -void cpu_exit(CPUArchState *s); - /* Breakpoint/watchpoint flags */ #define BP_MEM_READ 0x01 #define BP_MEM_WRITE 0x02 diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 254be2e..4969e2a 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -351,6 +351,14 @@ void cpu_interrupt(CPUState *cpu, int mask); void cpu_reset_interrupt(CPUState *cpu, int mask); /** + * cpu_exit: + * @cpu: The CPU to exit. + * + * Requests the CPU @cpu to exit execution. + */ +void cpu_exit(CPUState *cpu); + +/** * cpu_resume: * @cpu: The CPU to resume. * diff --git a/linux-user/main.c b/linux-user/main.c index b97b8cf..30e7953 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -160,7 +160,7 @@ static inline void start_exclusive(void) other_cpu = ENV_GET_CPU(other); if (other_cpu->running) { pending_cpus++; - cpu_exit(other); + cpu_exit(other_cpu); } } if (pending_cpus > 1) { diff --git a/linux-user/signal.c b/linux-user/signal.c index 5da8452..c4e20dc 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -524,7 +524,7 @@ static void host_signal_handler(int host_signum, siginfo_t *info, host_to_target_siginfo_noswap(&tinfo, info); if (queue_signal(thread_env, sig, &tinfo) == 1) { /* interrupt the virtual CPU as soon as possible */ - cpu_exit(thread_env); + cpu_exit(ENV_GET_CPU(thread_env)); } } diff --git a/qom/cpu.c b/qom/cpu.c index dba4a11..8a122b0 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -91,6 +91,12 @@ void cpu_reset_interrupt(CPUState *cpu, int mask) cpu->interrupt_request &= ~mask; } +void cpu_exit(CPUState *cpu) +{ + cpu->exit_request = 1; + cpu->tcg_exit_req = 1; +} + int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu, void *opaque) {