Re: Build scatterlist covering a process' text segment?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi...

On Sat, May 28, 2011 at 04:58, Arvid Brodin <arvid.brodin@xxxxxxxx> wrote:
> Ok. And looking at e.g. sg_set_buf(), the scatterlist expects a kernel virtual
> address (it uses virt_to_page() on its "buf" parameter internally, which
> requires a kernel virtual adress, if I understand correctly).
>
> There seems to be no way to map process adresses to kernel addresses. (Well I
> guess one could follow the page tables to get the physical page, and then map
> back to kernel space, but this only works as long as the memory is paged in.)
> Please correct me if I'm wrong.

I am not good at it, but I think at the first place, you might use
get_user_pages() (take a look here
:http://lxr.linux.no/#linux+v2.6.39/mm/memory.c#L1703)

then once you get the pointer to the  pages (and making sure they're
pinned by get_user_pages), I think you just need to use kmap().

I suggest to really observe that scatter gather function and see if
address in kernel address space is really needed.... if not, you can
avoid using kmap() completely.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux