Received: from eggs.gnu.org ([208.118.235.92]:34439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SS9HA-0008It-Nc for qemu-devel@nongnu.org; Wed, 09 May 2012 11:58:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SS9H1-0007Ij-JG for qemu-devel@nongnu.org; Wed, 09 May 2012 11:58:04 -0400 Received: from nm17-vm0.bullet.mail.ac4.yahoo.com ([98.139.53.208]:42916) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1SS9H1-0007IZ-Bg for qemu-devel@nongnu.org; Wed, 09 May 2012 11:57:55 -0400 References: <1336406325.86421.YahooMailNeo@web130104.mail.mud.yahoo.com> <20120508005521.GA14087@morn.localdomain> <1336495676.9684.YahooMailNeo@web130104.mail.mud.yahoo.com> <20120508220631.GA28784@morn.localdomain> Message-ID: <1336579073.87968.YahooMailNeo@web130105.mail.mud.yahoo.com> Date: Wed, 9 May 2012 08:57:53 -0700 (PDT) From: =?iso-8859-1?Q?Alain_Ribi=E8re?= In-Reply-To: <20120508220631.GA28784@morn.localdomain> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="1819627952-1322941879-1336579073=:87968" Subject: [Qemu-devel] Re : Re : [SeaBIOS] : Memory problem with Qemu/SeaBIOS Reply-To: =?iso-8859-1?Q?Alain_Ribi=E8re?= List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin O'Connor Cc: "seabios@seabios.org" , "qemu-devel@nongnu.org" --1819627952-1322941879-1336579073=:87968 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Tanks for your answer.=0A=0A=0AI have to apologize, I made a mistake. I rec= hecked my application and used git bisect.=0ASo I found that this is not a = SeaBIOS issue (actually it's more a C-DOS issues...). My problem comes from= this Qemu commit :=0A=0A49669fc551e0ccd2310a9584a9b7343a0bcae477 is the fi= rst bad commit=0Acommit 49669fc551e0ccd2310a9584a9b7343a0bcae477=0AAuthor: = Glauber Costa =0ADate:=A0=A0 Thu Apr 23 15:20:55 2009 -= 0400=0A=0A=A0=A0=A0 suport device driver initialization model=0A=A0=A0=A0 = =0A=A0=A0=A0 According to PnP specification, Appendix B, Option ROMs=0A=A0= =A0=A0 that support DDIM (device driver initialization model) should=0A=A0= =A0=A0 have their memory space writeable.=0A=A0=A0=A0 =0A=A0=A0=A0 KVM devi= ates from us here, by removing the IO_MEM_ROM flag,=0A=A0=A0=A0 to allow fo= r PCI option ROMs (they require DDIM). However,=0A=A0=A0=A0 there's absolut= ely no reason we can't do the same.=0A=A0=A0=A0 =0A=A0=A0=A0 Signed-off-by:= Glauber Costa =0A=A0=A0=A0 Signed-off-by: Anthony Ligu= ori =0A=0A:040000 040000 5186361da34236c2680af6ed568b5= f5bdb2915ac c968308168e23ffa2678011ed2ff010389b528bd M=A0=A0=A0=A0=A0 hw=0A= =0Adiff --git a/hw/pc.c b/hw/pc.c=0Aindex 61f6e7b..340b313 100644=0A--- a/h= w/pc.c=0A+++ b/hw/pc.c=0A@@ -920,7 +920,8 @@ static void pc_init1(ram_addr_= t ram_size, int vga_ram_size,=0A=A0=0A=A0=A0=A0=A0 option_rom_offset =3D qe= mu_ram_alloc(0x20000);=0A=A0=A0=A0=A0 oprom_area_size =3D 0;=0A-=A0=A0=A0 c= pu_register_physical_memory(0xc0000, 0x20000, option_rom_offset);=0A+=A0=A0= =A0 cpu_register_physical_memory(0xc0000, 0x20000,=0A+=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= option_rom_offset | IO_MEM_ROM);=0A=A0=0A=A0=A0=A0=A0 if (using_vga) {=0A= =A0=A0=A0=A0=A0=A0=A0=A0 /* VGA BIOS load */=0A=0A=0AAlso I found the theor= ical memory map of the C-DOS in the documentation of my legacy application = :=0Astart=A0=A0=A0 =A0=A0=A0=A0 end=0A=0A000000=A0=A0=A0 9FFFF=A0=A0=A0 Pro= gram area=0A=0A0A0000=A0=A0=A0 0BFFFF=A0=A0=A0 Video memory=0A=0A0C00000=A0= =A0=A0 0C7FFF=A0=A0=A0 BIOS graphic card=0A0C8000=A0=A0=A0 0CBFFF=A0=A0=A0 = BIOS cache controller=0A0CC000=A0=A0=A0 0CFFFF=A0=A0=A0 BIOS removable disk= =0A0D0000=A0=A0=A0 0D3FFF=A0=A0=A0 BIOS network adapter=0A0D4000=A0=A0=A0 0= EFFFF=A0=A0=A0 CDOS system=0A0F0000=A0=A0=A0 0FFFFF=A0=A0=A0 ROM BIOS=0A=0A= I wonder what is the CDOS system at 0D4000... It seems a bit strange.=0A=0A= =0AI do not understand why this commit affects the C-DOS memory allocation.= =0ABut you're probably right, C-DOS is using memory addresses he shouldn't = for it's own purpose causing conflicts...=0A=0AIf you have any idea.=0A=0A= =0AThanks, and sorry again for the wrong issue (I will remove the SeaBIOS m= ailing list in the future mails)...=0A=0A=0AAlain=0A=0A=0A_________________= _______________=0A=0AOn Tue, May 08, 2012 at 09:47:56AM -0700, Alain Ribi= =E8re wrote:=0A> Thanks for your answer.=0A> =0A> Here is the debug log in = attachement.=0A> I disabled the debug on the screen shot I sent because I n= oticed I could get a bit more memory without it.=0A> With the debug on, I g= ot :=0A> Banked Window=A0 416K at 3800:0 segment=0A> and a free memory of 1= 5680K=0A> =0A> I'll try to find what confuses C-DOS. It reacts a bit strang= ely... =0A> When I add or remove options from the SeaBIOS, the memory avala= ible =0A> change and the size of banked window changes too. So I hoped ther= e was a way to have enough memory to run my application...=0A=0AThe options= don't impact SeaBIOS' memory usage, so this reafirms my=0Aguess that what = you are seeing is a secondary effect.=A0 As a guess,=0Athis could be stack = usage - some old program call the bios with very=0Asmall stacks and if the = stack overflows silent corruption can occur.=0AThe fact that you're seeing = different memory layouts with random=0Achanges to config options could be d= ue to different options causing=0Athe compiler to layout the stack slightly= differently and thus causing=0Aslightly different corruption - just a gues= s.=0A=0AThe other thing I noticed with your C-DOS image is that it doesn't= =0Aknow about the EBDA and uses that memory for its own purposes.=A0 Thus,= =0Athe seabios runtime usage of the ebda along with c-dos could cause=0Acon= flicts.=A0 I don't think this is the cause of your current issue=0Athough a= s some moving the ebda in some quick tests I ran doesn't seem=0Ato impact t= he output of "stop".=0A=0A> Otherwise, I will have to stuck with Qemu 0.11 = and PC-BIOS.=0A> =0A> Do you know if there is any DOS utility to get the me= mory map ?=0A=0AI'm not familiar with DOS utilities.=A0 You could ask on th= e freedos=0Amailing list.=0A=0A-Kevin --1819627952-1322941879-1336579073=:87968 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Tanks for = your answer.

I have to apologize, I mad= e a mistake. I rechecked my application and used git bisect.
So I= found that this is not a SeaBIOS issue (actually it's more a C-DOS issues.= ..). My problem comes from this Qemu commit :

4966= 9fc551e0ccd2310a9584a9b7343a0bcae477 is the first bad commit
commit 4966= 9fc551e0ccd2310a9584a9b7343a0bcae477
Author: Glauber Costa <glommer@r= edhat.com>
Date:   Thu Apr 23 15:20:55 2009 -0400

&n= bsp;   suport device driver initialization model
  &= nbsp;
    According to PnP specification, Appendix B, Op= tion ROMs
    that support DDIM (device driver initializa= tion model) should
    have their memory space writeable.
   
    KVM deviates from = us here, by removing the IO_MEM_ROM flag,
    to allow fo= r PCI option ROMs (they require DDIM). However,
    there= 's absolutely no reason we can't do the same.
   
&nb= sp;   Signed-off-by: Glauber Costa <glommer@redhat.com>
=     Signed-off-by: Anthony Liguori <aliguori@us.ibm.com&g= t;

:040000 040000 5186361da34236c2680af6ed568b5f5bdb2915ac c96830816= 8e23ffa2678011ed2ff010389b528bd M      hw

diff --git a/hw/pc.c b/hw/pc.c
index 61f6e7b..340b313 1= 00644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -920,7 +920,8 @@ static void = pc_init1(ram_addr_t ram_size, int vga_ram_size,
 
  &n= bsp;  option_rom_offset =3D qemu_ram_alloc(0x20000);
  &n= bsp;  oprom_area_size =3D 0;
-    cpu_register_physical_memory(0xc0000, 0x20000, option_rom_offset);
+&nb= sp;   cpu_register_physical_memory(0xc0000, 0x20000,
+ &n= bsp;            = ;            &n= bsp;      option_rom_offset | IO_MEM_ROM);
&nbs= p;
     if (using_vga) {
    =      /* VGA BIOS load */

A= lso I found the theorical memory map of the C-DOS in the documentation of m= y legacy application :
start   = ;      end
000000   = 9FFFF    Program area
=
0A0000  = ;  0BFFFF    Video memory
0C00000 &nb= sp;  0C7FFF    BIOS graphic = card
0C8000=     0CBFFF    BIOS= cache controller
0CC000    0CFFFF &nbs= p;  BIOS removable disk
0D0000    0D3FFF    BIOS network adapter
0D4000    0EFFFF    CDOS system
0F0000    0FFFFF    ROM BIOS

I wonder what is the CDOS sy= stem at 0D4000... It seems a bit strange.

I do not understand why this commit affects the C-DOS memory allocation.=
But you're probably right, C-DOS is using memory addresses he sh= ouldn't for it's own purpose causing conflicts...
If you have any idea.
<= div>
Thanks, a= nd sorry again for the wrong issue (I will remove the SeaBIOS mailing list = in the future mails)...

Alain
=


On Tue, May 08, 2012 at 09:47:56AM -0700, Alain Ribi=E8re wrote:
> = Thanks for your answer.
>
> Here is the debug log in attacheme= nt.
> I disabled the debug on the screen shot I sent because I notice= d I could get a bit more memory without it.
> With the debug on, I go= t :
> Banked Window  416K at 3800:0 segment
> and a free m= emory of 15680K
>
> I'll try to find what confuses C-DOS. It r= eacts a bit strangely...
> When I add or remove options from the Sea= BIOS, the memory avalaible
> change and the size of banked window ch= anges too. So I hoped there was a way to have enough memory to run my appli= cation...

The options don't impact SeaBIOS' memory usage, so this re= afirms my
guess that what you are seeing is a secondary effect.  As= a guess,
this could be stack usage - some old program call the bios with very
small stacks and if the stack overflows silent corruption can= occur.
The fact that you're seeing different memory layouts with random=
changes to config options could be due to different options causing
= the compiler to layout the stack slightly differently and thus causing
s= lightly different corruption - just a guess.

The other thing I notic= ed with your C-DOS image is that it doesn't
know about the EBDA and uses= that memory for its own purposes.  Thus,
the seabios runtime usage= of the ebda along with c-dos could cause
conflicts.  I don't think= this is the cause of your current issue
though as some moving the ebda = in some quick tests I ran doesn't seem
to impact the output of "stop".
> Otherwise, I will have to stuck with Qemu 0.11 and PC-BIOS.
&= gt;
> Do you know if there is any DOS utility to get the memory map = ?

I'm not familiar with DOS utilities.  You could ask on the freedos
mailing list.

-Kevin


--1819627952-1322941879-1336579073=:87968--