From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FbMrE-0000Cy-QF for qemu-devel@nongnu.org; Wed, 03 May 2006 15:17:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FbMrE-0000Bd-48 for qemu-devel@nongnu.org; Wed, 03 May 2006 15:17:56 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FbMrD-0000BL-R6 for qemu-devel@nongnu.org; Wed, 03 May 2006 15:17:55 -0400 Received: from [84.96.92.56] (helo=smTp.neuf.fr) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FbMrf-0005aN-5r for qemu-devel@nongnu.org; Wed, 03 May 2006 15:18:23 -0400 Received: from [84.102.211.51] by sp604003mt.gpm.neuf.ld (Sun Java System Messaging Server 6.2-5.05 (built Feb 16 2006)) with ESMTP id <0IYP00AIAEUEW0A0@sp604003mt.gpm.neuf.ld> for qemu-devel@nongnu.org; Wed, 03 May 2006 21:15:50 +0200 (CEST) Date: Wed, 03 May 2006 21:15:08 +0200 From: Fabrice Bellard Subject: Re: [Qemu-devel] MIPS interrupt handling In-reply-to: <20060502234421.GK5004@networkno.de> Message-id: <4459013C.4040002@bellard.org> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT References: <4457DD1F.7040307@bellard.org> <20060502234421.GK5004@networkno.de> 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 Thiemo Seufer wrote: > Fabrice Bellard wrote: > >>I just looked at the MIPS file target-mips/op_helper.c and I don't >>understand why IRQs need to be handled in op_helper.c:do_mtc0() with reg >>= 12. > > > Register 12 is the cp0_status register, it defines which interrupts are > masked/enabled/disabled. Btw, I have a patch which moves this to op.c, > this should improve performance a bit (and avoids the TB stop for > most mtc0 writes). op.c should only contain small functions so it is not a good idea. TB stop after mtc0 is needed at least when the TLB are modified or to handle the interrupts. The current handling of interrupts in mtc0 must be suppressed ASAP as it is not useful and complicates the code. >>IMHO, the corresponding code should be deleted because the TB is >>forced to terminate after mtc0 so that the IRQs can be handled in the >>main loop in cpu-exec.c. >> >>Moreover, clearing CPU_INTERRUPT_HARD in do_mtc0() is almost surely a bug ! > > > Somehow the interrupt assert has to be prevented when St0_IE is cleared. > That's probably also a job for the main loop, but there may be a race > condition (haven't looked yet). Empirically, it works well. :-) If ST0_IE means interrupt enable, the interrupt assert must not be suppressed, but I did not read yet this part of the MIPS spec... Fabrice.