Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!gatech!bloom-beacon!think!ames!ucbcad!ucbvax!YALE.ARPA!LEICHTER-JERRY
From: LEICHTER-JERRY@YALE.ARPA
Newsgroups: comp.os.vms
Subject: Re: internals
Message-ID: <8707110117.AA27408@ucbvax.Berkeley.EDU>
Date: Fri, 10-Jul-87 21:17:40 EDT
Article-I.D.: ucbvax.8707110117.AA27408
Posted: Fri Jul 10 21:17:40 1987
Date-Received: Sun, 12-Jul-87 13:59:55 EDT
Sender: daemon@ucbvax.BERKELEY.EDU
Reply-To: 
Distribution: world
Organization: The ARPA Internet
Lines: 32


    It's my understanding that ANYONE can issue a CHMK instruction successful-
    ly. (not to be confused with a successful call to the similar system ser-
    vice...) Exactly what is the difference in the two ?  What actually re-
    quires the CHMKNL privilege ?

Yes, anyone can issue a CHMK instruction successfully.  The effect it to
transfer to an entry point whose address is controlled by kernel-mode
software:  CHMK is a "system call".  The CHMK instruction accepts a single
word argument, which is available to the code pointed to by the CHMK vector
entry (the change mode to kernel dispatcher); the argument is used to deter-
mine which particular system call you are making.  If you look at what is "at"
the address that something like SYS$SETEF points to, you'll find (mainly) a
CHMK instruction.  (Sometimes there is a small amount of additional code - for
example, something like SYS$QIOW implements the "W" (wait) in user mode within
the code at SYS$QIOW.)  (That's an over-simplification....)  Some system calls
are actually implemented by EXEC mode code, rather than KERNEL; they use a
CHME instruction.  CLI callbacks use a CHMS (since CLI's run in supervisor
mode).  There's a CHMU instruction, too - programs can set the entry point for
the change mode to user vector if they want (with the $DCLCMH system service).
I don't know of any real uses for this facility for CHMU - CLI's use it to
set up their CHMS dispatchers.

The $CMKRNL SERVICE, on the other hand, is just one of the many possible sys-
tem calls that can be made through CHMK mechanism.  It takes a single argument
that is the address of a procedure entry mask.  If the process has the CMKRNL
privilege, the code for $CMKRNL will call the indicated procedure, leaving the
process in kernel mode.  The $CMEXEC service is similar, but uses CMEXEC
privilege and calls the procedure in EXEC, rather than KERNEL, mode.

							-- Jerry
-------