chris@uunet.uu.net (Chris Brown) (04/04/89)
Mike Martys in v7n192: > Another way is to manipulate the page map, mapping some part of the > physical memory into a process's virtual space. This looks good for > performance, but the question is can this be done, and if so, can it be > done easily (via some sort of Unix standard interface)? This is precisely what mmap(2) does. Read the manual page. Also there is more advice in the section "Mapping Devices without Device Drivers" in Chapter 5 of the "Writing Device Drivers" manual. We use this a lot for frame buffers; it works fine. Mike - email me direct if you want more info. Chris Brown, A.I. Vision Research Unit, Sheffield University (chris@aivru.sheffield.ac.uk)
schultz@mmm.serc.mmm.com (John C Schultz) (04/22/89)
mcvax!aivru.sheffield.ac.uk!chris@uunet.uu.net (Chris Brown) writes: >Mike Martys in v7n192: > >> Another way is to manipulate the page map, mapping some part of the >> ...... > >This is precisely what mmap(2) does. Read the manual page. Also there is >.... I also use mmap() to map image framebuffers and board control without having to write device drivers for what are pretty simple (in one sense) image processing boards. The problem that I ran into is that for buffers > 128KB, the SUN mapper only marks the page invalid on a munmap(). That space NEVER AGAIN can be used for that process. However, it turns out that if you don't read the manual carefully enough :-), you can mmap() the same space again and it will work most of the time but occasionally crash on a segment violation. My solution is to mmap()/munmap() small things like board control registers while only mmap()ing large things like framebuffers once and just remembering that you have mmap()ed the buffers so subsequent calls do nothing. Works fine. -- john c. schultz schultz@3M.Com ..!uiucuxc!mmm!schultz (612) 733-4047 3M Center, Bldg 518-1-1, St. Paul, MN 55144-1000 The opinions expressed herein are, as always, my own and not 3M's.