From patchwork Sun May 22 11:17:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 96733 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 68A38B6FB8 for ; Sun, 22 May 2011 21:19:41 +1000 (EST) Received: from localhost ([::1]:52833 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QO6h8-0000Bg-GM for incoming@patchwork.ozlabs.org; Sun, 22 May 2011 07:19:38 -0400 Received: from eggs.gnu.org ([140.186.70.92]:45250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QO6fq-0006un-J8 for qemu-devel@nongnu.org; Sun, 22 May 2011 07:18:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QO6fp-0005HX-By for qemu-devel@nongnu.org; Sun, 22 May 2011 07:18:18 -0400 Received: from mail-qy0-f173.google.com ([209.85.216.173]:52964) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QO6fp-0005Gb-9k for qemu-devel@nongnu.org; Sun, 22 May 2011 07:18:17 -0400 Received: by mail-qy0-f173.google.com with SMTP id 36so441881qyk.4 for ; Sun, 22 May 2011 04:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=XF0myjl7x6FKsBWDq9kBqhNNLHVKhMtzi2Npa8U+Lwk=; b=cDDsrTSzYrfa4w/C2c9g8FqMOCsmrLmvHVDZRPqHhNqrbjEzg3PbJCz4rwBKjJlxcr 35pwh6G7Q6tqbkFlNHOkdiwFXJKESHTapdotQJ4Ed/fv49xvLKtNWwq+dtEzO51VnuV8 YbFV2XPUe1t06wvxVSephMjonqmbFc/Y3N0qA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=EC6s4/t5GE2i/EKoJp14skkkGFCR6AJbo7caUA+hp/zVI8T3uze0Km+fNkwAMN6lJ9 mUXqSePq3n0OGhMnZeVMRq1GpX83OtFy5dNXABKGlDgmYB22T1U5zjPwFKd2++UGgtAq zFrxpa4ButmYqv/0lC45fgh0leRYMUk9HZwIg= Received: by 10.224.189.20 with SMTP id dc20mr987697qab.287.1306063097192; Sun, 22 May 2011 04:18:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.54.148 with HTTP; Sun, 22 May 2011 04:17:57 -0700 (PDT) From: Blue Swirl Date: Sun, 22 May 2011 14:17:57 +0300 Message-ID: To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.216.173 Subject: [Qemu-devel] [PATCH 5/9] m68k: use caller supplied CPUState for interrupt related stuff 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 Pass CPUState to do_interrupt(). This is needed by later patches. It would be cleaner to move the function to helper.c, but there are a few dependencies between do_interrupt() and other functions. Signed-off-by: Blue Swirl --- cpu-exec.c | 4 ++-- target-m68k/cpu.h | 3 ++- target-m68k/op_helper.c | 29 ++++++++++++++++++++++++++--- 3 files changed, 30 insertions(+), 6 deletions(-) From b14ad2f68c593655a372eb08be163a538ca4ca93 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Blue Swirl Date: Sat, 21 May 2011 07:55:24 +0000 Subject: [PATCH 5/9] m68k: use caller supplied CPUState for interrupt related stuff Pass CPUState to do_interrupt(). This is needed by later patches. It would be cleaner to move the function to helper.c, but there are a few dependencies between do_interrupt() and other functions. Signed-off-by: Blue Swirl --- cpu-exec.c | 4 ++-- target-m68k/cpu.h | 3 ++- target-m68k/op_helper.c | 29 ++++++++++++++++++++++++++--- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 1adfc29..4aa75fd 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -295,7 +295,7 @@ int cpu_exec(CPUState *env1) #elif defined(TARGET_CRIS) do_interrupt(env); #elif defined(TARGET_M68K) - do_interrupt(0); + do_interrupt(env); #elif defined(TARGET_S390X) do_interrupt(env); #endif @@ -503,7 +503,7 @@ int cpu_exec(CPUState *env1) provide/save the vector when the interrupt is first signalled. */ env->exception_index = env->pending_vector; - do_interrupt(1); + do_interrupt_m68k_hardirq(env); next_tb = 0; } #elif defined(TARGET_S390X) && !defined(CONFIG_USER_ONLY) diff --git a/target-m68k/cpu.h b/target-m68k/cpu.h index b025b66..4d8ba28 100644 --- a/target-m68k/cpu.h +++ b/target-m68k/cpu.h @@ -119,7 +119,8 @@ void m68k_tcg_init(void); CPUM68KState *cpu_m68k_init(const char *cpu_model); int cpu_m68k_exec(CPUM68KState *s); void cpu_m68k_close(CPUM68KState *s); -void do_interrupt(int is_hw); +void do_interrupt(CPUState *env1); +void do_interrupt_m68k_hardirq(CPUState *env1); /* you can call this signal handler from your SIGBUS and SIGSEGV signal handlers to inform the virtual CPU of exceptions. non zero is returned if the signal was handled by the virtual CPU. */ diff --git a/target-m68k/op_helper.c b/target-m68k/op_helper.c index 084a182..237fc4c 100644 --- a/target-m68k/op_helper.c +++ b/target-m68k/op_helper.c @@ -21,9 +21,13 @@ #if defined(CONFIG_USER_ONLY) -void do_interrupt(int is_hw) +void do_interrupt(CPUState *env1) +{ + env1->exception_index = -1; +} + +void do_interrupt_m68k_hardirq(CPUState *env1) { - env->exception_index = -1; } #else @@ -90,7 +94,7 @@ static void do_rte(void) env->aregs[7] = sp + 8; } -void do_interrupt(int is_hw) +static void do_interrupt_all(int is_hw) { uint32_t sp; uint32_t fmt; @@ -155,6 +159,25 @@ void do_interrupt(int is_hw) env->pc = ldl_kernel(env->vbr + vector); } +void do_interrupt(CPUState *env1) +{ + CPUState *saved_env; + + saved_env = env; + env = env1; + do_interrupt_all(0); + env = saved_env; +} + +void do_interrupt_m68k_hardirq(CPUState *env1) +{ + CPUState *saved_env; + + saved_env = env; + env = env1; + do_interrupt_all(1); + env = saved_env; +} #endif static void raise_exception(int tt) -- 1.7.2.5