virt to physical addr...

Raj, Ashok (ashok.raj@intel.com)
Wed, 4 Aug 1999 08:34:51 -0700


Hi.

Iam trying to find a way to get the physical addr given the user virtual
addr.

i thought the following would get the virtual to physical mapping but what i
find is current->mm is NULL
all the time.

user program obtains memory using malloc()

addr = malloc(size);

then passes this to a kernel module for translation to physical addr

pgd = pgd_offset(current->mm, addr);
pmd = pmd_offset(pgd, addr);
pte = pte_offset(pmd, addr);

if (pte_present(*pte))
page = pte_page(*pte);

i have seen that always the current->mm is NULL.

I have tried to do the same to a mmap addr returned by the kernel and
passing it back to kernel
for translation. That did not work either.

addr = mmap(...) // driver maps some register set to user space

still i notice that the mm is NULL, i thought that i should probably use
init_mm instead of current->mm since
this is a kernel mm, but still pte_present returns FALSE.

Am i missing something here?

thanks for any help.

Cheers,
ashokr

Plug-and-Play is really nice, unfortunately it only works 50% of the time.
To be specific the "Plug" almost always works.
--unknown source

----------------------------------------------------------------------------
-------------
Ashok Raj Phone : (503)-677-6928
NGIO Division Fax : (503)-690-4302
Core Software Group email : ashok.raj@intel.com
M/S : CO3-208
----------------------------------------------------------------------------
-------------

-
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/