[comp.os.xinu] disable macro in V6 XINU

comer@purdue.edu (Douglas Comer) (11/03/88)

  >>	     I am using version 6 of Xinu on a PDP/11.  I am attempting to
  >>	     disable the interrupts and am having a few problems.
  >>	     The first question is why when you use the disable macro must
  >>	     you use the symbol ps (ie disable(ps))?

The disable macro is a kludge.  We chose it because calling a procedure is
too expensive on slow machines.  The cc11 command inserts an awk script
between the compiler and assembler to substitute correct offsets in place
of the text "~ps".  It only works with variable name "ps" because the cpp
used doesn't substitute parameters inside quoted strings.

  >>	     Where is the space
  >>	     for this symbol defined?  Why does the compiler not care if
  >>	     you did not define it in your program?

You must define	a local variable "ps" in any procedure that calls disable()
restore().

  >>	     My second question is why the statement "disable( ps)" make
  >>	     the compiler spit up with the following error: "/tmp/ctm3a###"
  >>	     followed by an "r 20" on the line immediately below it.  The
  >>	     ### represents a random number.

That's an assembler error messages (no kidding, that's what the original UNIX
C compiler used -- really short, cryptic messages).  It's a relocation error
on line 20 of the temporary file that the C compiler has produced for you.
You must have an old version of cc11 and the substitution script.  The version
of cc11 we've distributed for many years is a C program and the awk script is
updated to catch missing ps declarations and report them.  You should get the
latest version.
	
  >>	    Finally, what does the ~ tell the assembler? (ie asm("mfps ~ps"))

It means that the symbol is to be relocated wrt the local stack (i.e., it's
a local variable in the code being assembled).


Cheers,
Doug

henry@utzoo.uucp (Henry Spencer) (11/06/88)

In article <8811031232.AA03013@merlin.cs.purdue.edu> comer@purdue.edu (Douglas Comer) writes:
>  >>	     followed by an "r 20" on the line immediately below it....
>
>That's an assembler error messages (no kidding, that's what the original UNIX
>C compiler used -- really short, cryptic messages)...

Actually, the *compiler* did a fair-to-middling job on error messages.
The *assembler*, however, was a different story, at least partly because
it was very old -- much older than the compiler -- and had to be able
to run on really small machines.  The first PDP11 Unix ran on an 11/20
with 24KB of physical memory and no MMU (meaning that both the kernel
and the biggest user process had to fit in physical memory), which
meant that the assembler had to run in 8KB or so.  Every byte counted.
-- 
The Earth is our mother.        |    Henry Spencer at U of Toronto Zoology
Our nine months are up.         |uunet!attcan!utzoo!henry henry@zoo.toronto.edu