www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/10/22:31:11

Xref: news2.mv.net comp.os.msdos.djgpp:5839
From: Charles Sandmann <sandmann AT clio DOT rice DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Catch protection violations?
Date: Wed, 10 Jul 1996 20:15:29 CDT
Organization: Rice University, Houston, Texas
Lines: 29
Message-ID: <31e455b1.sandmann@clio.rice.edu>
References: <4rvaqo$a9 AT news2 DOT delphi DOT com>
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

> In djgpp V2., is it possible to write a handler for protection violations?

Yes, see signal() docs.   If you want more machine info, you can look at
__djgpp_exception_state.

>   movl  %eax-2^24, %ebx      ; fault if type is not cons

Should work OK.

> Second question: Is there any control over page protection? 

Sure, see mprotect().  Must be aligned on 4K pages, so pad and align.
But this only will work under a DPMI 1.0 extension provider, like
CWSDPMI.  Ignored for other providers.

> Can I load data at runtime, then set those pages to read-only? 

Sure.  Same routine as above.  Rarely used, beware of bugs.  Same
limitations.

> Does Djgpp remember the origin of read-only pages? Since they came from
> the executable image file, they don't need to be allocated any 
> 'backing store' in the page file. They don't need to be written out!

Sorry, doesn't work that way in V2.  There aren't any read-only pages
by default (since most dpmi's don't support them).  Humm, actually,
I don't think anyone has probably tried paging readonly pages.  For all
I know, CWSDPMI will puke if you try it.  Never tested it, don't remember
if I designed for it either...

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019