Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-11 - 43,50527/psi.mac
There are no other files named psi.mac in the archive.
	Title	PSI - A collection of PSI subroutines for MAILER
	Subttl	David L. Edwards, Jr.

	Search	Uuosym,Macsym
	Twoseg
	Reloc	400000

	Entry	PSIINI,PSION,PSIOFF,PSICRT,PSINRM,PSIRES

Comment	%
	These are a collection of subroutines manupulating the software
	interrupt system for the MAILER.

	PSIINI	- Initializes the software interrupt system setting traps
		  for ^C's and unexpected error conditions.
	PSION	- Turns on the PSI system.
	PSIOFF	- Turns off the PSI system.
	PSICRT	- Sets the critical code flag which inhibits ^C
	PSINRM	- Allows ^C again
%
;Registers
	T1=1
	T2=2
	T3=3
	T4=4
	P=0
;Macros

Define	PSIADD	(Cond,Pri)<
	Move	T2,[Exp	Cond]	;;Condition
	Setz	T3,		;; No reasons/vector offset
	Move	T4,[Xwd Pri,0]	;; Priority
	Move	T1,[Exp Ps.fac!T2]
	PISYS.	T1,		;; Add condition
	 Outstr	[Asciz/%MAIPAI Unable to add condition (cond) to interrupt system
/]
>
	Subttl	PSIINI - Init the PSI system

PSIINI:	
	Movei	T1,PSIPRC	; Processor
	Movem	T1,Psivct+.Psvnp; Init the PSI block
	Setzm	Psivct+.Psvop
	Setzm	Psivct+.Psvis
	Movsi	T1,(Ps.vpo!Ps.vpm)
	Movem	T1,Psivct+.Psvis

	Movei	T1,Psivct	; Address of block
	PIINI.	T1,		; Set up PSI system
	 Jrst [ OUTSTR	[Asciz/?MAIPSI Unable to initialize the PSI system
/]
		MONRT.
		Popj	P,	]
	PSIADD	(.Pctle,1)	; Time limit exceeded
	PSIADD	(.Pcstp,0)	; ^C typed
	PSIADD	(.Pciuu,1)	; Illegal UUO
	PSIADD	(.Pcimr,1)	; Illegal Memory reference
	PSIADD	(.Pcack,1)	; Address check
	PSIADD	(.Pcpdl,1)	; PDL overflow
	PSIADD	(.Pcnxm,1)	; NXM trap
	PSIADD	(.Pcuej,1)	; Unexpected job error
	PSIADD	(.Pcxej,1)	; Unexpected external job error
	Setom	Critical	; Indicate that we are now critical
	Popj	P,
	Subttl	PSIRES - Perform a RESET with PSI system on
PSIRES:
	Move	T1,[Xwd ^D100,Psibuf]
	PISAV.	T1,		; Save the interrupt system
	 OUTSTR	[Asciz/%MAIUSI Unable to save interrupt status information
/]
	RESET			; Perform the desired RESET
	Movei	T1,Psibuf
	PIRST.	T1,		; Restore the interrupt system
	 OUTSTR	[Asciz/%MAIURI Unable to restore interrupt status information
/]
	Popj	P,
	Subttl	PSION - Turn on PSI system
PSION:
	Movsi	T1,(Ps.fon)	; Turn on PSI system
	PISYS.	T1,
	 OUTSTR	[Asciz/%MAIUEI Unable to enable interrupt system
/]
	Popj	P,
	Subttl	PSIOFF - Turn off PSI system
PSIOFF:
	Movsi	T1,(Ps.fof)	; Turn off PSI system
	PISYS.	T1,
	 OUTSTR	[Asciz/%MAIUDI Unable to disable interrupt system
/]
	Popj	P,
	Subttl	PSICRT & PSINRM - Critical code processing

PSINRM:	Tdza	T1,T1		; Indicate out of critical code
PSICRT:	Seto	T1,		; Indicate in critical code
	Movem	T1,Critical	; Save indicator
	Popj	P,
	Subttl	PSIPRC - Process PSI interrupts
PSIPRC:
	Push	P,T1		; Save our state
	Push	P,T2
	Push	P,T3
	Push	P,T4
	Hrrz	T1,Psivct+.Psvfl; Get the flag word
	Cain	T1,.Pcstp	; Is this a ^C trap?
	 Jrst	PSISTP		; Yes, process special
	Cail	T1,.Pcxej	; In range?
	 Jrst	PSIERR		; No, special message
	Movm	T1,T1		; Make it proper
	Jumpg	T1,PSIERR	; If positive then bad
	Pushj	P,PSIOFF	; Turn off interrupt system
	RESET			; Fatal error has occurred - Reset world
	OUTSTR	[Asciz/
?MAIFIO Fatal interrupt occurred: /]
	OUTSTR	@Psitab(T1)	; Print the appropriate message
	OUTSTR	[Asciz/
/]
	Setzm	.Jbsa
	Setzm	.Jbren
	Pushj	P,Echo##	; Make sure we turn on ECHO
	EXIT			; Die!

PSIERR:	OUTSTR	[Asciz/
%MAIUIO Unexpected interrupt occurred - Ignored
/]
PSIRET:	Pop	P,T4
	Pop	P,T3
	Pop	P,T2
	Pop	P,T1
	DEBRK.			; Dismiss the interrupt
	 Jfcl
	OUTSTR	[Asciz/
?MAIDMF DEBRK. monitor call failure
/]
	Pushj	P,Echo##
	EXIT			; Give up

PSISTP:	Skipn	Critical	; Are we critical?
	 Jrst	stopok		; No, so process
	OUTSTR	[Asciz/%MAIPWC Please wait for ^C
/]
	Jrst	PSIRET		; Finish

Stopok:	Setzm	.Jbsa		; Clear start address
	Setzm	.Jbren		; and reenter address
	Pushj	P,PSIOFF	; Turn off the PSI system
	Pushj	P,Echo##
Stoplp:	RESET			; Clear any open files
	MONRT.			; Exit to the monitor
	OUTSTR	[Asciz/
?MAICCM Can't continue MAILER
/]
	Jrst	Stoplp		; Start over

	[Asciz/***Unexpected (Illegal)/]
	[Asciz/External fatal job error/]
	[Asciz/Fatal job error/]
	[Asciz/***Unexpected .PCAPC/]
	[Asciz/Non-existant memory reference/]
	[Asciz/***Unexpected (Reserved)/]
	[Asciz/PDL overflow/]
	[Asciz/***Unexpected .PCARI/]
	[Asciz/Address check/]
	[Asciz/Illegal memory reference/]
	[Asciz/Illegal monitor call/]
	[Asciz/***Unexpected .PCUUO/]
	[Asciz/***Unexpected .PCSTP/]
	[Asciz/***Unexpected (Reserved)/]
	[Asciz/Time limit exceeded/]
	[Asciz/***Unexpected (Illegal)/]
PSITAB:
	Subttl	Data area
	Reloc

PSIVCT:	Block	4
CRITICAL: Block 1
PSIBUF:	Block	^D100

	End