[comp.os.cpm] UZI, a Z-80 Unix clone kernel

dbraun@cadev4.intel.com (Doug Braun ~) (11/08/88)

UZI (Unix Z-80 Implementation) is a Unix clone kernel written for
Z-80 CP/M-based micros.  Following is an introduction to it.
The code itself has been sent to comp.sources.misc as five shar-format
postings.


		UZI, UNIX Z-80 IMPLEMENTATION

		  Written by Douglas Braun


Introduction:

UZI is an implementation of the Unix kernel written for a Z-80 based
computer.  It implementts almost all of the functionality of the
7th Edition Unix kernel.  UZI was written to run on one specific
collection of custom-built hardware, but since it can easily have device
drivers added to it, and it does not use any memory management hardware,
it should be possible to port it to numerous computers that current use
the CP/M operating system.  The source code is written mostly in C,
and was compiled with The Code Works' Q/C compiler.  UZI's code was
written from scratch, and contains no AT&T code, so it is not subject
to any of AT&T's copyright or licensing restrictions.  Numerous 7th
Edition programs have been ported to UZI with little or no difficulty,
including the complete Bourne shell, ed, sed, dc, cpp, etc.


How it works:

Since there is no standard memory management hardware on 8080-family
computers, UZI uses "total swapping" to achieve multiprocessing.
This has two implications:  First, UZI requires a reasonably fast
hard disk.  Second, there is no point in running a different process
while a process is waiting for disk I/O.  This simplifies the design
of the block device drivers, since they do not have to be interrupt-based.

UZI itself occupies the upper 32K of memory, and the currently running
process occupies the lower 32K.   Since UZI currently barely fits in 32K,
a full 64K of RAM is necessary.

UZI does need some additional hardware support.  First, there must be
some sort of clock or timer that can provide a periodic interrupt.
Also, the current implementation uses an additional real-time clock
to get the time for file timestamps, etc.  The current TTY driver assumes
an interrupt-driven keyboard, which should exist on most systems.
The distribution contains code for hard and floppy disk drivers, but
since these were written for custom hardware, they are provided only
as templates to write new ones.


How UZI is different than real Unix:

UZI implements almost all of the 7th Edition functionality.
All file I/O, directories, mountable file systems, user and group IDs,
pipes, and applicable device I/O are supported.  Process control
(fork(), execve(), signal(), kill(), pause(), alarm(), and wait()) are fully
supported.  The number of processes is limited only by the swap space
available.  As mentioned above,  UZI implements Unix well enough to
run the Bourne shell in its full functionality.  The only changes made
to the shell's source code were to satisfy the limitations of the C compiler.

Here is a (possibly incomplete) list of missing features and limitations:

    The debugger- and profiler-related system calls do not exist.

    The old 6th edition seek() was implemented, instead of lseek().

    The supplied TTY driver is bare-bones.  It supports only one port,
    and most IOCTLs are not supported.

    Inode numbers are only 16-bit, so filesystems are 32 Meg or less.

    File dates are not in the standard format.  Instead they look like
    those used by MS-DOS.

    The 4.2BSD execve() was implemented.  Additional flavors of exec()
    are supported by the library.

    The format of the device driver switch table is unlike that of
    the 7th Edition.

    The necessary semaphores and locking mechanisms to implement 
    reentrant disk I/O are not there.  This would make it harder to
    implement interrupt-driven disk I/O without busy-waiting.


A Description of this Release:

Here is a list of the files supplied, and a brief description of each:


intro:		What you are reading

config.h:	Setup parameters, such as table sizes, and the device
		driver switch table.

unix.h:		All strcuture declarations, typedefs and defines.
		(Includes things like errno.h).

extern.h:	Declarations of all global variables and tables.

data.c:		Dummy to source extern.h and devine globals.

dispatch.c:	System call dispatch table.

scall1.c:	System calls, mostly file-related.

scall2.c:	Rest of system calls.

filesys.c:	Routines for managing file system.

process.c:	Routines for process management and context switching.
		Somewhat machine-dependent.

devio.c:	Generic I/O routines, including queue routines.

devtty.c:	Simple TTY driver, slightly-machine dependent.

devwd.c:	Hard disk driver.  Very machine-dependent.

devflop.c:	Floppy disk driver.  Very machine-dependent.

devmisc.c:	Simple device drivers, such as /dev/mem.

machdep.c:	Machine-dependent code, especially real-time-clock and
		interrupt handling code.

extras.c:	Procedures missing from the Q/C compiler's library.

filler.mac:	Dummy to make linker load UZI at correct address.

makeunix.sub:	CP/M SUBMIT file to compile everything.

loadunix.sub:	CP/M SUBMIT file to load everything.


Miscellaneous Notes:

UZI was compiled with the Code Works Q/C C compiler and the Microsoft
M80 assembler under the CP/M operating system, on the same hardware
it runs on.  Also used was a version of cpp ported to CP/M, since
the Q/C compiler does not handle macros with arguments.  However, there
are only a couple of these in the code, and they could easily be removed.

Because UZI occupies the upper 32K of memory, the standard L80 linker
could not be used to link it.  Instead, a homebrew L80 replacement linker
was used.  This generated a 64K-byte CP/M .COM file, which has the lower 
32K pruned by the CP/M PIP utility.  This is the reason for appearance
of the string "MOMBASSA" in filler.mac and loadunix.sub.

To boot UZI, a short CP/M program was run that reads in the UZI image,
copies it to the upper 32K of memory, and jumps to its start address.
Other CP/M programs were written to build, inspect, and check UZI filesystems
under CP/M.  These made it possible to have a root file system made before
starting up UZI.  If the demand exists, these programs can be included
in another release.


Running programs under UZI:

A number of 7th Edition, System V, and 4.2BSD programs were ported to
UZI.  Most notably, the Bourne shell and ed run fine under UZI.
In addition the 4.2BSD stdio library was also ported.  This, along
with the Code Works Q/C library and miscellaneous System V library 
functions, was used when porting programs.

Due to obvious legal reasons, the source or executables for most of these
programs cannot be released.  However, some kernel-dependent programs
such as ps and fsck were written from scratch and can be included in future
releases.  Also, a package was created that can be linked to CP/M .COM
files that will allow them to run under UZI.  This was used to get
the M80 assembler and L80 linker to run under UZI.  Cpp was also
ported to UZI.  However, it was not possible to fit the Q/C compiler
into 32K, so all programs (and UZI itself) were cross-compiled under CP/M.

The Minix operating system, written for PCs by Andrew Tanenbaum et al,
contains many programs that should compile and run under UZI.  Since
Minix is much less encumbered by licensing provisions than real Unix,
it would make sense to port Minix programs to UZI.  In fact, UZI itself
could be ported to the PC, and used as a replacement for the Minix kernel.

Doug Braun				Intel Corp CAD
					408 765-4279

 / decwrl \
 | hplabs |
-| oliveb |- !intelca!mipos3!cadev4!dbraun
 | amd    |
 \ qantel /

rlb@xanth.cs.odu.edu (Robert Lee Bailey) (11/10/88)

In article <3139@mipos3.intel.com> dbraun@cadev4.UUCP () writes:
>UZI (Unix Z-80 Implementation) is a Unix clone kernel written for
>Z-80 CP/M-based micros.  Following is an introduction to it.
>The code itself has been sent to comp.sources.misc as five shar-format
>postings.
>
I would be very interested in the source, but, it apparently
scrolled off before I could get it.  Could someone repost
or email it to me?

		Bob Bailey

bnews@nixpbe.UUCP (Martin Boening) (11/11/88)

In article <6615@xanth.cs.odu.edu> rlb@cs.odu.edu (Robert Lee Bailey) writes:
>
>I would be very interested in the source, but, it apparently
>scrolled off before I could get it.  Could someone repost
>or email it to me?
>
>		Bob Bailey

I would be interested in the sources too. However, I suggest waiting a
bit because I think comp.sources.misc is moderated. It might just be
that the sources were mailed to the moderator, when they were supposedly
posted. (Since all this has happened just recently, the moderator maybe
hasn't got round to approving the sources yet)

Any (even contradicting) info on this is of course appreciated.

Martin Boening

Email: mboen@nixpbe.UUCP (no kidding)

rzh@lll-lcc.llnl.gov (Roger Hanscom) (11/15/88)

I have been watching comp.sources.misc at my site, and have not
seen this either.  As Martin Boening states, it may be best to
let patience prevail here.  It may not have been posted yet.

Martin said it best:

>Any (even contradicting) info on this is of course appreciated.

>Martin Boening
                           Roger
<------------>
   {ucbvax,ames,lll-crg,....}!lll-lcc!freedom!rzh
   or {ucbvax,ames,lll-crg,....}!lll-lcc!rzh
   or rzh%freedom.llnl.gov@lll-lcc.llnl.gov

car@pte.UUCP (Chris Rende) (11/17/88)

> I have been watching comp.sources.misc at my site, and have not
> seen this either.  As Martin Boening states, it may be best to
> let patience prevail here.  It may not have been posted yet.

I too have been waiting patiently, but there has not been much traffic in
comp.sources.misc - what if the moderator has decided NOT (gasp!) to post
UZI?! The moderator may not feel that UZI has enough "general appeal".

I vote for posting it here, after all, this is where the Z-80 folks hang out.

car.
---
Christopher A. Rende                Multics,DTSS,Shortwave,Scanners,StarTrek
uunet!{umix,edsews}!rphroy!pte!car  TRS-80 Model I: Buy Sell Trade
Motorola VME1131 M68020 SVR2        Precise Technology & Electronics, Inc.
-- 
Christopher A. Rende                Multics,DTSS,Shortwave,Scanners,StarTrek
uunet!{umix,edsews}!rphroy!pte!car  TRS-80 Model I: Buy Sell Trade
Motorola VME1131 M68020 SVR2        Precise Technology & Electronics, Inc.

W8SDZ@WSMR-SIMTEL20.ARMY.MIL (Keith Petersen) (11/18/88)

I have asked the author of UZI, the Z80 Unix clone kernel, to upload
his files to SIMTEL20.  When they are in place I'll make an
announcement so Internet folks can get it with FTP and Bitnet/Usenet
folks can get it from LISTSERV, the netmail file server.

It will also be available on my RCP/M (see number below) which is
accessable via PC Pursuit 1200/2400 bps), and on the National CP/M
RoundTable on GEnie.

--Keith Petersen
Maintainer of the CP/M & MSDOS archives at WSMR-SIMTEL20.ARMY.MIL [26.0.0.74]
DDN: W8SDZ@WSMR-SIMTEL20.ARMY.MIL
Uucp: {ames,decwrl,harvard,rutgers,ucbvax,uunet}!wsmr-simtel20.army.mil!w8sdz
GEnie: W8SDZ
RCP/M Royal Oak: 313-759-6569 - 300, 1200, 2400 (V.22bis) or 9600 (USR HST)

wyle@solaris.UUCP (Mitchell Wyle) (11/20/88)

In article <322@pte.UUCP> car@pte.UUCP (Chris Rende) writes:
>> I have been watching comp.sources.misc at my site, and have not
>> seen this either.  As Martin Boening states, it may be best to
[...]
>I too have been waiting patiently, but there has not been much traffic in
>I vote for posting it here, after all, this is where the Z-80 folks hang out.

Here here!  I agree.  Please post the sources.  I have been porting
the minix Bourne-shell everywhere, to get the feel of the code, waiting
for Galil  ...er... Uzi to come over comp.sources.misc.

-- 
-Mitchell F. Wyle            wyle@ethz.uucp
Institut fuer Informatik     wyle%ifi.ethz.ch@relay.cs.net
ETH Zentrum                  
8092 Zuerich, Switzerland    +41 1 256-5237

bruce@idsssd.UUCP (Bruce T. Harvey) (11/21/88)

In article <322@pte.UUCP>, car@pte.UUCP (Chris Rende) writes:
> > I have been watching comp.sources.misc at my site, and have not ...
> 
> I vote for posting it here, after all, this is where the Z-80 folks hang out.

I add my vote to it.  I just purchased a Macintosh Plus, because the parts
for my Kaypro are getting harder and harder to find in my area (and the
drives are starting to talk among themselves of revolutions ... ), but
damned if I'm going to give up my "fastest Wordstar(tm) in the west"
Kaypro without a fight.

bth
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Bruce T. Harvey  (B-}> |             ... cp1!sarin!wb3ffv!idsssd!idssup!bruce
(Title depends on day) |                       ... ctnews!idsssd!idssup!bruce
(301) 584-1960         | Convergent Route Distribution Sys. - Hunt Valley, MD

haldane@warwick.UUCP (Steve Sykes) (11/23/88)

In article Keith Petersen writes:
>I have asked the author of UZI, the Z80 Unix clone kernel, to upload
>his files to SIMTEL20.  When they are in place I'll make an
>announcement so Internet folks can get it with FTP and Bitnet/Usenet
>folks can get it from LISTSERV, the netmail file server.
>
>It will also be available on my RCP/M (see number below) which is
>accessable via PC Pursuit 1200/2400 bps), and on the National CP/M
>RoundTable on GEnie.
>

So, (excuse ignorance), how does one get stuff from SIMTEL20 in the UK?

Steve.
UUCP:   ...!mcvax!ukc!warwick!haldane       |    Have you hugged your
JANET:  haldane@uk.ac.warwick.cs            |        radio today?
ARPA:   haldane@cs.warwick.ac.uk            |_____________________________
Steve Sykes, Computing Dept, Warwick University, Coventry CV4 7AL, England

laverman@prismab.prl.philips.nl (Bert Laverman) (11/25/88)

I've been waiting for some time now, but it seems UZI was not considered
interesting enough to appear in comp.sources.misc . Allthough it's nice
that it's available from SIMTEL20, you need to be able to FTP, which I
can't.
I would like to get the sources...
Anybody?...
Heeeelllpp!!...


|	Bert Laverman
|	Slow-Mail: Juliusstraat 58, 5621 GE Eindhoven, The Netherlands
|	Fast-Mail: laverman@prismaa.prl.philips.nl

#include <standards/disclaimer.h>

_________________________________________________________________
|								|
|		There are four classes of software:		|
|	      Elegant, Educational, Fast, and Hacked.		|
|		Alas most people only write Class 4.		|
|_______________________________________________________________|

seeley@dalcsug.UUCP (Geoff Seeley) (11/28/88)

In article <500@idsssd.UUCP>, bruce@idsssd.UUCP (Bruce T. Harvey) writes:
> In article <322@pte.UUCP>, car@pte.UUCP (Chris Rende) writes:
> > > I have been watching comp.sources.misc at my site, and have not ...
> > >
> I add my vote to it.  

I add my vote too, as we here have no FTP access. The only way we can get
it is via e-mail or from the news feed. Somebody please post this piece
of code to comp.sources.misc, or here.
-- 
+=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+|Geoff Seeley         |"My guitar is my wife. She talks for me, not at me.     |
|Dalhousie University | She screams FOR me and not at me." -Stevie Ray Vaughan ||Halifax, Nova Scotia +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+|UUCP:...!{uunet|watmath|utai}!dalcs!dalcsug!seeley | I wish my brain had      |
|BITNET: csat0013@dalac 			    |     multitasking ...     |+=-=-=-=-=-=-=<Disclaimer: I watch too much Monty Python ok!?>=-=-=-=-=-=-=-=-=+

rlb@xanth.cs.odu.edu (Robert Lee Bailey) (11/29/88)

In article <205@dalcsug.UUCP> seeley@dalcsug.UUCP (Geoff Seeley) writes:
>In article <500@idsssd.UUCP>, bruce@idsssd.UUCP (Bruce T. Harvey) writes:
>> In article <322@pte.UUCP>, car@pte.UUCP (Chris Rende) writes:
>> > > I have been watching comp.sources.misc at my site, and have not ...
>> > >
>> I add my vote to it.  
>
I'd like to get UZI, but, I'm afraid that this looks like another....


     V
         A
             P
                 O
                     R
                         W
                             A
                                 R
                                     E