TCP for the unix-pc

Alex Crain alex at wolf.umbc.edu
Thu May 4 07:53:12 AEST 1989


In article <11635 at s.ms.uky.edu>, david at ms.uky.edu (David Herron -- One of the vertebrae) writes:

> BUT I can't afford to tie up the parallel ports on either the 3b1 or
> the Amiga.  I've got serial ports to spare .. but as people have
> pointed out they give lots of interrupts and generally kill the machine.

	I've been looking into the serial line driver, and I
think that I can do something with the speed. Right now, the 
sequence for servicing the UART goes something like:

	Receive interrupt
	Vector processor off the interrupt stack
	Save all 16 registers
	figure out what caused the interrupt (which channel)
	Jump to that handeler procedure
	Save the registers that were going to use.
	read the uart and stick the byte in a clist
	wake up the clist handler
	restore some registers
	so some cleanup
	restore all 16 registers and fixup the stack pointer
	return from interrupt

I figure that by dedicating the tty port to a packet based 
protocol, that sequence could be reduced to a state machine that
either:

	1) starts a new packet, initializes the recieve buffer, 
	etc.
	2) moves a byte from the UART to ther receive buffer.
	3) terminates the packet, wakes up the buffer handler.

with a fixed buffer size, we would spend most of our time doing
#2, which would look basically like this:

	get interrupt
	vector to our routine
	save %d0, %d1 and the stack pointer
	if this is not from the serial port, branch to the 
		default handler.
	read the uart into %d0
	read our global buffer pointer to %d1
	write %d0 to (%d1)+
	write %d1 back out
	restore %d0, %d1 and %sp
	return from interrupt.

This ought to be fast enough to run at 9600 baud without slowing 
the machine down much, offhand I'd guess that it can be made to 
work in about 50000 machine cycles per second, running full out,
not bad for a 10Mhz machine (of course, that doesn't count 
transmit)

	I'm thinking that some careful buffer management could
make a ring network practical, since the machine should be capable
of packet pass-thru without sacraficing speed. ie: the buffer
manager would check the addresses of packets and send them back 
out if neccessary. Alternately, the interrupt handeller could 
chaeck addresses on the X'th byte, and if necessary notify the
transmit side to start feeding them back to the UART. Or, we
could freeze the receiveing side while we feed the packet header
into the UART, and then add a state which reads one side of the 
uart and writes to the other side until the end of the packet. 
Or.....

	In any case, I think that the serial port is useable,
and its to cheap to ignore. 
	
BTW: I've got the system call interface and the AF_UNIX domain
code about finished, and I'll be tossing it out for beta testing
*real*soon*now*, so watch this space.

					:alex
Alex Crain
Systems Programmer			alex at umbc3.umbc.edu
Univ Md Baltimore County		umbc3.umbc.edu!nerwin!alex



More information about the Unix-pc.general mailing list