Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CUZOM-0001E3-9m for qemu-devel@nongnu.org; Wed, 17 Nov 2004 18:39:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CUZOL-0001Dr-RH for qemu-devel@nongnu.org; Wed, 17 Nov 2004 18:39:14 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CUZOL-0001Do-Ok for qemu-devel@nongnu.org; Wed, 17 Nov 2004 18:39:13 -0500 Received: from [212.63.36.242] (helo=gwyn.kn-bremen.de) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CUZFM-0004Dw-7D for qemu-devel@nongnu.org; Wed, 17 Nov 2004 18:30:00 -0500 From: Juergen Lock Date: Thu, 18 Nov 2004 00:42:38 +0100 Subject: Re: [Qemu-devel] FreeSBIE-20040919, ffreep insn Message-ID: <20041118004238.A28523@saturn.kn-bremen.de> References: <20041117214607.A21330@saturn.kn-bremen.de> <419BC9FD.5000901@bellard.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <419BC9FD.5000901@bellard.org> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fabrice Bellard Cc: qemu-devel@nongnu.org On Wed, Nov 17, 2004 at 11:18:55PM +0000, Fabrice Bellard wrote: > I don't think ffreep is used by the software you tried. It must be a bug > which yields a jump in a data section. Mmmh it certainly does look like genuine code... root@FreeSBIE:~# gdb /usr/X11R6/bin/Xorg Xorg.core GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-marcel-freebsd"...(no debugging symbols found)... Core was generated by `Xorg'. Program terminated with signal 4, Illegal instruction. Reading symbols from /lib/libz.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/libz.so.2 Reading symbols from /lib/libm.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/libm.so.2 Reading symbols from /usr/X11R6/lib/libXau.so.0...(no debugging symbols found)...done. Loaded symbols for /usr/X11R6/lib/libXau.so.0 Reading symbols from /usr/X11R6/lib/libXdmcp.so.0...(no debugging symbols found)...done. Loaded symbols for /usr/X11R6/lib/libXdmcp.so.0 Reading symbols from /lib/libc.so.5...(no debugging symbols found)...done. Loaded symbols for /lib/libc.so.5 Reading symbols from /libexec/ld-elf.so.1...(no debugging symbols found)...done. Loaded symbols for /libexec/ld-elf.so.1 #0 0x0807b1e0 in configMonitor () (gdb) disassemble configMonitor Dump of assembler code for function configMonitor: 0x0807ad50 : push %ebp 0x0807ad51 : mov $0x3,%ecx 0x0807ad56 : fldz 0x0807ad58 : cld 0x0807ad59 : mov %esp,%ebp 0x0807ad5b : push %edi 0x0807ad5c : lea 0xffffffd8(%ebp),%edi 0x0807ad5f : push %esi 0x0807ad60 : push %ebx 0x0807ad61 : sub $0x5c,%esp 0x0807ad64 : mov %eax,0xffffffd4(%ebp) 0x0807ad67 : xor %eax,%eax 0x0807ad69 : repz stos %eax,%es:(%edi) 0x0807ad6b : fstps 0xffffffc8(%ebp) 0x0807ad6e : mov 0x4(%edx),%eax ... 0x0807b0d1 : mov 0xffffffd0(%ebp),%eax 0x0807b0d4 : fldl 0x8193da0 0x0807b0da : fld %st(0) 0x0807b0dc : mov 0xffffffd4(%ebp),%ebx 0x0807b0df : flds 0xa4(%eax) 0x0807b0e5 : fld %st(0) 0x0807b0e7 : mov %esi,0x98(%ebx) 0x0807b0ed : fucomip %st(3),%st 0x0807b0ef : jbe 0x807b1e0 0x0807b10e : mov 0xffffffd4(%ebp),%eax ... 0x0807b1e0 : ffreep %st(0) 0x0807b1e2 : mov 0xffffffd4(%ebp),%edx 0x0807b1e5 : flds 0x9c(%edx) 0x0807b1eb : mov 0xffffffd0(%ebp),%ebx 0x0807b1ee : flds 0xa8(%ebx) 0x0807b1f4 : fld %st(0) 0x0807b1f6 : fucomip %st(3),%st 0x0807b1f8 : ja 0x807b10e 0x0807b1fe : ffreep %st(0) ---Type to continue, or q to quit--- 0x0807b200 : mov 0xffffffd0(%ebp),%edx 0x0807b203 : flds 0xac(%edx) 0x0807b209 : fld %st(0) 0x0807b20b : fucomip %st(3),%st 0x0807b20d : ja 0x807b12a ... > ffreep is not documented and it > does not work on every CPU (I get an invalid instruction exception on > P4), so I propose not to implement it. http://webster.cs.ucr.edu/AsmTools/NASM/Doc/NASMDOCA.HTM says its P6, like fucomip which is also used by the code above (and which qemu knows). Juergen