On 3/20/06, MHD.Tayseer Alquoatli <idoit.ief@xxxxxxxxx> wrote:
i think i've found the answer .. and it's yes .. i can use arithmetic operation on the virtual address cause it's virtually contiguous but i have to use copy_from_user to access that pointer and this function will do the necessary steps to translate the virtual address to logical address .. CMIIW please
hope this helps
MHD.Tayseer
Hi all:
the memory allocated by malloc in user space is virtually contiguous .. but it's not necessary logically contiguous CMIIW
does this means that it's not correct to use arithmetic pointer operations on a user space memory .. i.e is this correct:
copy_from_user(kernel_buf1, user_buf, size1);
copy_from_user(kernel_buf2, user_buf + size1, size2);
i think i've found the answer .. and it's yes .. i can use arithmetic operation on the virtual address cause it's virtually contiguous but i have to use copy_from_user to access that pointer and this function will do the necessary steps to translate the virtual address to logical address .. CMIIW please
hope this helps
MHD.Tayseer
and in case it wasn't .. is there any way to do it other than copying all user_buf to kernel memory first .. kernel_buf1,2 are pre-allocated so i wanna avoid kmallocing memory in kernel space then copying it to kernel_buf1,2
thanks in advance
MHD.Tayseer