L4 for asm-free OS'es?
farid.hajji at ob.kamp.net
Mon Apr 8 17:45:08 CEST 2002
> I'm interested in using L4 as a foundation for a new,
> yet-to-be-written Linux replacement intended primarily for use in
> embedded systems. My main motivations are for an OS that is portable,
> is understandable, has low interrupt latency, and has a small memory
> footprint. I'm thinking along the same lines as L4-Linux, but my OS
> would probably be written in C++ and make more use of L4 servers for
> hardware i/o.
on the long run, I'm also trying to port NetBSD to L4; but I'm currently
very far from this yet ;)
> One of the L4 manuals I've read says that when an OS running under L4
> starts, it should take all free memory from sigma0 and then manage the
> pages itself. To me, this means that the OS has to know how to
> interact with the host CPU's MMU hardware, which is obviously
> hardware-dependent and therefore undesirable in a portable OS. It
> also appears to be redundant--- sigma0 already knows how to work the
> MMU. Performance issues aside, would letting sigma0 do page mapping
> and unmapping eliminate the need for an OS running under it to know
> how the MMU interface works, and thereby make the OS a little more
> portable? Is this a reasonable approach?
If I understand the L4 X.2 spec of the upcoming Version 4 (Pistachio)
right, the new API provides enough system independent hooks for
accessing the MMU; which L4 would manage. Please look at the spec.
Because the MMU is a central security sensitive area, it is very
comprehensible to leave its management to the kernel. Most everything
else can be factored out to userspace.
If you would like to implement some kind of VM system on top of that
(this is seldom necessary for embedded systems, as you certainly know!),
I'd recommend that you use NetBSD's UVM (or the older snapshot thereof
in the latest OSKit release). Basically, the most work goes into
writing a pmap.c for L4, which would use the L4 API to access the MMU;
the rest of the working being to insulate UVM from the NetBSD parts
like, say, VNODE pager stuff etc. Then again, who needs a swap file
on embedded systems anyway? ;-)
BTW, pmap is the machine dependen physical layer to the various MMUs
supported by BSD kernels, that UVM uses extensively.
> What is the likelihood that an L4-based OS would need no assembly
> language at all, other than the syscall interface? I'm thinking along
> the lines of "to port this OS to your CPU, just port L4 and then
> recompile the OS sources."
I'm rather sceptical if it would be possible to write an assembler-less
OS on top of L4 V4, though I'm no expert here. After all, most interfacing
to L4's C++ API would probably be done through header files that contain
embedded/inline assembly or equivalent C constructs; just like in Hazelnut.
But I'm no expert here!
> I'm eyeing ARM, MIPS, SH and x86 targets--- all of which I work with
> every day. I have single-board computers representing all four
> architectures in my lab here right now, and I'm doing something with
> all of them almost all the time. That's why portability is important
> to me. My customers think Linux is great because it's more portable
> than the alternatives, but I think it isn't nearly portable enough.
For embedded systems, I really recommend NetBSD, which is architecturally
and also practically the currently most portable OS in the world. This
is not to speak against Linux, which is making progress in this area
too, but NetBSD is IMHO lightyears ahead on portability and supports
many more embedded systems at the moment; including the targets you're
Having a NetBSD/L4 port would be great; but the idea to write a whole
new embedded OS from scratch is also intriguing.
> And it scores low marks for understandability, interrupt latency and
> footprint. Oh, and debuggability---I love your "KD:" prompt! :^)
> Bill Gatliff
Farid Hajji -- Unix Systems and Network Admin | Phone: +49-2131-67-555
Broicherdorfstr. 83, D-41564 Kaarst, Germany | farid.hajji at ob.kamp.net
- - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - -
One OS To Rule Them All And In The Darkness Bind Them... --Bill Gates.
More information about the l4-hackers