www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/26/12:03:23

From: Patrick Reilly <reillyp AT gte DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Clueless
Date: 26 Nov 1997 13:38:31 GMT
Organization: gte.net
Lines: 45
Message-ID: <65h8on$t8u$1@gte1.gte.net>
NNTP-Posting-Host: 1cust20.tnt1.columbia.mo.da.uu.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I don't get it. I'm trying the following and, with a Win95 DPMI server
(ie testing in a dos box), it poops a GPF:

1. Usual tests, etc, get DPMI switch address

2. Switch to pmode via dpmi switch address

3. Call DPMI to find out how much linear memory can be allocated (yes, I
know that I can't necessarily lock all of it) - stored in HeapSize

4. Allocate that linear memory, saving the dword handle and the dword
linear address (as pHeapInfo - a dword)

5. Allocate a selector from DPMI.

6. Set selector base to 0

7. Set selector access to page granular, big (esp vs sp), expand-up,
same DPL as the cs' CPL, etc (tried Accessed both on & off - no
difference) - ie same kinda access that DJGPP sets in STUB.ASM...

8. Set selector limit to (pHeapInfo+HeapSize)/4096-1 (ie to the end of
the allocated linear space, adjusted as pages)

Basically I *thought* this gave me a flat data selector (I tested it and
I **can** use it to directly write to the text video buffer). But when I
try to write to the first 4 bytes of pHeapInfo (using either ds or gs
with this new selector) - ie I try to write to my allocated linear
buffer - BOOM!

Test return values: HeapSize is 01D87000 (about 1.8MB) and pHeapInfo is
832EA000 (up there above 2GB - yes DPMI is certainly paging! <g>). I'm
setting the limit (page granular selector) to 85070
(((832EA000+01D87000) >> 12) - 1). I check all DPMI calls for errors -
everybody is fine until the memory write access...

The concept is to do something similar as DJGPP, but to have flat
selectors to make life easier for the masses...

Any DPMI gurus have any ideas? I've given up the idea of directly using
pmode (would not run with Windows dos boxes, EMM386, etc - probably not
too popular), so now I'm trying to live with the DPMI shortcomings (in
particular - ring 3!) but still get most of the effects I want...

Pat

- Raw text -


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