From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hlahn-00010K-Ax for qemu-devel@nongnu.org; Tue, 08 May 2007 21:10:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hlahj-0000zN-Uu for qemu-devel@nongnu.org; Tue, 08 May 2007 21:10:59 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hlahj-0000zK-Nw for qemu-devel@nongnu.org; Tue, 08 May 2007 21:10:55 -0400 Received: from phoenix.bawue.net ([193.7.176.60] helo=mail.bawue.net) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Hlaaa-0007nU-86 for qemu-devel@nongnu.org; Tue, 08 May 2007 21:03:32 -0400 Date: Wed, 9 May 2007 02:04:25 +0100 Subject: Re: [Qemu-devel] bug: qemu-0.9.0 emulating mipsel (32-bit R3000) on amd64 Message-ID: <20070509010425.GC27336@networkno.de> References: <463E2234.3040508@BitWagon.com> <20070506200452.GA32686@networkno.de> <46410CAF.50809@BitWagon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46410CAF.50809@BitWagon.com> From: Thiemo Seufer Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Reiser Cc: qemu-devel@nongnu.org John Reiser wrote: > >>qemu-0.9.0 ... > >>emulating Debian 2.6.18-4-qemu mipsel ... > >>errs when gdb 6.4.90-debian (running on the emulated mipsel) > >>single-steps the user-mode instruction ... > > > This looks like another instance of "Qemu/MIPS doesn't handle > > self-modifying code correctly" (the break instructions inserted > > by gdb are exactly this). > > No, the usage by gdb does *not* qualify as "self-modifying code." In the context of Qemu system emulation it does... > gdb uses the system call ptrace(PTRACE_POKETEXT, pid, addr, data) > to have the emulated operating system kernel itself modify the memory > of the child process. ... since "child processes" etc. run by the guest kernel are just a foreign thing to Qemu. > Nobody has to guess or to "snoop" the memory > bus in order to discover that the instruction stream is being modified. > Instead, there is direct notification of what is happening. The Linux kernel happily does cache flushes, and Qemu happily ignores them, since it doesn't implement a cache model. (A cache model is not the answer. It would be slow, it would only paper over the problem, it wouldn't help for uncached accesses or cacheless systems). > If nothing > else, then under CONFIG_QEMU the implementation of sys_ptrace() > must notify the emulator to flush the appropriate translations. Hacking special facilities in the guest kernel just to work around a Qemu bug is IMHO the wrong approach. Thiemo