Running UNIX V6 on an -11/23

From Computer History Wiki
Jump to: navigation, search

It is possible to run UNIX Sixth Edition on a PDP-11/23 (provided 'of course' that it has a KTF11-A memory management chip), although this is not a model supported 'out of the box' with the Version 6 distribution.

There are three issues which have to be addressed before V6 will run on a /23:

All of them are fairly simple to deal with, but they require minor modifications to the system, so you will need a running V6 to do these; bringing it up under a simulator, e.g. Installing UNIX Sixth Edition on Ersatz-11, is therefore required.

Use the 'm40.s' assembly language file, as the memory management supported by the /23 is the same 'simple' kind (i.e. without split I+D) as that on the PDP-11/40.

Also, if it has a KEF11-A floating point chip, additional work is needed to allow its general use, since the -11/40 did not support FP11 floating point, and so there is no code to handle it in m40.s.

Switch register

V6 expects to see a switch register, and refers to it during booting to see whether to come up single-user or not.

The best general approach is to provide a 'software switch register'; a location in low memory whose contents are used as the switch register.

The following can be used to do so:

  • insert four lines into l.s (in the appropriate location in the source):
. = 50^.
.globl  _SW
_SW:    memcsw
memcsw: 173030 
  • change the last line of param.h to read:
extern	int	*SW;
  • add the following three lines to main.c (the last two go just after

the check for the LTC)

#define SWREG	0177570

if (fuiword(SWREG) != -1)
	SW = SWREG;
  • then recompile sys4.c and prf.c, plus the two files above.

Clock

V6 requires either a KW11-L or KW11-P clock, and will 'panic' unless one or the other is found. The -11/23 does have a 60Hz clock, but... there is no control register. There are two ways to deal with this:

  1. Install a BDV11 card, which has a simulation of the KW11-L on it, or
  2. Modify the OS

To do the latter, in main.c, change:

			panic("no clock");

to:

			{
			lks = 0;
			printf("No clock?\n");
			printf("On an 11/23, turn on clock now.\n");
			}

and change the:

	*lks = 0115;

to:

	if (lks != 0)
		*lks = 0115;

NOTE: It is critical to turn off the system's built-in clock (usually possible with a switch on the console) before and during booting, as a clock interrupt before UNIX is ready for it can trash the system (and has been observed to trash the disk, if you are really unlucky).

Larger main memory

All -11/23's after the (very rare) model A can support more than 256KB of main memory. If you put more than 256KB on an -11/23 and boot V6, it will ignore the extra memory above 256KB (technically, above 248KB).

That is because 22-bit operation must be explicitly enabled, using SSR3. So, make a copy of m40.s (m23.s seems the obvious name), and add the following:

	mov     $EN22BIT, *$SSR3	/ allow > 256KB

just before the

	inc	SSR0

You will also need to add:

SSR3	= 172516
EN22BIT	= 20

somewhere (probably at the end, with the other register definitions).

Finally, the PAR contents to reach the I/0 page are different in a 22-bit system from an 18-bit system, so change:

IO	= 7600

to:

IO	= 177600

You might also want to change this line:

	printf("mem = %l\n", maxmem*5/16);

in main.c to this:

	printf("mem = %l\n", (maxmem/16)*5);

to prevent overflow issues in machines with a lot of memory.

Edit the 'run' file that builds the system to use m23.o instead of m40.o, and that should do it.

Floating point

The issue with floating point support is that when switching from one process to another, the floating point register contents need to be saved, and restored when returning to that process. If this is not done, the process will see 'its' floating point register contents over-written by those of any other process that uses floating point in the interim.

This is not an issue on the -11/40, since it doesn't support floating point. However, this means that m40.s does not include the code to perform the necessary saves and restores. The necessary code is available in m45.s, though, and merely needs to be copied over.

This has not yet been done, but should be straightforward; simply look in m45.s for code under the conditional-assembly flag '.fpp', and copy all such code into the corresponding location in m40.s.

See also