From: Roman Suzi Newsgroups: comp.os.msdos.djgpp Subject: Re: General Protection Fault interception vs. Checking stack Date: Sat, 08 Nov 97 20:37:11 +0300 Distribution: su Organization: unknown Message-ID: Sender: news-service AT sampo DOT karelia DOT ru Reply-To: nuser AT rsuzi DOT pgu DOT karelia DOT ru Lines: 52 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hi! Eli Zaretskii wrote: > >It is possible that you overrun the stack so deeply (1MB vs 256KB) that >your stack begins to overwrite the data and code of the rest of the >program. Such extreme cases are hardly interesting, I think. If you >know your program needs that much stack, you can always define an >appropriate value for `_stklen'. The interesting cases are those where >the stack is overrun by relatively small number of bytes (say, up to >100K). Yes, you are right!!! When I specified 20000, I got completely different picture of raws of garbage chars on screen. When I specified 12000, stack was OK. When ii=13200, the problem reappeared, with the same syndroms. (It is interesting also, that after some time (approx 1 min), control returns to NortonCommander (or DOS prompt) !!! But only to show static picture till RESET.) So, my problem is from 'interesting' ones. The essense of the problem is, that SIGSEGV catches exception only in some simple cases ( alloca(1000000) ). But not in more important ones with deep recursive calls and under interrupt handling (with need to switch to the real-mode, I guess). I have also tried to run the program from Windows 3.11. The result: instant reboot. Unfortunately, I never programmed for protected mode before. So its hard for me to say how GP works. I thought, for example, that every "segment" is somehow isolated by "foreign" pieces of memory. When %esp goes into that pad of memory, exception is being issued... Roman. -- -- * -- -- Roman A. Suzi * Petrozavodsk Karelia Russia -- -- http://sampo.karelia.ru/~rnd --