[net.unix-wizards] compat

fred.umcp-cs@Udel-Relay@sri-unix (09/13/82)

From:     Fred Blonder <fred.umcp-cs@Udel-Relay>
Date:     9 Sep 82 18:25:32-EDT (Thu)
From: Charles F. Von Rospach <CHUQUI at MIT-MC>

	Does anyone have any documenation on 'compat'? All I can find
	out about it is that it emulates PDP11 V7 Unix so you can run
	Zork. Is this correct? Is it robust enough to handle something
	like a CBASIC interpreter for PDP11, or are we in for trouble?
	Where can I get detailed info on compat?

In our experience ``compat'' is pretty reliable, but there's a minor bug
in it: It places TWO null pointers on the stack after the arguments
instead of one. This means that when the PDP-11 program looks for the
pointer to the first environment variable, it sees the second null pointer,
and can't find the environment at all, even though it's really there on the
stack, offset by one. The fix is to delete line 76 from unixstart.c

	76d76
	< 	*(--ssp) = 0;
	---

as distributed with 4.1BSD.

phb (09/14/82)

I have also had fairly good results using compat and found that it
worked reasonably well (except floating point which doesn't seem to work
at all). I did run into a bug though. The problem is caused when a
you do a pause (sleep) and then receive a signal to be woken up the pc
is clobbered so that the signal catching routine is not executed.
This only happens if the pause is a direct system call as opposed to 
an indirect call (which apparently it is). The code which causes the
error is near the bottom of unixtraps.c :
	if( indirflg == 0 )
		pc = argp;

My solution was to set a new flag in the routine dosig to indicate that a
signal had been caught and then change the above test to:
	if( !indirflg && !sigtrapped )
		pc = argp;

The sigtrapped flag is set to zero at the beginning of unixtraps.c
It seems to work.
cheers.

	Paul Breslin
	decvax!utzoo!hcr!phb

cy%helens%Sumex-Aim@sri-unix.UUCP (10/18/83)

Does anyone have a working version which supports floating point
operations?
					C. Y. Chu