F1142S30%unika2@germany.CSNET (Juergen Renz) (07/02/87)
In addition to the discussion about CMKRNL privilege, CHMK instruction and $CMKRNL system call, I send here a little code extraction done with my disassembler. SYS$CMKRNL:: 7FFEDE90 .WORD ^M<R4> 7FFEDE92 CHMK #000C 7FFEDE96 RET This code shows how the system-call $CMKRNL works. The CHMK instruction is a trap to the change mode handler of the system in KERNEL mode. This handler retrieves the CHMK parameter from the stack and loads register R4 with the address of the current process control block. MOVL SCH$GL_CURPCB,R4 Then it decodes the type of the system call with a CASE instruction. (I skipped that code, because it's not of interest.) In this special case the destination is the following code sequence: EXE$CMKRNL:: 800093FF .WORD ^M<R4> 80009401 MOVPSL R0 80009403 BBS #17,R0,80009417 ! if PSL$V_PRVMOD in ! [ PSL$C_USER, PSL$C_SUPER ] ! then goto 80009417 80009407 CALLG @08(AP),@04(AP) ! call routine with argument list 8000940C BLBC R0,8000941F 8000940F MOVL 0C(FP),FP ! immediate return to user code 80009413 ADDL2 #14,SP 80009416 REI 80009417 BBS #00,@6C(R4),80009407 ! if PRV$V_CMKRNL in PROCPRIV ! then goto 80009407 8000941C MOVZWL #24,R0 ! SS$_NOPRIV 8000941F RET ! signal error to CHMK handler This special example shows how user privileges (here: CMKRNL privilege) are checked during system calls. P.S.: Some comments about my disassembler: written in PASCAL the source is about 70 Blocks and over 3000 lines the user interface is very raw (it will be better in future) image symbols are included in the output references to library images are included in the symbol list Only if there enough requests I will send the source to info-vax. Please send questions or proposals directly to: RENZ%unika2@germany.csnet Juergen Renz Universitaet Karlsruhe Falkengarten 7 Institut fuer Informatik IV 7530 Pforzheim West-Germany