X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: Charles Sandmann Newsgroups: comp.os.msdos.djgpp Subject: Re: segfault on context switch Date: Thu, 02 May 2002 22:25:20 CDT Organization: Rice University, Houston TX Lines: 27 Message-ID: <3cd20320.sandmann@clio.rice.edu> References: <31542 DOT 1020351804 AT www41 DOT gmx DOT net> NNTP-Posting-Host: clio.rice.edu X-Trace: joe.rice.edu 1020396685 11424 128.42.105.3 (3 May 2002 03:31:25 GMT) X-Complaints-To: abuse AT rice DOT edu NNTP-Posting-Date: 3 May 2002 03:31:25 GMT X-NewsEditor: ED-1.5.9 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > The program is reading/writing data from/to a com port using > the svasync library. No problems in plain DOS, but when I'm > running WinNT4.0 and do a context switch (Alt-TAB) while the > program is running I get a segfault in malloc(). No problems > without context switch though ... > Does that ring a bell anywhere? Is this a known WinNT "feature"? I suspect you are turfing up a known problem with Windows NT - it does not allow address wrap on selector limits. If a malloc asks for a memory block and it is returned "below" the starting address, in Win9x we just wrap the address space around (4Gb) to access it. NT won't allow this, silently fails the selector limit set, then any access to that memory (malloc) fails. Alt-Tab causes things outside the VDM to happen which causes a memory block at a low address to free up. > I'm using DJGPP v2.03 with GCC v2.95.3, binaries about 6 months old. Check your lib\crt0.o - if it is dated earlier than December 2001 try upgrading to the djdev203.zip on Simtel (refreshed version). This is one of the fixes I put in the refresh. Windows 2000 caused this problem at a much higher frequency than Windows NT so I fixed it. If you have the the updated crt0.o - it's possible that I botched the patch - a full register list/traceback might help identify the problem.