Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-08 - 43,50512/exch.b10
There are no other files named exch.b10 in the archive.
!	BLISS-10 module to do (simulated) process creation and exchange
!	by means of CREATE and EXCHJ, and to find the current stack base.
!
	MODULE EXCH(BLS36,SREG=#17,VREG=#1,FREG=#15,DREGS=7,RESERVE(0,#16))=
	BEGIN

!	CREATE(STK,STKL,THNRTN,RTN,ARGLST)
!	 will create an independent stack (at address contained in STK).
!	 When this stack is EXCHANGE'd to, a call to the routine in RTN
!	 is executed with the contents of ARG1,ARG2... as arguments.
!	If this routine returns, the routine in THNRTN is called
!	 with the address and length of the stack as arguments.
!	THNRTN would normally return the stack space to free storage
!	 and EXCHANGE to the next process.
	GLOBAL ROUTINE CREATEPROC(STK,STKL,THNRTN,RTN,ARGLST)=
		BEGIN
!		The following internal routine is needed because
!		CREATE wants a fixed address for the real main routine.
!		We pass our main routine and arguments to it as arguments.
		ROUTINE CCALL
			(CRTN,CARGLST,THNRTN,STK,STKL)=
			BEGIN
			(.CRTN)(.CARGLST);
			(.THNRTN)(.STK,.STKL)
			END;
		CREATE CCALL
			(.RTN,.ARGLST,.THNRTN,.STK,.STKL)
			AT .STK LENGTH .STKL
			THEN ()
		END;

	!EXCHANGE(A,B) runs the process whose stack base is in A
	! returning (to that process) the value contained in B
	GLOBAL ROUTINE EXCHANGE(A,B)=EXCHJ(.A,.B);

	!FSTACK() returns the value of the current process's stack base.
	! This is a routine for transportability (e.g. to real BLISS-36)
	GLOBAL ROUTINE FSTACK=
		BEGIN
		EXTERNAL ?.BREG;
		.?.BREG
		END;
	END
	ELUDOM