lkml.org 
[lkml]   [1999]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
Subjectuser VA to kernel VA ?

Hi,
I encounter some trouble in memory management.

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/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.943 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site