I have the following Macro definition
#define user_vat_2_phys(VA, proc) \
((void *) (pte_page( \
*pte_offset(
\
pmd_offset(
\
pgd_offset (proc->mm, (unsigned long)VA ), \
(unsigned long)VA \
), \
(unsinged long)VA \
)
\
) | (((unsigned long)VA) & (~PAGE_MASK))))
'VA' is a virtual address in user space.
In my device driver, I want to directly access the same memory specified by
'VA', so I run the following a piece of code:
phy_addr = user_va_2_phys( (((unsigned long) VA) & PAGE_MASK), current);
krnl_addr = phys_to_virt ((unsigned long) phy_addr);
krnl_va = krnl_add + ( (unsigned long)VA & ~PAGE_MAKE));
I guess, the value of krnl_va may point to the same memory as 'VA' points to.
In fact, the above code does work in Linux 2.2.5. However It does NOT work in
Linux 2.3.28. Why?
-Yong
-
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/