[Info-vax] VMS internals design, was: Re: BASIC and AST routines

Johnny Billquist bqt at softjar.se
Sun Nov 28 20:33:16 EST 2021


On 2021-11-26 20:26, Simon Clubley wrote:
> It turns out that the reason those arguments are available to the called
> function is because VMS needs to preserve those registers across the AST
> call and some bright spark during the design of VMS thought it was
> acceptable to push those registers onto a user-visible call frame instead
> of storing them in a private area that the called AST function did not
> have access to.

It seems you understand neither how interrupts (hardware or software) 
work, nor where the problem actually is here.

> That's the kind of design decision that was so insane it should never
> have passed a design review but at least it appears to have been fixed
> in later architectures with a private storage area, just like it should
> have been on VAX.

No. You're nuts, and don't seem to understand some very simple things.

> And the reason I thought it _must_ be Macro-32 related was because the
> real reason was so crazy it never even occurred to me. :-)

Well, after reading your rants, I'm not sure you even understand what 
the problem actually is.


Let's first observe that saving information on the stack when interrupt 
happens are both common and normal, and is not unique to VAX or VMS.
All systems do it, even Unix.
What do you think happens when you get a signal? The previous context is 
stored on your stack, and your signal handled is called. Exactly the 
same as with the AST under VMS. There is literally no difference.

And when writing in assembler, it's all very simple and straight 
forward. You don't normally care what's on the stack beyond the possible 
arguments have have there that you might need to remove before 
returning. In VMS, that would be AST dependent parameters, which are 
there for your use, and which you should remove before returning (I 
think you need to remove them manually, but I might be misremembering. 
You need to do it manually in RSX at least).

Where things go a bit weird is that in some (maybe all?) high level 
languages, some additional stack content is exposed in the function 
signature. There is absolutely no requirement that they need to be. But 
this has nothing to do with VMS, and all to do with the language 
implementation in relation to ASTs.
Why DEC choose to expose these elements on the stack to the AST function 
is beyond me. You could possibly argue that there could be some reason 
for sometimes being able to examine these in order to do something 
specific, but in general I can't really think of a good reason, and if I 
had designed the language environment, I'd kept them out of visibility.
It would be easy to do this, so it was obviously a conscious decision by 
DEC for the high level languages to expose the information.

But again - this do not have anything to do with VMS itself, and VMS 
isn't doing anything different than Unix is (well, actually ASTs work 
much better than signals, but the reason and context for that should be 
a different thread).

Unix on the other hand made the decision that the similar kind of 
information on the stack when a signal handler is called is not being 
exposed in the function signature.
Makes much more sense if you ask me, but this is something for the C 
language, and don't have anything to do with Unix as such. The 
information is there on the stack. It's just not exposed to the function.

   Johnny



More information about the Info-vax mailing list