Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K5qcr-0005jn-O0 for qemu-devel@nongnu.org; Mon, 09 Jun 2008 19:18:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K5qcq-0005in-SQ for qemu-devel@nongnu.org; Mon, 09 Jun 2008 19:18:09 -0400 Received: from [199.232.76.173] (port=40146 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5qcq-0005iR-H6 for qemu-devel@nongnu.org; Mon, 09 Jun 2008 19:18:08 -0400 Received: from savannah.gnu.org ([199.232.41.3]:51461 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K5qcq-0008Mj-1a for qemu-devel@nongnu.org; Mon, 09 Jun 2008 19:18:08 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1K5qcp-00042M-Dw for qemu-devel@nongnu.org; Mon, 09 Jun 2008 23:18:07 +0000 Received: from edgar_igl by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1K5qcp-00042I-7L for qemu-devel@nongnu.org; Mon, 09 Jun 2008 23:18:07 +0000 MIME-Version: 1.0 Errors-To: edgar_igl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: "Edgar E. Iglesias" Message-Id: Date: Mon, 09 Jun 2008 23:18:07 +0000 Subject: [Qemu-devel] [4719] CRIS: Emulate NMIs. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4719 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4719 Author: edgar_igl Date: 2008-06-09 23:18:06 +0000 (Mon, 09 Jun 2008) Log Message: ----------- CRIS: Emulate NMIs. Modified Paths: -------------- trunk/cpu-exec.c trunk/target-cris/cpu.h trunk/target-cris/helper.c Modified: trunk/cpu-exec.c =================================================================== --- trunk/cpu-exec.c 2008-06-09 23:07:50 UTC (rev 4718) +++ trunk/cpu-exec.c 2008-06-09 23:18:06 UTC (rev 4719) @@ -501,10 +501,18 @@ next_tb = 0; } #elif defined(TARGET_CRIS) - if (interrupt_request & CPU_INTERRUPT_HARD) { + if (interrupt_request & CPU_INTERRUPT_HARD + && (env->pregs[PR_CCS] & I_FLAG)) { + env->exception_index = EXCP_IRQ; do_interrupt(env); next_tb = 0; } + if (interrupt_request & CPU_INTERRUPT_NMI + && (env->pregs[PR_CCS] & M_FLAG)) { + env->exception_index = EXCP_NMI; + do_interrupt(env); + next_tb = 0; + } #elif defined(TARGET_M68K) if (interrupt_request & CPU_INTERRUPT_HARD && ((env->sr & SR_I) >> SR_I_SHIFT) Modified: trunk/target-cris/cpu.h =================================================================== --- trunk/target-cris/cpu.h 2008-06-09 23:07:50 UTC (rev 4718) +++ trunk/target-cris/cpu.h 2008-06-09 23:18:06 UTC (rev 4719) @@ -29,12 +29,11 @@ #define ELF_MACHINE EM_CRIS -#define EXCP_MMU_EXEC 0 -#define EXCP_MMU_READ 1 -#define EXCP_MMU_WRITE 2 -#define EXCP_MMU_FLUSH 3 -#define EXCP_MMU_FAULT 4 -#define EXCP_BREAK 16 /* trap. */ +#define EXCP_NMI 1 +#define EXCP_GURU 2 +#define EXCP_BUSFAULT 3 +#define EXCP_IRQ 4 +#define EXCP_BREAK 5 /* Register aliases. R0 - R15 */ #define R_FP 8 @@ -54,11 +53,14 @@ #define PR_EBP 9 #define PR_ERP 10 #define PR_SRP 11 +#define PR_NRP 12 #define PR_CCS 13 #define PR_USP 14 #define PR_SPC 15 /* CPU flags. */ +#define Q_FLAG 0x80000000 +#define M_FLAG 0x40000000 #define S_FLAG 0x200 #define R_FLAG 0x100 #define P_FLAG 0x80 @@ -154,7 +156,6 @@ uint32_t lo; } tlbsets[2][4][16]; - int features; int user_mode_only; CPU_COMMON Modified: trunk/target-cris/helper.c =================================================================== --- trunk/target-cris/helper.c 2008-06-09 23:07:50 UTC (rev 4718) +++ trunk/target-cris/helper.c 2008-06-09 23:18:06 UTC (rev 4719) @@ -78,13 +78,13 @@ miss = cris_mmu_translate(&res, env, address, rw, mmu_idx); if (miss) { - if (env->exception_index == EXCP_MMU_FAULT) + if (env->exception_index == EXCP_BUSFAULT) cpu_abort(env, "CRIS: Illegal recursive bus fault." "addr=%x rw=%d\n", address, rw); - env->exception_index = EXCP_MMU_FAULT; + env->exception_index = EXCP_BUSFAULT; env->fault_vector = res.bf_vec; r = 1; } @@ -120,17 +120,20 @@ env->pregs[PR_ERP] = env->pc + 2; break; - case EXCP_MMU_FAULT: + case EXCP_NMI: + /* NMI is hardwired to vector zero. */ + ex_vec = 0; + env->pregs[PR_CCS] &= ~M_FLAG; + env->pregs[PR_NRP] = env->pc; + break; + + case EXCP_BUSFAULT: ex_vec = env->fault_vector; env->pregs[PR_ERP] = env->pc; break; default: - /* Is the core accepting interrupts? */ - if (!(env->pregs[PR_CCS] & I_FLAG)) - return; - /* The interrupt controller gives us the - vector. */ + /* The interrupt controller gives us the vector. */ ex_vec = env->interrupt_vector; /* Normal interrupts are taken between TB's. env->pc is valid here. */