From: system@SendSpamHere.ORG Sent: Wednesday, September 22, 1999 7:11 AM To: Info-VAX@Mvb.Saic.Com Subject: Re: Process Permanent Files In article , Jan Vorbrueggen writes: >JF Mezei writes: > >> Someone gave me an example of how to get something to execute in supervisor >> more. Is declaring an AST, while in exec mode, to execute in supervisor mode >> really the only way ? > >No. The way of the Real Programmer is build a stack frame, complete with PSW >fields for the current and previous modes set to the desired values, and the >saved PC and SP as well, and execute a REI instruction. Implementation, >especially on Alpha, is left as an exercise to the reader. Suggested Fairly simple on Alpha. Call $ADJSTK to make space on the SUPERVISOR mode stack. Copy the current INTSTK frame to the SUPERVISOR mode stack and modify the saved PS in the frame to reflect the current mode. Now, modify the existing INTSTK PS to reflect the target mode of SUPERVISOR and the INTSTK PC to be the address of a routine which will allow you to inject your SUPERVISOR mode code into the code stream when you REI from the current mode. This injection routine should save off the PV and any registers you'll be mucking with and should or would have to use a mechanism which doesn't rely on the current linkage pointer which would likely be that of the routine which called the $CMxxxx to get you to the elevated access mode. I do this with 2 lines of Alpha machine code. The whole injector can be had in about 50 or so Alpha machine instructions. YMMV depending upon how much of the context (ie. integer and f.p. registers you need to preserve). As you can see, this is a far simpler method than using the $CMEXEC and $DCLAST ... acmode=#PSL$C_SUPER method! ;) -- VAXman- OpenVMS APE certification number: AAA-0001 VAXman@TMESIS.COM