Subject: Re: port to system w/o MMU
To: Laine Stump <laine@MorningStar.Com>
From: Erik E. Fair <fair@cesium.clock.org>
List: tech-ports
Date: 04/25/1997 04:41:02
At 20:50 -0700 4/24/97, Laine Stump wrote:
>Has anyone done a port of NetBSD to a platform that lacks hardware MMU
>(in particular, one with an Intel 960, but any relevant experience would
>be interesting)? A couple of us were kicking this around as a rainy day
>project the other day...

The first commercial UNIX on a mc68000 was the the Dual Systems S-100 box,
in November 1981. Motorola's first MMU (68451) was not available, so these
guys faked a system without an MMU.

They split the address space in half (24 bits, so two partitions of
potentially 8M each), and built a little logic on the CPU card: if the most
significant address bit was zero, and the processor was in user mode, this
was an attempt by a user thing to access "kernel" address space, and a trap
resulted. This protected the OS from errant programs (of course, the user
mode programs were free to step all over each other, but since most of
those progams had grown up in an MMU environment; they were already pretty
well behaved). The I/O page was put just below 0x800000. Standard RAM
configuration was 128K at 0x0, and 128K at 0x800000 (total system RAM of
256K; RAM was quite expensive in those days).

Second problem was address translation: The MMU does it, ergo, no address
translation without it. They set a default starting address of 0x800000
(top half of the address space), linked all user programs that way, and
copied them (or swapped them in from the disk) into place when it was their
turn to run. Unfortunately, all attempts at deferencing address zero (and
there was a lot of that in UNIX code because of some unfortunate decisions
in both the PDP-11 and VAX-11 UNIXes) died with an address fault (see
previous paragraph). Lots of people thought the hardware was to blame for
the result of poor programmer assumptions!

This system was like the Waltzing Bear - it's not so amazing that the bear
waltzes badly (it does), it's amazing that the bear dances at all...

Short: it can be done. Forget VM entirely, and do a swapping system (all
in, all out, no half-way measures; at least when you run, you'll run fast
since you won't have to wait for address translation), and if you can get
position independent code going, that would be a win (no copying the
processes around in RAM), and the programs that run on this system had
better be prepared to do self-integrity checks from time to time (wild
pointers are deadly). You might want to have a look at XINU (Douglas Comer,
Purdue University); that "UNIX-like" system does not require an MMU, last I
looked.

	Erik Fair <fair@clock.org>,
	formerly dual!fair (March '83 to June '85)