Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap1_198111 - decus/20-0002/baildd.fai
There is 1 other file named baildd.fai in the archive. Click here to see a list.
COMMENT    VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002		title SDDT - makes BAIL your DDT
C00007 ENDMK
C;

	title SDDT - makes BAIL your DDT
comment \
.r maklib
*sys:sddt=sys:ddt,dsk:baildd/append:sddt
               ^        ^ this file
               ^ block structure ddt
The purpose of this is so that ^C DDT will work in the case
1:DDT;
DDT (POPJ 17,$X to return)
^C
.DDT
\
	.load sys:bail
	t1__1
	t2__2
	t3__3
	p__17
	.jbddt_74
	.jbcst_136
	external .jbsa,.jbopc,sailor,bail,.uinit,ddbail,.jbrel,.jbhrl,ddt
	internal sddt
	loc .jbddt	;make this program DDT
	,sddt		;our starting address
	loc .jbcst	;and put loc of real ddt here for bail
	,ddlink
	reloc 0

sddt:	movem t1,savacs
	movei t1,ddbail	;in future use bail, not us
	setddt t1,
	 jfcl
	skipe sailor	;if sailor is set, program has started
	jrst break		;do regular bail break processing
	movem t2,savacs+1 ;otherwise break coord 0 and start
	movem t3,savacs+2
	movei t3,0	;code for setting hi seg write priv
	hrrz t1,.jbsa	;start searching for coordinate 0
	trnn t1,400000	;if in hi segment
	jrst nothi
	setuwp t3,	; then set hi seg write priv
	 jrst go	;  if we can't, forget all this
	movem t3,olduwp	;save for later since we need t3
nothi:	hrrz t3,.jbrel	;upper limit for seaach - highest legal addr
	trne t1,400000	;unless we are in high seg
	hrrz t3,.jbhrl	;then use high seg limit
next:	move t2,(t1)	;look at program
	camn t2,[pushj p,.uinit]	;find coordinate 0
	jrst found
	camge t1,t3	;reached upper limit?
	aoja t1,next	;no - go on
	jrst go		;can't find it, so forget all this

found:	move t2,[pushj p,bailst]	;replace coord 0 with a break
	movem t2,(t1)
	move t3,olduwp	;get back old high-seg protection
	trne t1,400000	;if in high segment
	setuwp t3,	;set hi seg write prot back the way it was
	 jfcl

go:	move t3,savacs+2
	move t2,savacs+1
	hrrz t1,.jbsa	;have to strip off LH(.JBSA) for indirect jrst
	exch t1,savacs
	jrst @savacs	;now start main program

bailst:	pushj p,.uinit	;here at initial break - do what was there
	move t1,[pushj p,.uinit]	;then remove the break
	move t2,(p)	;this is return addr = addr of break+1
	movei t3,0	;clear hi seg prot if needed
	trnn t2,400000	;see if hi segment
	 jrst nothigh
	setuwp t3,	;now clear protection
	 jrst bail	;can't, forget all this
nothigh: movem t1,-1(t2) ;restore the broken location
	trne t2,400000	;and restore hi seg write protection
	setuwp t3,
	 jfcl
	jrst bail	;now make bail think it was called
			;from coordinate 0

break:	movei t1,savacs	;here if program already started
	jrst ddbail	;and let bail handle it

ddlink:	movem t1,savacs	;here if bail trying to call ddt
	movei t1,ddt	;set so ddt command is in right context
	setddt t1,
	 jfcl
	move t1,savacs
	pushj p,ddt	;now it is safe to goto ddt
	movem t1,savacs	;here on return from ddt
	movei t1,ddbail	;reset to sail context
	setddt t1,
	 jfcl
	move t1,savacs
	popj p,		;return to bail

savacs:	block 3
olduwp:	block 1
	end