The Grumpf Operating System
The Grumpf Operating System is a primitive multitasking operating
system for the PDP-11 that I started writing on a boring Thursday
afternoon. It was developed on an emulation running RSTS/E using the
RT-11 utilities and tested on a PDP-11V03, but it should run on any 11
that has the EIS option.
Grumpf currently consists of a system call mechanism (where any program
can register a system call that can be called by providing the system
call name to a generic system call, a simple memory management (memory
partitions for large, named buffers and a simple memory pool allocator
for small buffers) and a simple job control facility using a round-robin
scheduler. The calling convention used by Grumpf is a combination of the
standard PDP-11 calling convention (using the MARK instruction to remove
the stack frame after the function call) and the calling convention used
by PDP-11 Unix. Any routine can be used as a system call without
modifications.
There is a packet oriented I/O system for Grumpf which runs in its own
separate job. It provides system calls for registration of devices and
connection of interrupt handlers to interrupt vectors. Two drivers, one
for the line clock and one for terminals, use these features. The
terminal driver is designed to be independent of the underlying
hardware, all hardware related stuff has to be done by a special
hardware driver for each device. A driver for the KL-11 system console
is included.
There is a program to test the terminal driver and two to test the
scheduler, some first work on a debugger / command interpreter called
Beiss has been done.
- grumpf.com, RSTS/E command file to rebuild Grumpf and associated programs
- loader.mac, standalone Intel-Hex file loader
- grumpf.mac, startup & initialization code
- klload.mac, job loader, reads jobs in Intel-Hex format from the console
- hndler.mac, handlers for common processor traps, stack trace routine
- syscll.mac, system call facility
- jobctl.mac, job control facility & scheduler
- memory.mac, memory partition control facility
- pool.mac, buffer pool routines
- util.mac, utility routines for direct console I/O and decoding words to RAD50 and octal ASCII
- call.mac, macros & register save / restore routines used by the calling convention
- lock.mac, preliminary locking facility, not used anywhere yet
- iosys.mac, I/O system
- kwdrv.mac, line clock driver
- ttydrv.mac, device independent terminal driver
- kldrv.mac, KL-11 console hardware driver
- ttytst.mac, terminal driver test program
- job1.mac and job2.mac, scheduler test programs
- usrlib.mac, library of often used routines, made available as system calls
- beiss.mac, debugger and command interpreter, currently nothing more than a tool for examining and changing memory contents
- octpus.mac, reads characters from the console and prints their octal ASCII codes
To get it running one has to compile and link all the pieces (using
grumpf.com) and convert the binaries to something useful:
- the loader should be converted to something that can easily be put in memory
- the Grumpf itself has to be converted to Intel-Hex format, using its absolute addresses, anything before loc 1000 can be left out
- all other programs just have to be converted to Intel-Hex format, starting at loc 0
I wrote this stuff mainly for fun, to get some experience with
developing operating systems and try out some crazy ideas I had. Don't
expect this to be any useful.
updates:
- 29-AUG-2005
-
- changed LOADER to load and relocate job images in RT-11 REL format
- changed all programs to store their job names in their RT-11 image header and use stack partitions allocated for them at load time
- bugfixes in IOSYS and TTYDRV
- added delay loop after PUTC in SYSPUT to slow down output for slower terminals
- changed BEISS user interface
- KLDRV (formerly CONDRV) now supports additional KL-11 devices besides the console interface
- LTCDRV renamed to KWDRV to get a consistent hardware driver naming scheme
- 05-AUG-2005
-
- changed interface for job LOADER routines for Grumpf
- reworked scheduler to use more efficient data structures
- major changes to the system call facility, don't lower processor priority below callers priority, store syscalls in a hash table instead of binary tree
- added hashing routine optimized for 2-word RAD50 strings
- first try of creating a locking facility for Grumpf
- fix ^L command in Beiss to set CURVAL
- extended USRLIB
- added OCTPUS, a program for converting characters to their octal ASCII code
- 04-JUN-2005
-
- the scheduler has been fixed for processors using the high byte of the PSW (tested on 11/23 and p11 emulator)
- the bus error handler has been extended to halt on stack overflow
- the I/O system was changed to return error codes in R0 instead of writing them into the I/O packet
- the terminal driver was changed to return error codes in R0 instead of writing them into the I/O packet,
cooked line mode input was extended to recognize Ctrl-C, minor bugs fixed
- a library of often used routines, USRLIB, was added
- the clock driver was adjusted to use routines from USRLIB
- some initial work on Beiss, a debugger and command interpreter, has been done
back