Build scatterlist covering a process' text segment?
Mulyadi Santosa
mulyadi.santosa at gmail.com
Sat May 28 05:42:56 EDT 2011
Hi...
On Sat, May 28, 2011 at 04:58, Arvid Brodin <arvid.brodin at enea.com> 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
More information about the Kernelnewbies
mailing list