Need help in accessing physical address in Unix
Joseph S. D. Yao
jsdy at hadron.UUCP
Tue Dec 3 16:29:28 AEST 1985
In article <270 at moncskermit.oz> cheung at moncskermit.oz (Lawrence Cheung) writes:
>we intend to put the frame grabber in the physical memory map and
>access the frame grabber through its PHYSICAL ADDRESS, ...
>1) Can we access a physical address directly in UNIX without using a
> device driver?
Hard to answer. To access anything in UNIX, you have to use some
kind of code, which can be construed as a device driver. If you
are asking, can you access it directly without the overhead of
indexing through the device driver table, then you can use a
separate system call; and if you want to avoid that overhead, then
you will have to map the memory pages into your process's address
space, which can be done, but ... You probably will want your
"open" routine (Oh, here we are in a driver again) to lock the frame
buffer from other access, put your process close to the kernel in
physical memory (to reduce fragmentation), lock it against swapping
or paging, and then modify your segment addresses so that the buffer
is in your address space, when you are scheduled to run. You will
have to make sure that the "close" routine undoes all this. Just
to be safe, you should make sure that the scheduler and swapper/
pager are happy with pages that shouldn't be touched in your address
space. And there are probably a few other things I've forgotten off
the top of my head.
>2) Can we have fast access to the frame grabber using other means?
You could also set up kernel routines that will double- (or n-)buffer
frames for you and pass them back. This can be done with n buffers
in the kernel, passed back via a copyout() on demand, which may lose
data if you are trying an N-per-second grab. This can also be done
with buffers that your user program provides. In this case, the
program must again be locked against swapping and paging (at least
the buffers must); and you will have to provide some sort of signalling
mechanism to let the user program know when a buffer is filled.
Incidentally, all of these techniques require additions to kernel
code that may be considered "driver" code: classic read, direct
access via system call, asynchronous read, mapped memory; and each
of these can be set up for read on demand or n-buffered storage.
I don't know what extra hooks the National VR32 might or might not
have; but any of these techniques on baseline VAX sVr2 would require
kernel mods (if only just the addition of the driver).
--
Joe Yao hadron!jsdy at seismo.{CSS.GOV,ARPA,UUCP}
More information about the Comp.unix.wizards
mailing list