www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/07/11/10:24:14

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <9607111421.AA12538@clio.rice.edu>
Subject: Re: limited nearptr ?
To: k3040e4 AT c210 DOT edvz DOT uni-linz DOT ac DOT at (Oberhumer Markus)
Date: Thu, 11 Jul 1996 09:21:20 -0600 (CDT)
Cc: djgpp-workers AT delorie DOT com
In-Reply-To: <199607111354.PAA21145@c210.edvz.uni-linz.ac.at> from "Oberhumer Markus" at Jul 11, 96 03:54:57 pm

> - is there a speed difference to nearptrs ?

nearptrs and the mapping function are identical in speed; farptrs have 
a very minor speed disadvantage

> - can I somehow avoid wasting memory (think of a card with 4 MB VRAM) ?

It's not wasted.  CWSDPMI replaces the page table entries with the ones
for the physical mapping and frees the pages if they were internally 
allocated.  If they have never been touched, it just replaces the 
never set page table entries with the new ones.  There is one exception
to this - if running on a small memory machine which pages in the 640K
area, if the pages were previously modified and must be freed, some of
the memory may be lost.  So, it's best not to map over previously used
memory if you expect to run on a machine paging in the 640K area.

Well, one thing to be aware of - malloc isn't horribly efficient, so you
could sbrk() the memory instead (use size + 4K, not 4K-1 for future align)

> - do I have to unmap or is this done automatically ?

When you exit all the PTEs are cleaned up.

> - do I have to lock the memory - and unlock it ?

No, physical devices are always locked since they can't be paged

> - what happens if video memory is alread mapped with
>   __dpmi_physical_address_mapping ?

It can be mapped as many times as you like with no real penalty
(other than using up page table entries, which use DOS/CWSDPMI internal
memory which may get exhausted in some extreme cases).

> - are there some other pitfalls (sbrk, etc.) or is this pretty safe ?

The code is probably less tested than the mainstream stuff, but it should
be exceptionally safe.

- Raw text -


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