delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/19/15:18:16

Date: Tue, 19 Oct 1999 17:17:36 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Gisle Vanem <gvanem AT eunet DOT no>
cc: djgpp AT delorie DOT com
Subject: Re: far call
In-Reply-To: <005f01bf1a10$4d4d6560$293f8589@gv015029.bgo.nera.no>
Message-ID: <Pine.SUN.3.91.991019170705.14637C@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, 19 Oct 1999, Gisle Vanem wrote:

> Exiting due to signal SIGSEGV
> General Protection Fault at eip=00001dcc, error=01d4

If a program crashes with a GPF, and the crash message includes an error 
code, then the error code is actually the value of a selector that your 
program tried to load into one of the segment registered, and the 
selector turned out to be invalid.

So in this case, you are trying to use a selector 0x1d4, which is indeed 
invalid (it's not ring-3 selector).

The reason is probably that you didn't set correctly the descriptor for 
the selector you created (the one that is the value of bios32.selector).  
See the docs of the function __dpmi_set_descriptor_access_rights for more 
details.

(It took me exactly 5 seconds to realize what the problem is, given the 
crash dump.  In contrast, your previous message required 15 minutes of 
reading the code and looking for possible problems.  See how much easier 
it is?)

> Generating asm-output, the "lcall" looks okay. Unless 'bios32_api' is
> wrongly aligned. I didn't see that <dpmi.h> packs  '__dpmi_paddr' in
> any way.

The alignment is okay: GCC takes care of that.

> Maybe I need to modify the selector for 'execute' ? (don't think so)

I think you do need that.  In which case you will have to define two 
selectors: one for data, another for code, with the same base address 
and limit, but different descriptors.  (DJGPP does exactly that for CS 
and DS, btw.)

- Raw text -


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