Re: getting some user memory

H. Peter Anvin (hpa@transmeta.com)
3 Mar 1998 12:53:41 GMT


Followup to: <Pine.GSO.3.96.980228163432.16269A-100000@atle>
By author: Magnus Ahltorp <Magnus.Ahltorp@abc.se>
In newsgroup: linux.dev.kernel
>
>
> I'm building a linux kernel module for arla, a free AFS client, and I'm
> having some problems with the directory caching. I have a userland daemon
> that serves me a cache file containing several directory entries.
>
> In the kernel, I call the i->i_op->default_file_ops->read() to read a
> block from the cache file, and then I walk through the block and do a
> filldir() call for each directory entry.
>
> The problem is that the "read" operation wants to write to user memory.
> I'm currently developing my things on a sparc, so I cheat by allocating
> kernel memory and let the read operation write to that memory, but that
> doesn't work on other archs.
>
> Is there some way of getting memory addressable as user space memory?
>

Use set_fs() to redirect "user memory" to kernel memory. This is used
in a number of places in the code. The name is a historical artifact
from when Linux used to use the i386 %fs register to point to user
memory.

-hpa

-- 
    PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
    See http://www.zytor.com/~hpa/ for web page and full PGP public key
        I am Bahá'í -- ask me about it or see http://www.bahai.org/
   "To love another person is to see the face of God." -- Les Misérables

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu