Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!ucbvax!LBL-CSA2.ARPA!adelman From: adelman@LBL-CSA2.ARPA (Kenneth Adelman) Newsgroups: comp.os.vms Subject: Re: User Supplied System Services Message-ID: <871007055406.0gf@Lbl-Csa2.Arpa> Date: Wed, 7-Oct-87 08:54:06 EDT Article-I.D.: Lbl-Csa2.871007055406.0gf Posted: Wed Oct 7 08:54:06 1987 Date-Received: Sat, 10-Oct-87 09:41:06 EDT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Adelman@Lbl-Csa2.Arpa (Kenneth Adelman) Organization: The ARPA Internet Lines: 41 > The idea was that once in kernel mode the CMKRNL priv would be given > (temporarily) since kernel code has SETPRV by default and then the QIO > would be issued. However, a crash would result apparantly in ASTDEL > after the QIO. > The question is...Is it possible to issue a QIO after having been > dispatched through a CHMK inst to the user routine (using the negative > code value). I'm sure that the dispatching was occurring correctly. > I seem to vaguely remember that it is not possible to call QIO from within > kernel mode. Anybody remember for sure? and if not what is the problem? There are all sorts of bad implications for having a kernel mode system service which in turn calls SYS$QIO with the users arguments. For one, SYS$QIO will be probing its arguments against access in KERNEL mode, not against access in USER mode, because SYS$QIO goes through the CHMK dispatcher a second time. The easier way to do it is to call the EXE$QIO entry point that the VMS CHMK dispatcher calls in kernel mode after YOU call SYS$QIO. Below is an example of how to write a user written system service which is a deprivileged $GETJPI call. This is expected to be called via the dispatcher in SYS$EXAMPLES. The argument count must be verified and the argument list probed. .ENTRY CIT_GETJPI,^M ; ; This is the deprivileged $GETJPI. ; MOVL W^PCB$Q_PRIV(R4),R11 ;Save our privileges. BBSS S^#PRV$V_WORLD,W^PCB$Q_PRIV(R4),10$ ; TURN ON WORLD 10$: CALLG (AP),@#EXE$GETJPI ; CALL INTO $GETJPI (NOTE R4=CURPCB) MOVL R11,W^PCB$Q_PRIV(R4) ; RESTORE OLD PRIVILEGES RET Your code will probably look something like this, but will need additional checks that the caller is doing the particular $QIO to the particular device that you intend him to. Kenneth Adelman LBL