Received: from eggs.gnu.org ([208.118.235.92]:54231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9QU8-0002Q3-G3 for qemu-devel@nongnu.org; Sun, 18 Mar 2012 20:30:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9QTx-0006Bp-8X for qemu-devel@nongnu.org; Sun, 18 Mar 2012 20:30:04 -0400 Received: from mail-qc0-f173.google.com ([209.85.216.173]:38621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9QTx-0006BN-4L for qemu-devel@nongnu.org; Sun, 18 Mar 2012 20:29:53 -0400 Received: by qcsc20 with SMTP id c20so1123111qcs.4 for ; Sun, 18 Mar 2012 17:29:50 -0700 (PDT) Date: Sun, 18 Mar 2012 20:29:47 -0400 From: Kevin O'Connor Message-ID: <20120319002947.GA22937@morn.localdomain> References: <20120227095156.GA24607@redhat.com> <4F4BA055.9010005@siemens.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F4BA055.9010005@siemens.com> Subject: Re: [Qemu-devel] Boot failure with MS-Dos 6.22 (due to bad BIOS build?) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: seabios , "qemu-devel@nongnu.org" On Mon, Feb 27, 2012 at 04:25:09PM +0100, Jan Kiszka wrote: > On 2012-02-27 10:51, Daniel P. Berrange wrote: > > I'm seeing current QEMU GIT fail to boot MS-Dos 6.22 with the following > > crash: > > > > # qemu-system-x86_64 -fda ~/MS-DOS\ 6.22.img -m 1 -curses > > iPXE v1.0.0-591-g7aee315 > > iPXE (http://ipxe.org) 00:03.0 C900 PCI2.10 PnP PMM+00000000+00000000 C900 > > > > Booting from Floppy.. > > . qemu: fatal: Trying to execute code outside RAM or ROM at 0x00000001000effff > > > > EAX=ffffffff EBX=ffffffff ECX=0000c934 EDX=00000068 > > ESI=00006801 EDI=00000000 EBP=0000002b ESP=0000fff5 I traced this down, and it appears to be a stack size issue. It looks like MSDOS calls "int 0x13" with 229 bytes of stack space during its boot. On my build gcc generates the handle_13() function with a maximum of 140 bytes of stack space utilized (according to tools/checkstack.py). On your build, gcc created it with a maximum of 216 bytes. The entry functions use 42 bytes of stack space. Add it up and you can see that the additional stack space that gcc used caused %esp to wrap and the stack was corrupted. I'm not sure how to best work around this. One way is to sprinkle "noinline" keywords through disk.c. (It seems like gcc got in trouble on your build by inlining many functions into disk_13().) Another way would be to jump into the extra stack (the disk code already uses its own stack) earlier in the handle_13 code. Also, can you see what happens if you change "--param large-stack-frame=4" to "--param large-stack-frame=0" in the build? -Kevin