Comments: Authenticated sender is From: "George Foot" To: churchs3 AT boat DOT bt DOT com Date: Tue, 25 Aug 1998 21:47:05 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: UPDATE : Page Fault During Interupt Reply-to: george DOT foot AT merton DOT oxford DOT ac DOT uk CC: djgpp AT delorie DOT com Message-Id: Precedence: bulk On 25 Aug 98 at 14:28, JS Churchill wrote: > I have changed the _crt0_startup_flags which was > int _crt0_startup_flags = _CRT0_FLAG_NEARPTR | _CRT0_FLAG_NONMOVE_SBRK; > > it now includes _CRT0_FLAG_LOCK_MEMORY; > > it now works perfectly under DOS and windows using malloced mem > but could someone pleas tell me why it was not working without this.. > thanks in advance > Simon When you use interrupts you must ensure that DOS code is never called during the interrupt. You can easily avoid calling it directly from your handler. However, if your handler's code is not currently in physical memory then it must be paged in from disk. This would involve various DOS functions, which cannot be called, so instead we get a page fault. To prevent this from happening, you must lock all memory touched during the interrupt; this ensures that it's always in physical memory, never swapped out to disk. One way to do this is as you did above -- by forcing all memory to be locked. The other way is to use the locking functions in libc to lock specific regions of memory. Look up `_go32_dpmi_lock_code' and `_go32_dpmi_lock_data'. -- george DOT foot AT merton DOT oxford DOT ac DOT uk