From: rlammers@lysithea.rz.Uni-Osnabrueck.DE (R. Lammers FB Physik)
Subject: ISC and mapping of physical memory
Organization: University of Osnabrueck, FRG
Date: Thu, 17 Dec 1992 15:32:26 GMT

Hi all,

I'm just trying to port a device driver from SCO UNIX to Interactive UNIX
(version 3.0). But I encountered some problems. Perhaps someone on this
newsgroup can help me to solve them.
   I've got several i860 CPU cards with dual ported RAM located at the
physical address 0xd0000. This piece of memory is used for communication
between an 860 CPU and an i386 executable called Server which is responsible
for loading and starting an 860 program and which performs all I/O requests.
To access the dual ported memory the Server first calls the open routine
of the device driver to get a handle and then makes an ioctl function call
which maps the dual ported RAM into the Server's address space. Now the
Server has got direct access to the memory at 0xd0000.
   And here is where I'm having the trouble with ISC:
How can I map physical memory into the address space of a user process ???
   I need something equivalent to SCO's vas*() kernel functions (vasbind(),
vasmalloc(), vasmapped(), vasunbind()). These routines allow a driver to map
physical memory so that it can be read from or written to by both a driver
and a calling _user_ process. Memory that has been mapped is visible to the
kernel and to a _calling_ process. However, the mapping is not globally
visible to all processes.
   Well, I first asked my local dealer for help. But all I got from him
is the incomplete description of two functions:

   mappages(begmapaddr, length, begphysaddr)
   caddr_t begmapaddr;
   int length;
   paddr_t begphysaddr;

   freemappages(begmapaddr, length, dzero)
   caddr_t begmapaddr;
   int length, dzero;
   
According to my investigation these functions are not part of the kernel
library but of the keyboard/display driver (kd). I think they are used by
the ioctl calls KPMAPDISP/KDUNMAPDISP (see display(7)) which allow direct
access to the video memory for a user process.
   My question is whether there's anybody who has experience with mappages()/
freemappages() ? Is the parameter 'begmapaddr' an address in the user's or
kernel's address space ? Must it be on a page boundary ? Must 'length' be
a multiple of a page size ? How can I reserve the memory in the address space
of the user process (via malloc?) ? And what about the return values of these
functions ? What are their meanings ?
   You see, a lot of questions and I do not have any answer for them. I hope
someone out there can help. Thanks in advance. Please respond via e-mail as
I do not subscribe to this newsgroup.

Ralf Lammers

PS: BTW, does anybody know an e-mail address of Interactive (SunSoft) where
    to report bugs ? I found a lot of them in ISC's version 3.0. Well, I
    already reported them to your local distributer but it seems to me they
    send them to /dev/null.

--
*******************************************************************************
* Ralf Lammers                                                                *
* Universitaet Osnabrueck         Phone:    +49 541 969 2621                  *
* Fachbereich Physik              Fax:      +49 541 969 2670                  *
* Barbarastrasse 7                Internet: rlammers@physik.uni-osnabrueck.de *
* W-4500 Osnabrueck, Germany      Bitnet:   rlammers@dosuni1                  *
*******************************************************************************
* "We must fall back on the old axiom that when other contingencies fail      *
*  whatever remains - however improbable - must be the truth."                *
*                                                  (Lt. Cmdr. Data in ST:TNG) *
*******************************************************************************
Newsgroups: comp.unix.sysv386