Memory management

Julian Stecklina boelthorn at
Wed Jun 29 18:09:15 CEST 2005

On Wed, 29 Jun 2005 16:54:46 +0200
Espen Skoglund <esk at> wrote:

> [Julian Stecklina]
> > Hello,
> > let's say in my rootserver I need a contiguous block of memory 1 MB
> > in size. I would request this memory from Sigma0 via
> > L4_Sigma0_GetAny and get a single Flexpage of this size.  In order
> > to implement a fine-grained write-barrier on parts of this memory
> > block, I need to make individual pages of this block read-only.  As
> > I understand it, the privileged system call MemoryControl provides
> > this functionality, but:
> > a) it is privileged, but all my servers would need this
> >    functionality.  How is this efficiently accomplished?
> > b) MemoryControl seems to operate on whole fpages only. How do I
> >    split a flexpage?
> You don't need MemoryControl() to make things read-only.  Just map it
> on with read-only permissions or revoke the write permission using
> Unmap() with appropriate parameters.

Ok, after studying the Reference Manual I understand how to manipulate
access rights and am seriously wondering why the name "Unmap" was
chosen. ;)

"Mapped fpages are considered inseparable objects. That is, if an fpage
is mapped, the mapper can not later partially unmap the mapped page;
the whole fpage must be unmapped in a single operation. The mappee can,
however, separate the fpage and map fpages (objects) of smaller size."

The manual is quite vague about how one would actually do this,
though. :-/

Is there any actual code to look at that does some interesting things
with fpages? What I am looking for is the way one would implement a
kind of mprotect(2).

Julian Stecklina

LISP has survived for 21 years because it is an approximate local
optimum in the space of programming languages. - John McCarthy (1980)

More information about the l4-hackers mailing list