From:	MERC::"uunet!WKUVX1.BITNET!MacroMan"  3-APR-1992 06:12:19.95
To:	MACRO32@WKUVX1.BITNET
CC:	
Subj:	RE: System service calls & access modes

Date sent:  2-APR-1992 21:36:22


>Here's a project idea for someone with a little free time.

        Not I...

>I get tired of having to write a seperate routine to run in
>executive or kernel mode just so I can supply an access mode
>parameter to a system routine.
>
>Example:
>
>Main_Routine
>  $CMEXEC Exec_Routine
>..
>End
>
>Exec_Routine
>  $ALLOC ... ACMODE=PSL$C_EXEC
>..
>Ret
>
>It would be a lot easier if the call to the system service detected
>the fact that an access mode was specified and your process had the
>privilege to CMxxx to that mode and then did a CMxxx for you,
>calling itself at the elevated access mode.
>
>A jacket routine in MACRO for each system service that allows
>an access mode to be specified would be pretty nifty.

THE FOLLOWING IS UNTESTED, THROWN TOGETHER IN LESS THAN A MINUTE
JUST AS A DEMONSTRATION AND NOT GUARANTEED TO DO ANYTHING OTHER
THAN MAKE HUNTER LAUGH AT MY CHEAP CODE, SO DON'T LAUGH!
(In other words: Suggestions, Enhancements, and modifications accepted! :)
1.

        .macro  krnl_jacket,    command, ?l1, ?l2
        brw     l2
        pushl   #0
        pushab  l1
        calls   #2,g^sys$cmkrnl
        ret
l1:
        .long   #^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12>
        command
        ret
l2:
        .endm

Usage:
        krnl_jacket     <$alloc ... acmode = psl$c_exec>

2. Duplicate but change krnls to execs
3.
        .macro  jacket, cmnd,?l1,?l2,?l3
        bbc     #prv$v_cmkrnl,ctl$gq_procpriv,l1
        bbc     #prv$v_cmexec,ctl$gq_procpriv,l2
        cmnd
        brw     l3
l1:
        exec_jacket     <cmnd>
        brw     l3
l2:
        krnl_jacket     <cmnd>
l3:
        .endm

Usage for all of the above:
        jacket  <command to be executed in max privd mode>
Example:
        jacket  <$alloc ... acmode=psl$c_exec>

>
>Maybe some of you gurus could comment on why DEC didn't do this
>for us in the first place, or if this isn't such a hot idea after all.
>
>Jonathan Welch  VAX Systems Programmer  Umass/Amherst  JHWELCH@ecs.umass.edu


        Ehud

--
Ehud Gavron        (EG76)
gavron@vesta.sunquest.com
"The world bores you when you're cool."
