[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

451.0. "Toggle VERIFY Outband ASt" by IOSG::BAILEY (Plug in \Turn on \Tune out) Fri Apr 24 1987 16:02


A search of HACKERS and the TOOL SHED for a title containing either
KEY or OUTBAND found no entries along the following lines,
(I just hope I did'nt miss something!!)

The program following the <FF> is a very crude 'hack' of a program
to define Control V (V for verify!) as a 'toggle verify' command.

The program sets up an out of band AST on Control V in EXEC mode
(so it exists for the life of the process) such that when you hit
Control V it fires off an EXEC mode AST that just toggles the verify
bit in your P1 space. (the ast code is stored in your P1 space
at CTL$A_COMMON)

IE: Your running your favorite command procedure  and you want to
see what happens at some point, Hit Cntl V to turn verify on
then later hit Cntl V to turn verify off

This program is a very cutdown version of the code in this months
DEC PROFESSIONAL by  Lee K Gleason of Houston Texas (his is a lot lot better,
I just wish I had thought of the idea !!!!)


Peter Bailey


; Code to enable Cntl V as a 'toggle verify' command

; link with the system & DCl symbol tables

	.link	/sys$system:dcldef.stb/
	.link	/sys$system:sys.stb/
	.library	/sys$library:lib/

; definations for Access mode (PSL) & Breaktho
	$psldef
	$brkdef


iosb:	.blkl	2			; IO status buffer for $BRKTHU

mask:	.blkl	2			; Mask specifying what control character
					; to act on


item:	.word	10			; GETjpi item list to get our terminal name
	.word	jpi$_terminal
	.long	device+8
	.long	device
;
	.long	0


; very silly macro to test returned status

	.macro	check	ar0,aerror,?l3
	blbs	ar0,l3
	brw	aerror
l3:	nop
	.endm	check


	.entry	start,0			; code starts here

	$getjpiw_s	itmlst=item	; get our terminal name

	bbcs	#22,mask+4,5$		; set bit 22 (Cntl V) in the Qio mask
5$:	nop

	$cmexec_s	routin=it	; get into exec mode for the rest

	ret


; Exec mode routine that loads the Ast code into the P1 common
; area (exits with Vector inuse if the first longword is not zero)
; and sets up an exec mode Ast that will run this code on Cntl V

	.entry	it,0

; test the common area, if the first long word is not zero then
; we will exit with Vector In Use

	tstl	g^ctl$a_common
	beql	10$
	movl	#ss$_vecinuse,r0
	ret
10$:	nop

; assign an exec (process permanent) channel to our terminal

	$assign_s	chan=chan,-
			devnam=device,-
			acmode=#psl$c_exec
	check	r0,error

; move the ast code to the common P1 space so it is pp

	movc3	#code_len,code,g^ctl$a_common

; setup an Ast to point to the code in the P1 space, to act on Cntl V

	$qiow_s	chan=chan,-
		func=#io$_setchar!io$m_outband,-
		iosb=iosb,-
		p1=@#CTL$A_COMMON,-
		p2=#mask,-
		p3=#psl$c_exec
	check	r0,error
	movw	iosb,r0
	check	r0,error

; all done !!

error:	ret

; all the code from here down will be loaded into the P1 common area
; so it is PP

	.entry	code,0
	pushr	#^m<r0,r1,r2,r3,r4,r5,r6,r7,r8,r9>	; save all 

; make all the descriptors will will use PIC (must be a better way to do this)

	movab	von+8,von+4
	movab	voff+8,voff+4
	movab	ctr+8,ctr+4
	movab	out+8,out+4
	movab	device+8,device+4


; get pointer to the process PRC area

	movl	@#ctl$ag_clidata+ppd$l_prc,r6

; toggle the verify bit

	xorw	#prc_m_verify,prc_w_flags(r6)

; test the verify bit so we can write the correct message to sys$output

	bitl	#prc_m_verify,prc_w_flags(r6)
	beql	5$			; write a 'Verify off message

	movaq	von,r6
	brw	10$

5$:	nop
	movaq	voff,r6
10$:	nop

; use FAO to format the message

	movl	#100,out
	$fao_s	ctrstr=ctr,outbuf=out,outlen=out,-
		p1=r6

; Broadcast it to the terminal

	$brkthru_s	msgbuf=out,-
			sendto=device,-
			sndtyp=#brk$c_device,-
			reqid=#brk$c_dcl

; restore all

	popr	#^m<r0,r1,r2,r3,r4,r5,r6,r7,r8,r9>

	ret


; FAO format control string to turn reverse vid on/off
ESC	=	27
ctr:	.ascid	<ESC>/[0;7m !AS /<ESC>/[0m/


; FAO output string

out:	.long	100
	.long	out+8
	.blkb	100

; terminal channel

chan:	.blkw	1

; our terminal device name

device:	.ascid	/                             /

; verify on/off messages

von:	.ascid	/Verify is ON/
voff:	.ascid	/Verify is OFF/

code_len=.-code		; length of code to be loaded into the P1 common area

	.end	start

T.RTitleUserPersonal
Name
DateLines
451.1Requires CMEXEC & LOG_IOIOSG::BAILEYPlug in \Turn on \Tune outFri Apr 24 1987 18:130
451.2Control F for files....IOSG::BAILEYPlug in \Turn on \Tune outWed Apr 29 1987 16:0553
Extension to .0, the new program enables Cntl V (as .0) and
Cntl F (F for files :-) as a 'show what devices/ files I have open'

As .0 the code is loaded into your P1 common area and an enable
outofband AST is set for Cntl V & F, when you bash Cntl F in (say)
Mail you get a display as follows


R   997,W     0 OIO  0; File * = _$1$DUS100:[SYSCOMMON.SYSEXE]MAIL.EXE;1 
R   343,W     0 OIO  0; File   = _$1$DUS100:[SYSCOMMON.SYSLIB]LIBRTL.EXE;6 
R   629,W     0 OIO  0; File   = _$1$DUS100:[SYSCOMMON.SYSLIB]SMGSHR.EXE;1 
R  1314,W     0 OIO  0; File * = _$1$DUS100:[SYSCOMMON.SYSLIB]SECURESHR.EXE;1 
R     5,W     0 OIO  0; File   = _$1$DUS100:[SYSCOMMON.SYSEXE]SYSUAF.DAT;1 
R     3,W     0 OIO  0; File   = _$1$DUS100:[SYSCOMMON.SYSEXE]VMSMAIL.DAT;1 
  -    72 -     OIO  1; Device = BLOTT$RTA1 
R    73,W     0 OIO  0; File   = _$1$DUS100:[SYSCOMMON.SYSMSG]CLIUTLMSG.EXE;1 
R    19,W     0 OIO  0; File   = _$1$DUS100:[SYSCOMMON.SYSMSG]SHRIMGMSG.EXE;1 
R    13,W     0 OIO  0; File   = _$1$DUS12:[BAILEY.VAX_MAIL]MAIL.MAI;6 
Exit Status = 1
MAIL> 


So we have done 13 reads & no writes on my mail file and we have
one outstanding IO (OIO) on my terminal (but 72 operations)

Channels to devices only show the total IO count as the read/writes
are not available, also a device channel only shows up if it
has a none zero OIO (stops a large display)

If you have no priv to access a file then you dont see that file
spec in the display (ie if I had done the above without READALL or BYPASS
then we would'nt see the channel to SYSUAF.DAT


I think the above could be usefull in many ways but one (from a former life
as an operator) when you are doing a Backup a Cntl F will tell you
how far you have got (and how long before you can go home!!)


Does it work ok ? All I say is it seems to work fine on my
V4.5 & V4.6 systems , any problems and I will *try* to fix them


Requires CMEXEC & LOG_IO to load the code and enable the Ast's


IOSG""::BOTH.EXE


(Should I enter this in the Toolshed ?)


Peb
451.3Real SlickFROST::HARRIMANDoubletalk...DoubletalkThu Apr 30 1987 13:007
    
    By all means put it in the Toolshed.
    
    Could you leave either the source or a non-traceback-linked version
    somewhere?
    
    
451.4Please put the source here!TALLIS::FISHERKay R. FisherFri May 01 1987 18:3720
Put the source here!

What a great hack - with this we can expand and 

1.  Re-map most of our keys (so they push something else into the type-ahead).
    That way we could make that back tick really look like an escape.

2.  Turn this into a sidekick like utility.

3.  Add functionality to the command line editing (^d could really delete
    and not backspace).

4.  Etc.

              _!_
Bye        ----O----
Kay R. Fisher / \
 
==============================================================

451.5Crashes VMS if INSTALLed with privs.KALLON::EIRIKURFri May 01 1987 19:4712
    I tried installing the image with cmexec and log_io so that I could run
    it from my unpriv'ed user account.  No dice.  When I try to run it from
    the unpriv'ed account VMS crashes on my VSII.  I suppose that this is
    not too surprising.  Interestingly, after the install it works fine
    from an account with setprv even when $ set process/priv=noall is in
    effect.  I don't have the console info, since my VSII scrolls it
    away.
    
    Any guesses as to what's up?
    
    	Eirikur
    
451.6Yuck..IOSG::BAILEYBeen down so long; looks like up to meFri May 01 1987 20:0122


Sorry about the crash  ,,,, 

Whats up ?, no idea at the moment since its never crashed anything
for me, can I have a copy (or a pointer to ) your crash
dump file



IOSG""BOTH.EXE has been deleted, till I can sort this out


Again sorry...


Peter Bailey


( a system crash was the last thing I expected since it only runs in exec
mode)
451.7Still trying to get a dump (LAVC...)SARAH::EIRIKURFri May 01 1987 21:225
    Don't feel that you should keep this from people just because of
    my crash.  I'm having a real problem trying to get a dump for you.
    
    	Eirikur
    
451.8Yes but..IOSG::BAILEYBeen down so long; looks like up to meSat May 02 1987 00:3113
>    Don't feel that you should keep this from people just because of



Yes but before I post the code I would like to think I've
got the nasty bugs out

I'am out on monday but tuesday i'll start a real hard look
at the code to see any holes...if i cannot find then i'll
post the code anyway (with a warning message)


Peb
451.9Is bugcheckfatal set?YALI::LASTOVICAStuck in a Lather-Rinse-Repeat loopSun May 03 1987 16:272
    If BUGCHECKFATAL (or whatever the spelling) is set, an exec mode
    bugcheck will crash the system.
451.10Warning *Hack* code followsIOSG::BAILEYBeen down so long;looks like up to meWed May 06 1987 16:28762
; source for .2 follows
;
;
;
; Program to enable Control V as a 'toggle verify command'
; and Control F as a 'What files/devices do I have open'
; 
; The program creates two process permanent channels to your
; terminal (assigned in Exec mode) and uses the QIO 
; io$_setchar io$m_outband function to place an Ast on each channel.
; The Ast's are enabled for Cntl F&V and point to two seperate
; routines loaded in your P1 space, these routines were loaded
; in the P1 common area CTL$A_COMMON, but with the addition of
; extra code it no longer fits in this area, so to load the code
; so it is process permanent the program expands your P1 region
; and 'moves' the pointer to the base of the process permanant
; region CTL$GL_CTLBASVA to point to the end of the expanded area
; ( a neat idea I picked up from Richard Demorgan), in effect
; we have created our own 'common' area .
;
; The routine that is woken by a Control V just toggles the
; bit in your P1 space that control the verify state.
;
; The routine that gives the list of files
; works by find the base of your list of CCB (Channel Control Blocks)
; pointed to by CTL$GL_CCBBASE (the number of these is CTL$GL_VECTORS)
; and works its way up this list checking for one in use
; (CCB$B_AMOD is non zero), when we find a used CCB
; we have the following data available from the CCB
;
; Device UCB address, Window Control Block address, Channel status
; Channel access mode (+1), number of outstanding IO's
;
; For a channel to a device the WCB address is zero and
; for a file it is the address of a WCB BUT for a channel
; to a section file (installed) the WCB is of the form 0000FFF8 ,
; this turns out to be an offset into a list of Section control
; blocks
;
; (In the Control F routine FAO parameters are built 'on the fly'
; in a FAOL control block)
;
; Channels to devices only show the total IO count as the read/writes
; are not available, also a device channel only shows up if it
; has a none zero OIO (stops a large display)
;
; If you have no priv to access a file then you dont see that file
; spec in the display 
; 
; When you Set Host to a remote system the RTPAD image stops you
; getting two Control T reports by disabling Control T in the
; 'source' session, since RTPAD knows nothing about Control F&V
; I check at the start of the Ast routine if we are hosting
; and if so just skip to the end of the routine without any
; output
; 
; 
; 
; I think this could be usefull in many ways but one (from a former life
; as an operator) when you are doing a Backup a Cntl F will tell you
; how far you have got (and how long before you can go home!!)
; 
; 
; Does it work ok ? All I say is it seems to work fine on my
; V4.5 & V4.6 systems , any problems and I will *try* to fix them
; 
; 
; Requires CMEXEC & LOG_IO to load the code and enable the Ast's
; 
;
;
;This program is based on code in this months DEC PROFESSIONAL 
;by  Lee K Gleason of Houston Texas 
;
;
;   
;
; link with the system & DCl symbol tables
	.link		/sys$system:dcldef.stb/
	.link		/sys$system:sys.stb/
	.library	/sys$library:lib/

; definations 
	$ttyucbdef
	$dcdef
	$prtdef
	$psldef
	$brkdef
	$fcbdef
	$secdef
	$pcbdef
	$phddef
	$wcbdef
	$fibdef
	$atrdef
	$ucbdef
	$ddbdef
	$ccbdef
	$sbdef

mask:	.blkl	2			; Mask specifying what control character
					; to act on

item:	.word	10			; GETjpi item list to get our terminal name
	.word	jpi$_terminal
	.long	device+8
	.long	device
;
	.long	0

; very silly macro to test returned status

	.macro	check	ar0,aerror,?l3
	blbs	ar0,l3
	brw	aerror
l3:	nop
	.endm	check

; terminal channels storage for Process Permanent channels

chan1:		.blkw	1
chan2:		.blkw	1

vmsg:	.ascid	/Setting Enable Cntl V/		; terminal message

fmsg:	.ascid	/Setting Enable Cntl F/		; terminal message


	.entry	start,0				; code starts here

	$getjpiw_s	itmlst=item		; get our terminal name
	check	r0,10$

	$cmexec_s	routin=it		; get into exec mode for the rest

10$:	ret

;
; Exec mode routine that expands P1 space & loads the Ast code ,
; a test is done on CTL$GL_SITESPEC and if none zero this routine
; exits with Vector inuse (Sitespec is loaded by this routine),
; sets up an exec mode Ast that will run the 'loaded' code on Cntl V/F

	.entry	it,0

	movab	nocrash,(fp)			; establish a condition handler

; test if we have run this program before, exit with Vector In Use if Yes

	tstl	g^ctl$gl_sitespec
	beql	10$
	movl	#ss$_vecinuse,r0
	ret
10$:	nop

; assign an exec (process permanent) channel to our terminal, for Cntl V

	$assign_s	chan=chan1,-
			devnam=device,-
			acmode=#psl$c_exec
	check	r0,error

; assign an exec (process permanent) channel to our terminal, for Cntl F

	$assign_s	chan=chan2,-
			devnam=device,-
			acmode=#psl$c_exec
	check	r0,error


; Expand the process permanent part of P1 space

	$cmkrnl_s	routin=load
	check		r0,error

; move the ast code to P1 space so it is Process Permanent

	movc3	#code_len,code,@p1_low

; setup an Ast to point to the code in the P1 space, to act on Cntl V

	bbcs	#22,mask+4,5$			; set bit 22 (Cntl V) in the Qio mask
5$:	nop

	pushaq	vmsg				; Tell us 'seting Cntl V'
	calls	#1,g^lib$put_output

	movl	p1_low,r6

	$qiow_s	chan=chan1,-			; Enable An ASt for Cntl V
		func=#io$_setchar!io$m_outband,-
		iosb=iosb,-
		p1=(r6),-
		p2=#mask,-
		p3=#psl$c_exec
	check	r0,error
	movw	iosb,r0
	check	r0,error

	clrl	mask+4

	bbcs	#6,mask+4,15$			; set bit 6 (Cntl F) in the Qio mask
15$:	nop

	pushaq	fmsg				; Tell us 'seting Cntl F'
	calls	#1,g^lib$put_output

	movl	p1_low,r6

	addl2	#offset_to_cntlf,r6		; add offset to the Control F routine

	$qiow_s	chan=chan2,-			; Enable An ASt for Cntl V
		func=#io$_setchar!io$m_outband,-
		iosb=iosb,-
		p1=(r6),-
		p2=#mask,-
		p3=#psl$c_exec
	check	r0,error
	movw	iosb,r0
	check	r0,error

; all done !!

error:	ret

;
; Kernel mode code to expand the base of P1 space, make it permanent,
; fill in a 'flag' so we can test if we have run this program later &
; set protection on the expanded region


	.entry	load,0

	movab	nocrash,(fp)			; establish a condition handler

; convert the size of the ast code to a number of pages

	movl	#code_len,r5
	divl2	#512,r5
	incl	r5

; Expand the P1 region to hold the Ast code

	pushl	#1
	pushl	#psl$c_exec
	pushab	p1_high
	pushl	r5
	calls	#4,g^sys$expreg
	blbc	r0,10$

; set protection on the Ast code pages so we can read/write them

	$setprt_s	inadr=p1_high,-
			acmode=#psl$c_exec,-
			prot=#prt$c_ew
	blbc	r0,10$

; save the original value for the base of P1 (really only so we can
; test if we have run this program allready)

	movl	g^ctl$gl_ctlbasva,g^ctl$gl_sitespec

; Make the code area permanent by reseting the base of P1 space

	movl	p1_low, g^ctl$gl_ctlbasva

; save the address of the longword that marks what out_of_band ast;s
; are enabled (so later we can test if this process has Set Host)

	movaq	device, r1			; get the device name descriptor
	jsb	g^ioc$searchdev			; find the device
	moval	ucb$l_tl_outband(r1),band	; save the UCB Ast mask

10$:	ret					; all done

; Two longwords that hold the starting/Ending addresses of the area 
; which will hold our code

p1_high:	.blkl	1
p1_low:		.blkl	1


; 
; all the code from here down will be loaded into P1 space 
; so it is Process Permanent, code is activated by either a
; Cntl F or V


; toggle the state on Verify on a Control V
	.entry	code,0

	pushr	#^m<r0,r1,r2,r3,r4,r5,r6,r7,r8,r9>	; save all 

; test if this process has set host to a remote system, if yes
; then skip to the end of this routine


	bbc	#15,@band,100$
	popr	#^m<r0,r1,r2,r3,r4,r5,r6,r7,r8,r9>
	ret
100$:	nop


; make all the descriptors we will use PIC (must be a better way to do this)

	movab	von+8,von+4
	movab	voff+8,voff+4
	movab	ctr9+8,ctr9+4
	movab	out+8,out+4
	movab	device+8,device+4

; get pointer to the process PRC area

	movl	@#ctl$ag_clidata+ppd$l_prc,r6

; toggle the verify bit

	xorw	#prc_m_verify,prc_w_flags(r6)

; test the verify bit so we can write the correct message to sys$output

	bitl	#prc_m_verify,prc_w_flags(r6)
	beql	5$			; write a ^Verify off message

	movaq	von,r6			; Verify ON message
	brw	10$
5$:	nop

	movaq	voff,r6			; Verify OFF message
10$:	nop

; use FAO to format the message

	movl	#100,out
	$fao_s	ctrstr=ctr9,outbuf=out,outlen=out,-
		p1=r6

; Broadcast it to the terminal

	$brkthruw_s	msgbuf=out,-
			sendto=device,-
			sndtyp=#brk$c_device,-
			reqid=#brk$c_dcl

; restore all

	popr	#^m<r0,r1,r2,r3,r4,r5,r6,r7,r8,r9>

	ret

offset_to_cntlf = . - code		

;
; routine to tell us 'devices/files open'

	.entry	cntlf,0

	pushr	#^m<r0,r1,r2,r3,r4,r5,r6,r7,r8,r9>	; save all 

; test if this process has set host to a remote system, if yes
; then skip to the end of this routine


	bbc	#15,@band,10$
	brw	qxt
10$:	nop

; Make descriptor PIC

	movab	device+8,device+4

; Number of CCB's to search

	movzwl	g^ctl$gl_vectors,r9

; Base of the CCB list

	movl	g^ctl$gl_ccbbase,r8

loop:	subl2	#ccb$k_length,r8		; Skip up one CCB

	movb	#^a/ /,type			; zero down the file type

	decl	r9				; have we got to the end
	bneq	10$				; of the CCB list ?
	brw	fin
10$:	nop


; is this CCB in use ?
	tstb	CCB$B_AMOD(r8)
	beql	loop

; find out the device name to go with the UCB
; append a $ sign if the scsnode name of the system
; that owns the device is none zero

	movl	CCB$L_UCB(r8),r7

	movl	ucb$l_ddb(r7),r6

; pad node name with $'s
	movc5	#0,(sp),#^a/$/,#16,node

	movl	ddb$l_sb(r6),r0

	movzbl	sb$t_nodename(r0),node_length

	movc3	node_length,sb$t_nodename+1(r0),node

; if nodename none zero then append a $ sign

	tstl	node_length
	beql	700$
	incl	node_length
700$:	nop

; save the device controller name (ie DUA)

	movzbl	ddb$b_name_len(r6),r5

	incl	r5

	movc3	r5,ddb$t_name(r6),dev

; make descriptor PIC

	movab	out+8,out+4

	movab	ctr1+8,ctr1+4

; zero down the FAO parameter block

	movc5	#0,faol,#0,#50,faol

; put the FAO argumemts into the FAO control block
; to generate a full device name

	movl	node_length,faol
	movab	node,faol+4
	movab	dev,faol+8
	movw	ucb$w_unit(r7),faol+12

; generate an full device name string (node$device unit)

	movl	#100,out
	$faol_s	ctrstr=ctr1,outbuf=out,outlen=out,prmlst=faol
	check	r0,fin

; save the Window block address

	movl	ccb$l_wind(r8),window

; zero down the FAO parameter block

	movc5	#0,faol,#0,#50,faol

	movab	ctr8+8,ctr8+4

	movab	descr+8,descr+4

; put the FAO argumemts into the FAO control block
; to tell us Device name, total operations etc

	movl	ucb$l_opcnt(r7),faol
	movw	ccb$w_ioc(r8),faol+4
	movab	out,faol+8

; Use FAO to build a string that contains
; <Operation count>   Number of outstanding IO's        Device name

	movl	#200,descr
	$faol_s	ctrstr=ctr8,outbuf=descr,outlen=descr,prmlst=faol
	check	r0,fin

; if the channel is open to a none disk device, go stright
; to the 'display device' code

	cmpb	ucb$b_devclass(r7),#dc$_disk
	bneq	600$

; if this is a file CCB then skip the display to output and
; go work out the file name

	tstl	window
	blss	df			; a file WCB (ie 8000000)
	bgtr	dc			; a section WCB (ie 00005555)
600$:	nop

; only display a device channel if there is an outstanding IO

	tstw	ccb$w_ioc(r8)
	beql	800$

; tell the terminal the 'Device = ' data

	$brkthruw_s	msgbuf=descr,-
			flags=#brk$m_NOREFRESh,-
			sendto=device,-
			sndtyp=#brk$c_device,-
			reqid=#brk$c_dcl
	check	r0,fin

800$:	brw	loop			; and the next one Please...


; We have a channel to a Section file, so we must get the Window
; block address before using Qio 

dc:	nop

; mark the type as a section file

	movb	#^a/*/,type

; get our PCB address

	movl	g^ctl$gl_pcb,r0

; get our PHD address
	movl	pcb$l_phd(r0),r0

; get address of the base of the list of section control blocks
	addl2	phd$l_pstbasoff(r0),r0

; neg offset into list

	cvtwl	ccb$l_wind(r8),r1

; save the Window Control Block address

	movl	sec$l_window(r0)[r1],window


; Get a full file spec from the 3 Fid words in the File Control Block

df:	nop

; get a channel to the 'full device name' created above'

	$assign_s	chan=devchan,-
			devnam=out
	check	r0,fin

; set fib block control function

	movl	#fib$m_noread!fib$m_nowrite!fib$m_nolock!fib$m_norecord,-
		fib+fib$l_acctl

; say we want the full file spec returned

	movw	#atr$s_file_spec,atr+atr$w_size
	movw	#atr$c_file_spec,atr+atr$w_type
	movab	file,atr+atr$l_addr

; put fid from the File control block into fib block
	movl	window,r0
	movl	wcb$l_fcb(r0),r0
	movab	fib,fiB_d+4

	movw	fcb$w_fid_num(r0),fib+fib$w_fid_num
	movw	fcb$w_fid_seq(r0),fib+fib$w_fid_seq
	movw	fcb$w_fid_rvn(r0),fib+fib$w_fid_rvn

; zero down the returned file spec string

	movc5	#0,(sp),#0,#100,file

; access file to get the full file spec

	movab	atr,r5

	$qiow_s	chan=devchan,-
		func=#io$_access,-
		iosb=iosb,-
		p1=fib_d,-		; fib block descriptor
		p5=r5			; attribute block
	check	r0,fin
	movw	iosb,r0			; check for errors from qio
	cmpl	#ss$_nopriv,r0
	bneq	2$			; if we got 'no priv '
	brw	3$			; then skip to the next CCB
2$:	nop
	check	r0,fin

	movzwl	file,descr		; put the returned file spec
	movab	file+2,descr+4		; length/address in descr

; report the file name and read/write count

	movl	window,r3
	movab	out+8,out+4
	movab	ctr7+8,ctr7+4

; fill in the FAO parameter block

	movw	wcb$l_reads(r3),faol
	movw	wcb$l_writes(r3),faol+4
	movw	ccb$w_ioc(r8),faol+8
	movl	#1,faol+12
	movab	type,faol+16
	movab	descr,faol+20

; build an output string

	movl	#200,out
	$faol_s	ctrstr=ctr7,outbuf=out,outlen=out,-
		prmlst=faol
	check	r0,fin

; tell the terminal the file name, reads-writes etc

	$brkthruw_s	msgbuf=out,-
			flags=#brk$m_NOREFRESh,-
			sendto=device,-
			sndtyp=#brk$c_device,-
			reqid=#brk$c_dcl
	check	r0,fin

; get rid of the channel to the device

3$:	$dassgn_s	chan=devchan
	check	r0,fin

	brw	loop				; and the next one Please...


; General exit routine, if we came here with a good status then just
; tell the terminal a zero length string so we can refresh any display
; in progress when all this started, otherwise tell the terminal
; the ascii final status

fin:	nop

	clrl	out

	cmpl	#ss$_normal,r0			; If routine exits with normal
	beql	10$				; status then skip to end

	movl	#100,out

	$getmsg_s	msgid=r0,-		; get message for return code
			msglen=out,-
			bufadr=out

10$:	$brkthruw_s	msgbuf=out,-		; tell the terminal the final
			sendto=device,-		; status AND refresh any write
			sndtyp=#brk$c_device,-	; in progress
			reqid=#brk$c_dcl

qxt:	popr	#^m<r0,r1,r2,r3,r4,r5,r6,r7,r8,r9>	; restore all

	ret

ctr1:		.ascid	/!AF!AC!UW/		; FAO control to build a full
						; device name

dev:		.blkb	100			; Device controler name 

node_length:	.blkl	1			; length of node name

node:		.blkb	20			; node name (SCSnodename)

fib_d:		.long	fib$c_length	; fib descriptor block for qio
		.long	fib

fib:		.blkb	fib$c_length	; fib block

atr:		.blkb	100		; attribute block

type:		.blkb	1		; file type, a * equals a section file

; FAO control string to tell us , file name,read writes etc
ctr7:		.ascid	/R !4UW,W !3UW OIO !2SW; File !AF = !AS/

; FAO control string to tell us device name, total operations etc
ctr8:		.ascid	/- !5UL -    OIO !2SW; Device = !AS/

file:		.blkb	1000		; string for the full file spec

devchan:	.blkw	1		; channel to assign to a disk device
					; so we can get the full file spec

iosb:		.blkl	2		; IO status block for use by Qio

descr:		.long	100		; common or garden descriptor
		.long	descr+8
		.blkb	100

window:		.blkl	1		; address of a WCB for a channel 
					; to a file

faol:		.blkl	50		; FAO parameter list,
					; built on 'the fly'



ESC	=	27

; FAO format control string to turn reverse vid on/off
; to tell us  Verify ON or OFF

ctr9:		.ascid	<ESC>/[0;7m !AS /<ESC>/[0m/

; output descriptor

out:		.long	100
		.long	out+8
		.blkb	100

; our terminal device name

device:		.ascid	/                             /

; verify on/off messages

von:		.ascid	/Verify is ON/

voff:		.ascid	/Verify is OFF/

band:		.blkl	1		; address of the longword in our
					; terminal UCB that has a bit set
					; for each Control Key Ast enabled

code_len= . - code			; length of code to be loaded into 
					; P1 space


; -----------------------------------------------------
;
; Condition handler for use in the Exec & Kernel mode routines

reason:		.long   80		; Output string descriptor
		.long	reason+8
		.blkb   80

; FAO control string, to tell us why we entered the handler 
cnt_reason:	.ascid	/Err code = !XL VA = !XL  PC = !XL  PSL = !XL/

		.entry  nocrash,^m<r2,r3>

		movl    4(ap),r2                ;Get address of signal array

		$fao_s  outbuf=reason,-		; generate error message
			outlen=reason,-
			ctrstr=cnt_reason,-
			p1=4(r2),p2=12(r2),p3=16(r2),p4=20(r2)

		pushal  reason
		calls   #1,g^lib$put_output     ;Display the reason for the crash.

		$exit_s                         ;kill the process

		RET


	.end	start

; please ! no comments about the yuck code, i know
; it looks as if this was written late at night on a dial up terminal
; under the influence of too much beer   ....  it was !

451.11The other keys ?IOSG::BAILEYBeen down so long;looks like up to meWed May 06 1987 20:5912
Anyone any good ideas for the other unused Control Keys ?

One suggestion is Control something as an increment priority
key (with a coresponding decrement control key) so you
could set your priority on 'the fly'

What other functions would people like to see on
control something?



Peb
451.12SpawnODIXIE::OSTERMANLarry OstermanThu May 07 1987 09:412
    How about "spawn a new subprocess" no matter what image is currently
    running?
451.13Status info on the fly is the most usefulFROST::HARRIMANToo much talk, Small TalkThu May 07 1987 16:089
    
    Or other status line flavors? ^T is reasonable but there is other
    information (like current PC, process state, etc) which might be
    useful too - anybody remember TOPS-10's status line and TOPS-20's?
    
    Certainly some of that info is in the PHD and PCB and can be read.
    There's yet another idea - show the PCB state...
    
    /pjh
451.14Well *maybe*IOSG::BAILEYBeen down so long;looks like up to meThu May 07 1987 19:1526
Getting the current PC (or rather the PC that was pushed
on the stack by the Ast delivery) should be fairly easy
(in fact you could display all PC's pushed on the stack
and thus trace where you are in terms of modules called
(it would be nice to do as SDA does and (try to) translate
system PC's to a symbolic location, but I think that 'may'
be a bit much for an Ast routine.. maybe not tho, its
a nice idea that you could bash Cntl P(?) and get
8000114   Sys$waitfr+4
etc ))

Could also display the PSL pushed on the stack, could be usefull,

The process state tho would allways be CUR, and (I think)
the former state is not stored anywhere


>    There's yet another idea - show the PCB state...

Dont think I follow this, the PCB State ?



Ta

Peb
451.15Not the right three-letter acronym I thinkFROST::HARRIMANToo much talk, Small TalkThu May 07 1987 21:0625
                               
    .-1
    
    My brain was running away with me and I didn't think of writing
    down what I really meant...
    
    PCB state... Let's see, what all is in the PCB that we don't usually
    get to see that could be useful? Like, PCB$W_STS or PCB$W_STATE
    which I guess you say will be CUR all the time....sigh. Or the BIO/DIO
    count which ^F gives, sort of. 
    
    I guess I was really thinking about the PHD (Process Header). Stuff
    like virtual page count, astlm, or the contents of the general
    registers if you really want to be hackish. I don't suppose I know
    enough about the process context during an AST to make any more
    useful suggestions but those were really what I was thinking.
    
    Another two which might be useful are the PSL (which you just
    mentioned) and the SP. Probably would be more useful than all the
    other dreck I was churning out just now....
    
    ah well.
    
    /pjh
    
451.16how about calling TRACEBACK or whatever it's called.VIDEO::OSMANtype video::user$7:[osman]eric.sixThu May 07 1987 21:0725
Yes, showing the symbolic trace of what modules and routines are being
executed would be quite useful.

Perhaps a resourceful way of doing it would be to call TRACEBACK or
whatever the thing is called that is normally called when a program
dies.

In other words, this TRACEBACK thing *already exists* so you just
need to figure out how to call it !  It *already* knows how to
search the symbol table, and the stack, and print out the goodies.

One interesting use would be for hitting ^T several times and getting
a statistical idea of where your program is spending most of its time
(and hence which paths would gain you the most performance improvement
if they were improved).

Note that this information is more than most performance analyzers
give you.  Most performance analyzers can tell you that routine X is
executed more than routine Y.

But it is more valuable to know that the program is spending alot of
time calling routine X from routine Z and not much time calling X from
Y.  Hence if you can avoid calling X from Z, you'll make a great gain.

/Eric
451.17Yes Traceback...IOSG::BAILEYBeen down so long;looks like up to meFri May 08 1987 08:4716
Yes I like the idea of TRACEBACK, I'll have a look tho the VMS doc
set (and sources) for more info about calling Trace back

One other Control Key could be Control H  (for hide), when you
bashed a Cntl H the word (byte?) in your P1 space that
holds the length of your current image name would be zeroed,
thus a Show Process would should you running DCL !!

(It works fine in a subroutine so an P1 Ast should be easy to
set up)

I cannot think of a good (valid) reason for this, but it could
be 'amusing'


Peb
451.18TLE::BRETTFri May 08 1987 11:294
    VAX PCA V1.0/V2.0 provides good/excellent call tree analysis, much
    better than the few dozen samples that TRACEBACK could give you.
    
    /Bevin
451.19broadcast?4GL::DIAMONDDave Diamond, DTN 381-2687Fri May 08 1987 17:243
    How about a key to toggle broadcasts?
    
    Dave 
451.20Menus?TALLIS::FISHERBattery, Mags, &amp; Gas Off!Tue May 12 1987 18:4111
How about using a single key to give you a menu...
Then after your menu it could force a repaint screen character back
into your input stream (^L) if the current image is Emacs,
^W if EDT, "ERASE<CR>" if DCL, etc...

              _!_
Bye        ----O----
Kay R. Fisher / \
 
==============================================================

451.21VIDEO::LEICHTERJJerry LeichterWed May 13 1987 01:5418
This program (it needs a name...) has one problem:  It intercepts even
when you don't really want it to.  In my editor (which is based on TECO),
CTRL/F and CTRL/V are commands - CTRL/F (forward word) is very common.
Once this program is started, I can't use CTRL/F or CTRL/V as commands.

TECO disables CTRL/T, which causes the program to disable itself, so
typing CTRL/F or CTRL/V produces no output.  However, the characters are
still not passed to the editor.

I tried the obvious fix:  Adding the IO$M_INCLUDE modifier to the two
SETMODE's.  No go; the editor STILL didn't see the characters.  (The
program continued to work as before, though there was one oddity:  In
SET HOST, a single CTRL/F or CTRL/V had no effect, but typing two in a row
acted as a line terminator!  Strange....)

The INCLUDE modifier SEEMS to be there for exactly this kind of thing.  Any
clues as to what's going on?
							-- Jerry
451.22VIDEO::LEICHTERJJerry LeichterWed May 13 1987 02:059
Quicky way to get a traceback (due to, I think, Steve Lionel):  Call LIB$SIGNAL
for a warning message with the "don't output message" bit set - %X20000000
will do (I THINK that's the right bit).  It's a bit trickier from kernel or exec
mode, though probably you can get away with declaring a user-mode AST that
does the signaling.  This could, of course, be blocked if user mode AST's are
disabled for some reason.  There is code around that delivers signals
"cross mode", used for the DCL DEBUG command and turning hardware exceptions
into signals.
							-- Jerry
451.234GL::DIAMONDDave Diamond, DTN 381-2687Mon May 18 1987 12:556
    Another key I could use would display the current DCL prompt string.
    Whenever I switch LAT sessions, I can never remember which session is
    which, but if I could see the prompt (even inside a program or editor),
    I would know what was happening.
    
    Dave
451.24How to clear ^V & ^F?NANUCK::SSMITHI refuse to be intimidated by reality anymoreThu May 21 1987 19:396
    Having run the program (how about calling it P1_TOGGLE_V-F) and 
    	Setting Enable Cntl V
    	Setting Enable Cntl F
    is there any way to clear them?
    
    Shel
451.25No but YesIOSG::BAILEYBeen down so long;looks like up to meThu May 21 1987 20:189
>    is there any way to clear them?
    
At this point (short of loging out) no

It would be very easy to write a small prog to remove
the action keys, is there a need for this ?


Peb
451.26Delta ^T??CONTRL::DOOLITTLEPrimitive but effectiveFri May 22 1987 19:0710
Re: -.1	Yes, please supply a clearing program.
        
Re: .many
        It would be nice to be able to see a delta stats display,
        ie ^R (bad choice, I know) to reset a ^T type display,
        and ^D to display delta values since resetting.  
        
	keep up the good work
        
        andy
451.27Spawnable?SMAUG::MENDELWed Jun 03 1987 18:5412
    I just lifted the original CTRL-V program of .0, and I like it.
    The other ideas I don't really need, and the problems described
    herein I can live with.
    
    My question: Spawning clones the Verify Bit into the new process.
    However, the key-trigger mechanism doesn't go. The mechanics of this
    situation are very far beyond me, but can the CTRL-V program be
    hacked up more to replicate itself into sub-processes? 
    
    I would buy it.
    
    Kevin
451.28Image Verification ?MUNNAC::KRAUSERobert Krause, ACT-TEC NaC @MUHThu Jun 04 1987 06:5215
   I'm using the "BOTH" program (^V and ^F), it's GREAT !
   
   But I encountered a problem with ^V:

   E.g. if I run NCP with input from a command procedure, the NCP
   commands are not shown. As far as I remeber there is a second
   kind of verify called image verification.
   
   What you do is far beyond my knowledge of VMS, but I could imagine
   that there is a bit for image verification as well which could
   be toggled.
   
   Could you please have a look at this ?
   
   _Robert
451.29IOSG::BAILEYBeen down so long;looks like up to meThu Jun 04 1987 10:3226
Re 451.28

>   commands are not shown. As far as I remember there is a second
>   kind of verify called image verification.

>   that there is a bit for image verification as well which could
>   be toggled.

Yes there is such a bit , and to set it is one code line

	bisw	#prc_m_verimage,prc_b_flags2(r6)


BUT, this will only set image verify on for the next NOT the current
command file executed, (The DCL Set Verify command sets this bit
and does extra work to get image verify on in the current command file)
and since the whole point of Control V is to set verify here and now
I need to steal some more code from DCL to do the whole job

How long ? will try for tomorrow since I'am on Holiday next week


Peter Bailey



451.30Semantic ArtCHAMBR::GUINEAUThu Jun 04 1987 11:5817



 Depending on the value of prc_m_verimage, this may not matter but...


>	bisw	#prc_m_verimage,prc_b_flags2(r6)
           
           ^                        ^
           |                        |






451.31what's in a name?STAR::PIPERDerrell Piper - VAX/VMS DevelopmentThu Jun 04 1987 15:013
> This program (it needs a name...) ...
    
    How about BANDAID?
451.32I follow in others footsteps...IOSG::BAILEYBeen down so long;looks like up to meThu Jun 04 1987 17:0914
>  Depending on the value of prc_m_verimage, this may not matter but...

Thats what I get for cribing from the Dcl sources  !!

Extract from the source for the Dcl set verify command


	BISW	#PRC_M_VERIMAGE,PRC_B_FLAGS2(R11);ENABLE IMAGE VERIFICATION
	BRB	80$				;EXECUTE $MODIFY

70$:	BBC	#PRC_V_VERIMAGE,-		;IF IMAGE VERIFY ALREADY CLEAR,
		PRC_B_FLAGS2(R11),90$		;  THEN DONE
	BICW	#PRC_M_VERIMAGE,PRC_B_FLAGS2(R11);DISABLE IMAGE VERIFICATION

451.33How to do the TRACEBACKMDVAX3::COARA wretched hive of bugs and flamers.Fri Dec 04 1987 05:4331
451.34Explanation of IO$M_INCLUDE problemMDVAX3::COARA wretched hive of bugs and flamers.Fri Dec 04 1987 05:489
    Oh, by the way - the IO$M_INCLUDE modifier causes the out-of-band
    character to be included in the input stream OF THE CHANNEL FOR
    WHICH THE AST WAS DECLARED.  So, unless you used the same channel RMS
    has assigned to SYS$INPUT (I don't know, I haven't read the sources),
    the ^F and ^V are being delivered to your AST's channel (which is
    probably being ignored by the AST code), not the one your editor is
    using.  So the editor won't see it.
    
    #ken	:-)}