🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.memory
Article #10

Re: What *is* a General Protection Fault

#10
From: Viet-Trung Luu
Date: Thu, 28 Sep 1995 03:22
49 lines
3254 bytes
On 26 Sep 1995, David Raymer wrote:
> >From what I know, the answer is "sort of". 'Doze *detects* such 
> >violations but does not necessarily stop them. It then kills the 
> >offending program by way of a GPF (after the damage has been done). 
> >That's why 'Doze tends to be unstable after GPFs.
> 
> Close.  The Intel x86 processors that implement memory protection (286+)
> have a processor trap, 0x0D (13) that is triggered whenever a memory
> access violation takes place (that is, accessing memory you do not own.)
> The program accessing memory it shouldn't, the processor triggers the trap.
> 
> Its possible to register a handler for a system trap, and this is how Windows,
> OS/2, and the various flavors of PC unix deal with this sort of thing.

Hey, I wasn't being technical! However, was I right in saying the 'Doze 
doesn't actually protect the memory, but just detects violations? (Which 
is one reason why 'Doze isn't a robust multitasker, I think.)

> Sorry, but not quite right.  A segmentation violation (GPF, trap 0x0D, cannot
> go undetected.  If it occurs the processor will notice it.  Now, if you 
> are running in 386 protected, or FLAT model and allocate say n bytes, where 
> n is less than 4096, then you still get a whole page.  You can walk past your
> n bytes, but when you cross the page boundary, look out, page fault, and if
> you haven't dealt with the page fault trap, segmentation fault, GPF, trap 0x0D.
> 
> If its not detected, its not a trap/GPF/seg-v.  Its just a nasty bug.
> 
> If you are in 286 (protected) mode, then you are working in segments.  You ask
> for an n byte segment, where n < 64k, and you get that many bytes.  As soon
> as you cross it, * BAMF * you're toast.  This is the only nice feature about the
> intel 286 (protected) mode.

What I want to know is where the debug information in a 'Doze program is 
stored (while running). If it's in memory that's owned by the program, then 
what I said may apply.

> Its possible that you are overrighting a page that has been allocated to hold
> debug symbols, and when you aren't debuggable, then the page isn't there, and
> * KABOOM *.

I thought that was what I was saying... ;-)

> These kinds of things aren't C++ issues, this post does not belong here,
> I did not write it. (floyd, please have mercy, don't make me a bimby...)

I agree. Please don't follow up this post. I am eternally sorry for 
replying to this post (on this newsgroup).

- Trung
Technical Details
Message-ID: <Pine.SUN.3.91.950927231513.5434D-100000@lagrange.uwaterloo.ca>
Path: arc1-ca.pugleaf.net!lagrange.uwaterloo.ca!vluu
References: <446uh6$ieu@zeus.tcp.co.uk> <Pine.SUN.3.91.950926030945.27808A-100000@napier.uwaterloo.ca> <RAYMERD.95Sep26125938@chisel>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.memory,comp.os.ms-windows.programmer.tools.mfc,comp.lang.c++
Path: arc1-ca.pugleaf.net!lagrange.uwaterloo.ca!vluu
From: Viet-Trung Luu <vluu@lagrange.uwaterloo.ca>
Subject: Re: What *is* a General Protection Fault 
Sender: news@undergrad.math.uwaterloo.ca (news spool owner)
Message-ID: <Pine.SUN.3.91.950927231513.5434D-100000@lagrange.uwaterloo.ca>
In-Reply-To: <RAYMERD.95Sep26125938@chisel> 
Date: Thu, 28 Sep 1995 03:22:29 GMT
Content-Type: TEXT/PLAIN; charset=US-ASCII
References: <446uh6$ieu@zeus.tcp.co.uk>
 <Pine.SUN.3.91.950926030945.27808A-100000@napier.uwaterloo.ca> <RAYMERD.95Sep26125938@chisel> 
Nntp-Posting-Host: lagrange.uwaterloo.ca
Mime-Version: 1.0
Organization: University of Waterloo