Sean Conner wrote:
... 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?
The calling routine does:
MOVAB G^COND_HANDLER, (FP)
to set COND_HANDLER as _its own_ condition handler,
then it does
; PUSH stuff ...
CALLS #n, G^WHATEVER
WHATEVER may well set its own condition handler (WHATEVER_HANDLER).
So now if a a routine invoked by WHATEVER goes bang the OpenVMS
code looks for a non-zero 0(FP) and if it finds one it invokes it.
If it doesn't, then it walks the stack frames until it finds one or
realises that the process has no specific handler set. If
WHATEVER_HANDLER exists, it gets invoked and does whatever it does.
It may handle the condition itself or it may decide that this one
is not for it and resignal (in which case the search for a handler
continues). Next COND_HANDLER gets asked whether it would like
to deal with the condition ... and so on through successive
stack frames.
I think the internals manual deals with this is some detail.
Antonio