2011-02-03 21:08:23

by Nikolaus Rath

[permalink] [raw]
Subject: Reversing a memory mapping?

Hello,

I am trying to outsmart the proprietary nvidia driver to get my own
driver to access to a memory region set up by the nvidia driver.

Strace tells me that the nividia userspace library is calling

mmap2(NULL, 1048576, PROT_READ|PROT_WRITE, MAP_SHARED, 5, 0x35375)

to get a userspace pointer to the kernel memory that I'm interested in.

Is there a way that my own kernel module can "reverse" this mmap call?
I.e. given the userspace pointer, how do I get access to the physical
location of the memory that has been mapped?

I know that the region is pinned and used as a DMA buffer for
communication with the GPU. I want my own device to do DMA transfers to
and from the same location.



Thanks,

-Nikolaus

--
»Time flies like an arrow, fruit flies like a Banana.«

PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C