[Info-vax] BASIC and AST routines

Bob Gezelter gezelter at rlgsc.com
Wed Nov 24 17:34:32 EST 2021


On Wednesday, November 24, 2021 at 2:00:49 PM UTC-5, Arne Vajhøj wrote:
> On 11/24/2021 1:26 PM, Simon Clubley wrote: 
> > On 2021-11-24, Dave Froble <da... at tsoft-inc.com> wrote: 
> >> On 11/24/2021 8:31 AM, Simon Clubley wrote: 
> >>> 
> >>> Fine. So why are these architecture-specific registers passed to what 
> >>> is essentially a callback function in a normal application program 
> >>> and why do those registers need to be visible from that same callback 
> >>> function ? 
> >> 
> >> Steve Hoffman answered that question way back up-thread. I'll leave it as an 
> >> exercise for you to go back and take a look. 
> > 
> > Thank you David, I have found that posting. 
> > 
> > So basically, I was right that the VMS abstraction layers are horribly 
> > broken when it comes to ASTs even though the reason is a bit different 
> > (and worse) than what I was expecting. 
> > 
> > In other operating systems that have this functionality, this is either 
> > handled by the compiler generating the appropriate code sequences after 
> > the function is tagged by the programmer or is handled directly by the 
> > underlying OS ABI _before_ calling the routine. 
> > 
> > In either case, the saved registers are private to the OS ABI or compiler 
> > and are _not_ visible to the user code. 
> > 
> > But to directly push values into the call frame for the routine (and hence 
> > directly visible to the routine) so they can be restored afterwards is just 
> > horrible, horrible, horrible. I have never seen another OS handle this 
> > problem in such an ugly way.
> Now I followed Robert Gezeltzer's advice and it is worth noting that 
> this is really a VAX thing. The newer platforms do not use the values - 
> they are just there for VAX compatibility. 
> 
> Arne
Arne,

Writing a better linkage is not a particularly difficult task. One is somewhat limited by the limitation that two values are passed, the AST Entry Address and the AST Parameter.

On more than a few occasions, particularly when using ASTs with QIO on the RSX-11 family using 16-bit integers, where ASTPARM was not available, the straightforward solution was to use a data structured headlined by the IO Status Block. Alternatively, one could create a transfer vector which did nothing more than set up the  context and pass control to an identified routine via a pointer.

On OpenVMS (all architectures) on, e can do something similar, either hiding the non-ASTPARM parameters, or loading certain parameters from a data structure and then invoking a routine.

It is only a problem in that some languages, e.g.. C can ignore extra parameters, while other languages, e.g., BASIC, actually check for the correct number of parameters. Languages which have type checking on capabilities for call gates add another complexity to this question.

Been there, done that, have draws filled with shirts.

- Bob Gezelter, http://www.rlgsc.com
P.S. Reminds me. One of the tasks on my low priority list is to add my AST seminars to the Presentations section of my www site. Some of the AST-related sessions are already online.



More information about the Info-vax mailing list