www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/15/20:22:46

Date: Sat, 16 Nov 1996 14:00:20 +0000
From: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
Subject: Re: Memory Protection
To: Glen Miner <gminer AT ca DOT newbridge DOT com>
Cc: DJ Delorie <dj AT delorie DOT com>, djgpp AT delorie DOT com
Reply-to: billc AT blackmagic DOT tait DOT co DOT nz
Message-id: <328DC8F4.3C96@blackmagic.tait.co.nz>
Organization: Tait Electronics NZ
MIME-version: 1.0
References: <Pine DOT SUN DOT 3 DOT 90 DOT 961115123053 DOT 21409A-100000 AT coop10>

Glen Miner wrote:
> 
> > > Ahh, this makes sense now. I suppose my next question is: how does the
> > > dosmem put/get  functions get around this? Do they resize before and
> > > after? Wouldn't this be painfully inneffeicient?
> >
> > They use a different segment, which overlaps the DOS memory instead of
> > the program's memory.
> 
> Ahh, I see. I don't know much about pmode programming, but I know real
> mode inside and out, and this is starting to make more sense.
> 
> > For further protection, you can create a segment that covers only the
> > video memory and use that instead.
> 
> How would this be done? This would be ideal; if you could setup another
> segment (a 64k window to vidoe memory), and it would be "unprotected",
> then you could just use the movedata function with that segment's
> selector, right?
> 

Here is a code snipet to set up the video selector (it's part of my text
lib which I'm thinking
of releasing soon as it seems to be pretty stable).

-----------------------

unsigned short screenSelector; /* selector to use with the various _far*
and movedata functions*/

void TxSetupSelector()
{
    static char selectorData[8]={
        0xff,0xff,0x00,0x80,
        0x0b,0xf3,0x40,0x00
    };
    if (screenSelector) return;
    screenSelector=__dpmi_allocate_ldt_descriptors(1);
    if (__dpmi_set_descriptor(screenSelector,selectorData)<0) abort();
/*    ScreenContext.buffer.selector=screenSelector;*/
}

-------------------------

Yes, this selector can be used with movedata (and the _far* in
<sys/farptr.h>).
Bill
-- 
Leave others their otherness.

- Raw text -


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