www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/29/05:34:34

Date: Thu, 29 Aug 1996 02:31:36 -0700 (PDT)
From: Samuel Vincent <svincent AT cs DOT sonoma DOT edu>
To: larsen AT sunset DOT cs DOT utah DOT edu
cc: djgpp AT delorie DOT com
Subject: Re: Program crash
In-Reply-To: <4vihag$4ol@magus.cs.utah.edu>
Message-ID: <Pine.GSO.3.94.960829022018.24967C-100000@zippy>
MIME-Version: 1.0

On 22 Aug 1996, Steve Larsen wrote:

> Hi all,
> 
> Please excuse my ignorance, but I am having a problem that I could use
> some help with.  I have a program which gives me a GPF sometimes when
> I exit.  It only does it sometimes, and the dump is kind of strange (no
> stack trace).  Here it is:
> 
> General Protection Fault in RMCB at eip=fef; flags=3002
> eax=012b0001 ebx=00002398 ecx=00000000 edx=00030aad esi=00004c84 edi=00003464
> ebp=00000000 esp=00003450 cs=2b ds=3b es=33 fs=33 gs=0 ss=33 error=00a4
> 
> I would appreciate any help/insight people could offer.

[snip]

RMCB = Real Mode Callback..   You still have the real mode interrupt
hooked when your program exits to dos.  The reason it gets to the RMCB is
upon exiting to dos, your program is still in memory.. (that which wasn't
overwritten by other things..  since nothing else has been run.. most of
it is still ok.)  So somewhere in your real mode routine, you were having
it do the real mode callback, which would execute something in protected
mode, and go back to finish whatever it was in realmode for in the first
place...  When it went to switch to protected mode, since your DJGPP
program had already exited and the various selectors were nuked, it had
nowhere to go...  

The bottom line is make sure you first set the interrupt vector back to
the saved value, then you can do the rest of the cleanup...

Oh, one other thing.  You don't need a real mode interrupt routine at all
for hardware interrupts.  They are automatically reflected back to
protected mode.  If you have the protected mode interrupt hooked, your
real mode routine will _never_ get touched (unless you explicitly call it
yourself somehow.)

Well then why is it getting called when it crashes your system?  This is
because you are now in realmode without the DPMI host reflecting the
interrupts to protected mode for you.  As far as the system cares, there
is no protected mode.  Just dos and real mode.  I recommend you nuke the
realmode interrupts handler altogether for hardware interrupts.  You won't
miss a single interrupt...

-Sam


- Raw text -


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