From: russell DOT thamm AT dsto DOT defence DOT gov DOT au Newsgroups: comp.os.msdos.djgpp Subject: Re: UPDATE : Page Fault During Interupt Date: Wed, 26 Aug 1998 04:01:41 GMT Organization: Deja News - The Leader in Internet Discussion Lines: 41 Message-ID: <6s01b5$10v$1@nnrp1.dejanews.com> References: NNTP-Posting-Host: 203.5.217.4 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In article , george DOT foot AT merton DOT oxford DOT ac DOT uk wrote: > 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'. > It appears that under a DOS box (Win95) that virtual memory is disabled, contrary to many claims that I have seen. If you don't need virtual memory, you can disable it in CWSDPMI ("" for swap file) or use CWSDPR0. Of course, if you need virtual memory, you are stuck with locking code. > -- > george DOT foot AT merton DOT oxford DOT ac DOT uk > -----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum