home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / vms / 17955 < prev    next >
Encoding:
Internet Message Format  |  1992-11-14  |  10.3 KB

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!asuvax!ncar!noao!arizona!sunquest!spades.aces.com!gavron
  2. From: gavron@spades.aces.com (Ehud Gavron 602-570-2000 x. 2546)
  3. Newsgroups: comp.os.vms
  4. Subject: Re: VMSMAIL: %MAIL-E-NOTISAM (file organization changed)
  5. Message-ID: <13NOV199210441541@spades.aces.com>
  6. Date: 13 Nov 92 17:44:00 GMT
  7. References: <1992Nov3.110813.17227@dxcern.cern.ch> <1d9islINNsqf@gap.caltech.edu> <1992Nov12.200152.11582@dxcern.cern.ch>
  8. Sender: news@cs.arizona.edu
  9. Reply-To: gavron@ACES.COM
  10. Organization: ACES Consulting Inc.
  11. Lines: 329
  12. News-Software: VAX/VMS VNEWS 1.4-b1
  13.  
  14. In article <1992Nov12.200152.11582@dxcern.cern.ch>, aimar@dxbt00.cern.ch 
  15. (Alberto Aimar SL/BT tel 2564) babbles...
  16.  
  17. #But I also got a very unpolite answer (the only one) who was posted by
  18. #carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick) to whom I explain how he
  19. #could have used his spare time in better ways then posting useless insults.
  20.  
  21. Is that right?  Can you believe it?  Carl sent out USELESS insults?  I
  22. am sorry!  Really!  The thought that he would send out USELESS insults
  23. is horrifying.  Carl, did you really do this?
  24.  
  25. Listen you no good moron mail-stomping whining laut of a yoyo - Carl
  26. knows his stuff.  If he (quite correctly) took the time to point out
  27. WHERE your head is up your ASS then perhaps you should take his
  28. advice and PULL IT OUT instead of whining about Carl being a bad boy.
  29.  
  30. #As most of you will not care about Carl's problems,
  31.  
  32. Carl isn't the one who posted the stupid problem - you were.  Next time
  33. don't scrozzle your mail file and try and blame Carl for your inadequacies.
  34. When he points out to you that you include no information, bow respectfully
  35. and say "thank you", don't be a smart ass, because since you aren't smart,
  36. you just end up as an ass.
  37.  
  38.  
  39. #Sincerely Alberto Aimar.
  40. #        ``Carl, my dear, why dont you go to see a good doctor ?''
  41.  
  42. Alberto.  My dear.  Why don't you pick on someone your own size.  Pee Wee.
  43.  
  44. #Alberto Aimar.                "Who Wills, Can
  45. #aimar@vxcrna.cern.ch           Who Tries, Does
  46. #CERN Geneva (CH)               Who Loves, Lives" (Anne McCaffery)
  47.  
  48. It's sad when the rifraff come out and play.  Still it happens every
  49. September. 
  50.  
  51. Ehud
  52.  
  53. --
  54. Ehud Gavron        (EG76)     
  55. gavron@aces.com
  56. I liked it so much I bought the company.
  57.  
  58. Obligatory technical info:
  59.  
  60.     .TITLE    CHECK_EXE$GRANT_LICENSE    List all license checks on a node
  61.     .IDENT    /V1.0.0-13Nov92/
  62. ;++
  63. ;
  64. ; CHECK_EXE$GRANT_LICENSE    13-Nov-1992            Ehud Gavron
  65. ;
  66. ; For those times you want to know what licenses are seeking validation,
  67. ; this image patches the executive to notify you about license checks.
  68. ;
  69. ; Although no merchantability is expressed or implied, this
  70. ; code was developed for and will work under V5.4-2.
  71. ;
  72. ;       Ehud Gavron             gavron@Spades.ACES.COM
  73. ;
  74. ;--
  75. ; V1.0.0        Created because I'm not getting enough interesting
  76. ;               kernel-coding to do in my regular job.
  77. ;
  78. ;
  79. ; Linking modifications:
  80. ;
  81.             .link    "sys$system:sys.stb"/selective_search
  82. ;
  83. ; Definitions:
  84. ;
  85. iif ndf $opdef,    .library "sys$library:lib.mlb"
  86. iif ndf op$_jmp,    $opdef
  87. iif ndf prt$c_urkw,    $prtdef
  88. iif ndf pte$v_prot,    $ptedef
  89. iif ndf ss$_normal,    $ssdef
  90.  
  91. ;
  92. ; Offsets I stole from the VAX Architecture manual which indicate the
  93. ; location in the SCB of the pointers to the change mode handlers:
  94. ;
  95. SCB_L_CMKRNL    =    ^X40
  96. SCB_L_CMEXEC    =    ^X44
  97.  
  98. ;
  99. ; Location of vector symbol and addresses:
  100. ;
  101. fv_symbol:    .blkl    1    ; The global symbol to find the code for
  102. fv_vector:    .blkl    1    ; The address of the code
  103. ;
  104. ; Argument list to pass it to FIND_VECTOR:
  105. ;
  106. fv_arglst:    .long    2
  107.         .address fv_symbol
  108.         .address fv_vector
  109. ;
  110. ; Macros:
  111. ;
  112.     .macro    cmd_store    cmd,cmdargs    ; Store a command as a string
  113. 'cmd'_inst: 'cmd' 'cmdargs'            ; Descriptor.  Eventually this
  114. 'cmd'_len = . - 'cmd'_inst            ; will lead to a generic patch-
  115. 'cmd'_desc:    .long    'cmd'_len        ; in-memory routine.
  116.         .address 'cmd'_inst
  117.     .endm
  118.  
  119.     .macro    FIND_AND_DESTROY symb        ; A temporary macro to avoid
  120.     movl    #symb,fv_symbol            ; Having repetitious-looking
  121.     $cmkrnl_s    routin=find_vector,-    ; source-code.  This one will
  122.             arglst=fv_arglst    ; find a symbol, and call the
  123.     $cmkrnl_s    routin=fixup_k,-    ; fixup routine.
  124.             arglst=fv_arglst
  125.     .endm
  126.  
  127. ;
  128. ; Start of user-mode code:
  129. ;
  130.     .Entry    Fixup,^m<>            
  131.     find_and_destroy    exe$grant_license    ; Go patch it!
  132.     ret
  133. ;
  134. ; Start of kernel-mode code:
  135. ;
  136.     .entry    FIND_VECTOR,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>
  137. ;
  138. ; Find out which system service or jump vector it is today...
  139. ;
  140.     movl    @4(ap),r7        ; Address of vector requested
  141.     cmpw    (r7),#op$_jmp!<^x9f00>    ; Check for JMP @#
  142.     beql    10$            ; It is, go use it
  143.     addl    #2,r7            ; Move past the entry mask
  144.     cmpw    (r7),#op$_jmp!<^x9f00>    ; Is it a JMP @#
  145.     beql    10$            ; Yup, go deal with it
  146.     movl    #SCB_l_cmkrnl,r10    ; Prepare for it being a CHMK
  147.     cmpb    (r7),#op$_chmk        ; Is it a CHMK #n
  148.     beql    20$            ; Yup, go deal with it
  149.     movl    #SCB_l_cmexec,r10    ; Prepare for it being a CHME
  150.     cmpb    (r7),#op$_chme        ; Is it a CHME #n
  151.     beql    20$            ; Yup, go deal with it
  152.     movl    #ss$_unsupported,-    ; Eeek, don't know what it is...
  153.         r0            ; So tell user it's unsupported
  154.     ret                ; and go back to user mode!
  155.  
  156. ;
  157. ; So now we extract the address from the JMP instruction:
  158. ;
  159. 10$:
  160.     addl2    #2,r7            ; Get nn from JMP @#nn
  161.     movl    (r7),@8(ap)
  162.     movl    r7,@4(ap)
  163.     movl    #ss$_normal,r0
  164.     ret
  165. ;
  166. ; So now we get the number of the exception...
  167. ;
  168. 20$:
  169.     addl2    #2,r7            ; Get address of #nn from CHMx #nn
  170.     movzbl    (r7),r8            ; Get nn into R8
  171. ;
  172. ; So now we find the dispatcher address
  173. ;
  174.     movl    @#exe$gl_scb,r1        ; Get address of System Control Block
  175.     addl2    r10,r1            ; Get address of correct dispatcher
  176.     movl    (r1),r1            ; Get address of exe$cmodxxxx where
  177.                     ; xxxx is either krnl or exec
  178. ;
  179. ; We look in its code for the dispatch vector table
  180. ;
  181.     movab    movaq_inst,r2        ; Address of our MOVAQ instruction    
  182.     movzwl    (r2),r5
  183.     addl3    #^xff,r1,r3        ; Address past MOVAQ fer shure
  184. 30$:
  185.     movzwl    (r1),r6
  186.     cmpw    r6,r5            ; Have we found a MOVAQ?
  187.     beql    40$            ; Yup!
  188.     aobleq    r3,r1,30$
  189.     movl    #ss$_nodata,r0        ; Whoops, couldn't find it...
  190.     ret                ; So go back to user mode... sigh
  191.  
  192. ;
  193. ; Ok, here R1 points to the start of a MOVAQ instruction that looks like:
  194. ;     MOVAQ CMOD$AR_mode_DISPATCH_VECTOR[R1],R1
  195. ; which translates to bytes:    51hhllCF417E with hhll being the offset
  196. ; from the last byte (51).  We first save this current R1
  197. ;
  198. 40$:
  199.     movl    r1,r9            ; Address of MOVAQ
  200.     movl    r1,r7            ; Saved
  201. ;
  202. ; Then we find the offset
  203. ;
  204.     addl2    #3,r9            ; Address of hhll (word)
  205.     movzwl    (r9),r3            ; R3 = offset
  206. ;
  207. ; Then we add get the address of the end of the instruction
  208. ;
  209.     addl2    #5,r7            ; Address of last byte of instruction
  210. ;
  211. ; Then we add the offset
  212. ;
  213.     addl2    r3,r7            ; R7 = CMOD$AR_mode_DISPATCH_VECTOR
  214. ;
  215. ; Then we take our CHMn code and multiply by 8 (quadword vectors) and add
  216. ;
  217.     ashl    #3,r8,r6        ; Vector offset
  218.     addl2    r6,r7            ; Our vector
  219.     addl2    #4,r7            ; The address [2nd longword of vector]
  220.     movl    (r7),@8(ap)        ; Return this address
  221.     movl    r7,@4(ap)        ; Return address of address
  222.     movl    #ss$_normal,r0
  223.     ret
  224.  
  225.  
  226.     .entry FIXUP_K,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>
  227. ;++
  228. ; Make EXE$SETPRV ignore a particular username
  229. ;--
  230. ;
  231. ; Allocate a buffer in system space (nonpaged pool) to hold
  232. ; all the code to do this stuff...
  233. ;
  234.     movl    #code_len,r1
  235.     jsb    g^exe$alononpaged
  236.     blbs    r0,10$
  237.     ret
  238. ;
  239. ; Copy the code into the pool.
  240. ;
  241. 10$:    movl    r2,r6            ; Save pointer to new npagedyn
  242.     movc3    #code_len,-        ; Copy code into npagedyn
  243.         w^code,(r6)
  244. ;
  245. ; First we prepare the JMP instruction to stick in the front of the old
  246. ; EXE$GRANT_LICENSE.  We do this because it can be JSB'd to from Kernel
  247. ; mode.  If that occurs then just revectoring the CHMK vector doesn't
  248. ; help...
  249. ;
  250. ; Take the second jump at the end of the code and make it point to here...
  251. ;
  252.     addl3    #<jump2-code+2>,r6,r2
  253.     movl    r6,(r2)
  254. ;
  255. ; Now we change the jump instruction at the end to point to the real
  256. ; exe$setprv plus a couple of instructions.  Then we'll overwrite the
  257. ; first few instructions with the jump2 we prepared.  Finally at the
  258. ; end of our code segment are the instructions (from the listing) that
  259. ; we overwrote...
  260. ;
  261.     movl    @4(ap),r2        ; Address of entry point to exe$setprv
  262.     addl3    #<jump-code+2>,r6,r7    ; Address of jump data
  263.     addl3    (r2),#^x07,r3        ; R3 --> exe$grant_license+9(-2)
  264.     movl    r3,(r7)            ; Make jump go to exe$grant_license+9
  265.     movl    r2,r7            ; Save pointer
  266.     movl    (r2),r8            ; R8 --> exe$setprv
  267.     movl    #prt$c_urkw,r9            ; Set for URKW
  268.     lock    lockname=MMG,-        ; Raise IPL, acquire spinlock
  269.         lockipl=#IPL$_MMG,-
  270.         preserve=NO
  271.     jsb    g^mmg$svaptechk        ; Get SVAPTE in R3
  272.     extzv    #pte$v_prot,#pte$s_prot,(r3),r10
  273.     insv     r9,#pte$v_prot,#pte$s_prot,(r3)
  274.     invalidate_tb
  275.     movl    r8,r2
  276.     jsb    g^mmg$svaptechk
  277.     extzv    #pte$v_prot,#pte$s_prot,(r3),r10
  278.     insv     r9,#pte$v_prot,#pte$s_prot,(r3)
  279.     invalidate_tb             ; Translation Buffer Invalidate All
  280.     movl    r6,(r7)            ; Update vector
  281.     movc3    #jump_len,-
  282.         <jump2-code>(r6),(r8)    ; Put the second jump in...
  283.  
  284.     unlock    lockname=MMG,-        ; Release lock
  285.         newipl=#0
  286.     
  287.     movl    #ss$_normal,r0
  288.     ret
  289.  
  290.  
  291. ;
  292. ; The following code will be run each time EXE$GRANT_LICENSE is invoked.  It
  293. ; will spit out the name of the license on the console.
  294. ;
  295. ;
  296. code:
  297.     pushr    #^m<r0,r1,r2,r3,r4,r5,r6,r7,r8,r9>
  298. IIF DF XDELTA, JSB G^INI$BRK
  299.     movab    flag,r2        ; Are we being quiet
  300.     tstl    (r2)
  301.     beql    out        ; Yup, don't do anything
  302.     movab    stringlen,r7    ; r7 --> string length byte
  303.     movl    04(ap),r0    ; r0 --> string descriptor
  304.     movzbl    (r0),(r7)    ; string length byte set
  305.     movzbl    (r0),r8        ; r8 = length
  306.     movl    04(r0),r9    ; r9 --> string address
  307.     movab    stringbuf,r7    ; r7 --> string itself
  308.     movc3    r8,(r9),(r7)    ; copy string
  309.     find_cpu_data r6    ; r6 --> cpu database
  310.     movab    stringlen,r1    ; primary
  311.     movab    string2,r2    ; secondary
  312.     jsb    g^smp$write_opa0
  313. out:
  314.     popr    #^m<r0,r1,r2,r3,r4,r5,r6,r7,r8,r9>
  315.  
  316. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  317. ;EXE$GRANT_LICENSE+00002:  MOVAL   @#CTL$GL_KRPFL,R0
  318. ;EXE$GRANT_LICENSE+00009:  REMQUE  @04(R0),R7
  319. ;EXE$GRANT_LICENSE+0000D:  BVS     SYSLICENSE+00028
  320. ;EXE$GRANT_LICENSE+0000F:  MOVC5   #00,(R7),#00,#0200,(R7)
  321. ;
  322.     moval    @#ctl$gl_krpfl,r0
  323. ;;    remque    @04(r0),r7
  324. ;
  325. ; End of Digital code
  326. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  327.  
  328. jump:                        ; This code will jump back in
  329.     jmp    @#00000000
  330. jump_len = . - jump
  331. jump2:                        ; This jump will point to the
  332.     jmp    @#00000000            ; start of our code...
  333. Data_area:
  334. flag:    .long 1                    ; Quiet flag, 1 = noisy
  335. stringlen:    .blkb    1            ; Length of string
  336. stringbuf:    .blkb    256            ; String
  337. string2:    .ascic <013><010>
  338. code_len = . - code
  339.         cmd_store       movaq   <w^10[r1],r1>
  340.     .end     fixup
  341.  
  342.