From patchwork Fri May 25 11:28:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guan Xuetao X-Patchwork-Id: 161298 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E4B0EB6F77 for ; Fri, 25 May 2012 21:22:58 +1000 (EST) Received: from localhost ([::1]:53888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXsbf-0004ur-VD for incoming@patchwork.ozlabs.org; Fri, 25 May 2012 07:22:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXsbO-0004pm-VG for qemu-devel@nongnu.org; Fri, 25 May 2012 07:22:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXsbI-0007V6-Nr for qemu-devel@nongnu.org; Fri, 25 May 2012 07:22:38 -0400 Received: from mprc.pku.edu.cn ([162.105.203.9]:46120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXsbH-0007Uf-PS for qemu-devel@nongnu.org; Fri, 25 May 2012 07:22:32 -0400 Received: from linuxdev-32 ([162.105.203.8]) by mprc.pku.edu.cn (8.13.8/8.13.8) with ESMTP id q4PBt4N1031600; Fri, 25 May 2012 19:55:04 +0800 Received: by linuxdev-32 (Postfix, from userid 1000) id 368EE14600A7; Fri, 25 May 2012 19:29:16 +0800 (CST) From: Guan Xuetao To: qemu-devel@nongnu.org Date: Fri, 25 May 2012 19:28:59 +0800 Message-Id: <389234add14c715e5e37334419d7c493bf5f8992.1337944756.git.gxt@mprc.pku.edu.cn> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 162.105.203.9 Cc: blauwirbel@gmail.com, Guan Xuetao Subject: [Qemu-devel] [PATCH 1/9] unicore32-softmmu: make exceptions generated in unicore32 architecture 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 We need to specify the exception type in proper situations. Then it could make exceptions generated correctly and timely. Signed-off-by: Guan Xuetao --- cpu-exec.c | 1 + linux-user/main.c | 3 ++- target-unicore32/cpu.h | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 0344cd5..929b535 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -416,6 +416,7 @@ int cpu_exec(CPUArchState *env) #elif defined(TARGET_UNICORE32) if (interrupt_request & CPU_INTERRUPT_HARD && !(env->uncached_asr & ASR_I)) { + env->exception_index = UC32_EXCP_INTR; do_interrupt(env); next_tb = 0; } diff --git a/linux-user/main.c b/linux-user/main.c index 191b750..a394409 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -958,7 +958,8 @@ void cpu_loop(CPUUniCore32State *env) } } break; - case UC32_EXCP_TRAP: + case UC32_EXCP_DTRAP: + case UC32_EXCP_ITRAP: info.si_signo = SIGSEGV; info.si_errno = 0; /* XXX: check env->error_code */ diff --git a/target-unicore32/cpu.h b/target-unicore32/cpu.h index 81c14ff..66c42f5 100644 --- a/target-unicore32/cpu.h +++ b/target-unicore32/cpu.h @@ -89,8 +89,10 @@ typedef struct CPUUniCore32State { #define ASR_NZCV (ASR_N | ASR_Z | ASR_C | ASR_V) #define ASR_RESERVED (~(ASR_M | ASR_I | ASR_NZCV)) -#define UC32_EXCP_PRIV (ASR_MODE_PRIV) -#define UC32_EXCP_TRAP (ASR_MODE_TRAP) +#define UC32_EXCP_PRIV (1) +#define UC32_EXCP_ITRAP (2) +#define UC32_EXCP_DTRAP (3) +#define UC32_EXCP_INTR (4) /* Return the current ASR value. */ target_ulong cpu_asr_read(CPUUniCore32State *env1);