Xref: news2.mv.net comp.os.msdos.djgpp:4003 From: Charles Sandmann Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP/Allegro/Memory Problem? Date: Sat, 18 May 1996 21:35:29 CDT Organization: Rice University, Houston, Texas Lines: 15 Message-ID: <319e88f1.sandmann@clio.rice.edu> References: <4nei97$gr5 AT madeline DOT INS DOT CWRU DOT Edu> Reply-To: sandmann AT clio DOT rice DOT edu NNTP-Posting-Host: clio.rice.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp > Page fault cr2=10030028 at eip12e8; flags 3046 > eax=00000502 ebx=0002f278 ecx=00000000 edx=00030000 esi=00001003 edi=10030000 > ebp=00000000 esp=00001270 cs=a7 ds=af es=af fs=0 gs=0 ss=af error=0004 It appears none of the recommendations to fix this helped, so I looked at the above error message in more detail and found the problem. It's a bug in our crt0.s stub. In particular, we sbrk() memory for the stubinfo structure, and if you are really unlucky (your program ends up too close to a 64K boundary that it ends up being allocated in a different memory zone) it gets deallocated before we get the final tidbit of info from it to exit. A workaround would be to add some additional code/static memory to the program which would move the sbrk() problem. Another workaround would be to use unixy sbrk() if you aren't using near pointers/hw interrupts. A more permanent fix will take some hacking on crt0 ...