Messages in this thread | | | Date | Fri, 18 Jun 1999 22:21:32 -0400 (EDT) | From | "Richard B. Johnson" <> | Subject | correct mmap |
| |
Hello, When X11 mmaps the video board buffer to user-space it does this:
open("/dev/mem", O_RDWR) = 4 mmap(0, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 4, 0xa0000) = 0x400d7000 close(4) = 0
The return value is a nice high value which doesn't confuse any 'C' runtime libraries.
If I attempt to mmap 0xb8000, the screen regen buffer, it succeeds (because it doesn't return a -1), but it returns 0. The result, cast to a pointer does 'work' for reading and writing to the screen buffer. However, the resulting NULL pointer is not a real good thing to use in user-space since bad code won't seg-fault.
So, what is the correct way to mmap a physical address into user space? Is there some offset I should be using? In the intended application, I am not really going to read/write to the screen regen buffer, but it's an interesting target to play with.
Cheers, Dick Johnson ***** FILE SYSTEM WAS MODIFIED ***** Penguin : Linux version 2.2.6 on an i686 machine (400.59 BogoMips). Warning : It's hard to remain at the trailing edge of technology.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |