Some questions with regard to emul_l4rm.c

Frank Mehnert fm3 at os.inf.tu-dresden.de
Fri Apr 1 16:24:44 CEST 2005


Hi Leon,

On Friday 01 April 2005 14:21, Leon Brits wrote:
> When calling l4rm_attach(), the function l4rm_do_attach() gets called.
> This function calls reserve_virtual_area() which uses mmap(). Mmap()
> searches for an available area (with a certain size) in the calling
> process's virtual memory. After finding such an area it remaps memory,
> allocated using kmalloc() by /dev/zero, to the newly found virtual
> memory space. Kmalloc() allocates memory from the l4linux dataspace and
> that piece of memory is now mapped into user space.
> Next, the call to l4dm_map_pages(), maps my specified dataspace's pages
> into this mapped virtual address.
>
> Q1: Why go thru the first memory mapping of the kmalloc-ed memory into
> user space if immediately after it is remapped again by l4dm? Seems like
> a waste of the l4linux dataspace.

kmalloc is only used for allocating the descriptor. Since /dev/zero is
mapped into the VM area, no memory is wasted.

> Q2: Can the free virtual memory area be determined by another method and
> then call l4dm_map_pages()?

Why that? Note that emul_l4rm is not much more than a hack.

> Q2: When l4_fpage_unmap() is called, is the previous mapping to the
> pages of the kmalloc-ed memory restored?

After the external pages are unmapped, pagefaults to the area are served
by the Linux server which maps pages of /dev/zero.

Frank
-- 
## Dept. of Computer Science, Dresden University of Technology, Germany ##
## http://os.inf.tu-dresden.de/~fm3                                     ##
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://os.inf.tu-dresden.de/pipermail/l4-hackers/attachments/20050401/92a99065/attachment-0001.sig>


More information about the l4-hackers mailing list