ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/10/31/12:17:33

Xref: news-dnh.mv.net comp.os.msdos.djgpp:2962
Path: news-dnh.mv.net!mv!news.sprintlink.net!news.Edu.TW!news.cc.nctu.edu.tw!serv.HiNet.net!news.uoregon.edu!cs.uoregon.edu!usenet.ee.pdx.edu!not-for-mail
From: idr AT cs DOT pdx DOT edu (Ian D Romanick)
Newsgroups: comp.os.msdos.djgpp
Subject: Linear frame buffer idea and questions
Date: 30 Oct 1995 15:46:41 -0800
Lines: 59
Nntp-Posting-Host: sarin.cs.pdx.edu
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

Ok, I've seen many posts to this group and others about using the MMU to
create a linear frame buffer.  Most people seem to think that it is
possible to do using DPMI 1.0.  However, I have yet to see ANYONE post
any sort of a suggestion as to HOW.  Well, I've done a little research
and have some ideas, but there's still a few things that I'm not quite
sure of.  So, I'm going to explain how I think it should be done, and
let the coders of the world flame away. :)

1. Create Selector

The first step seems to be to create a new selector for the virtual
frame buffer.  This would be done using the AllocateLDTDescriptors()
function of DPMI.  This function will return a new base selector that
needs to be initialized.  It would seem that the selector should be
initialized with the SetSegmentBaseAddress() function.  However, this
doesn't seem to have the functionality that is needed.  For example, if
the current video card has 1Mb of memory, we need a 1Mb segment that has
each 64k block mapped to the physical address 0x000a0000.  So the first
real question that I have is, how is this mapping done?

2. Intercept Page Fault Handler

Once the descriptor is properly initialized, only one of the 64k
segments will be marked as "in."  When a fault happens in this selector,
we need to be able to reset the SVGA hardware to use the correct bank
and mark the correct segment as "in."  It appears that the new handler
is installed using the SetExtendedProcessorExceptionHandler() function. 
When a fault occurs, the stack frame is examined to make sure the fault
is in the virtual video segment.  If it isn't we chain up to the
previous fault handler.

My next question is, how do you mark pages as being "in" or "out" using
DPMI?  So near as I can tell, this would be done using the
SetPageAttributes() function.

Also, the DPMI documentation that I have seen is some what unclear as to
if you can even install a 0x0E (page fault) handler.  At one point,
while discussing function 0x0203 it says:

    All exceptions are examined by the DPMI host. The host processes any
    exception that it is responsible for, such as page fault for virtual
    memory management. These transparent exceptions are never passed to 
    the client exception handlers. All other exceptions become visible 
    exceptions to a client and are passed to the client exception
    handler (if any) from the DPMI host.

Is this to say the you will never see a page fault?  See it after the
DPMI sever deals with it?  See it before DPMI deals with it?

Am I even on the right track here?  Please, post any comments or flames.
:) I'd really like to figure this out, and if I ever do, I'll make the
code freely available. :)

-- 
- See the Epsilon coder page at:           ____  ____
  http://www.cs.pdx.edu/~idr/             /     /   / /\    / "Good...bad...
- Ian Romanick sez:                      /---- /___/ /  \  /   I'm the guy
  "For the last time, GIVE ME THE BOX!" /____ /     /    \/    with the gun."

- Raw text -


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