VAX Assembly question

Sean Conner spc at conman.org
Fri Jan 19 01:19:05 CST 2007


  I'm currently perusing _Computer Programming and Architecture: The VAX-11_
by Levy and Eckhouse and I come across the description of the CALLG and
CALLS instructions.  They go on to describe the stack frame created by the
CALL* instruction:

	Condition handler (initially 0)		<- FP
	SPA | S | 0 | MASK | PSW | 0		   FP + 4
	Saved AP				   etc ... 
	Saved FP
	Saved PC
	Saved R0
		.
		.
		.
	Saved R11

  My question is about the condition handler.  In the text, it's described
as:

	A longword condition handler address.  Here, the calling routine
	may store the address of an error-handling routine to be called if
	an exceptional error condition arises in the procedure.

  This is the only section (as far as I can tell) where this is described,
and I'm curious as to how exactly it worked.  It appears that while the CPU
may set this location to 0, its purpose isn't really dictated by the
hardware, but it a convention used by VMS.  But then (as I was typing this),
I was struct by this bit:

	... the calling routine may store ... 

  Huh?  How?  The calling routine either does a:

argsize:	.long	0
arg1:		.long 	0
arg2:		.long	0
arg3:		.long	0
arg4:		.long	0

		movl	#4,argsize		; use fixed memory
		movl	filehandle,arg1		; for the arguments	
		moval	somememory,arg2
		movl	#0,arg3
		movl	#4096,arg4
		callg	argsize,dump_memory

  or

		pushl	#4096			; use the stack
		pushl	#0			; for the arguments
		pushal	somememory
		pushl	filehandle
		calls	#4,dump_memory

(forgive if my assembly isn't quite right, I'm going from the book rather
quickly here).  How can the calling code set the condition handler?  The CPU
creates the stack frame (as diagrammed above), not the calling routine.  Am
I missing something?

  -spc (Really curious about this ... )




More information about the cctalk mailing list