home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / vms / 14933 < prev    next >
Encoding:
Text File  |  1992-09-11  |  4.1 KB  |  113 lines

  1. Newsgroups: comp.os.vms
  2. Path: sparky!uunet!spool.mu.edu!sdd.hp.com!usc!elroy.jpl.nasa.gov!euclid.JPL.NASA.GOV!pjs
  3. From: pjs@euclid.JPL.NASA.GOV (Peter J. Scott)
  4. Subject: Getting PC of process: will this code work in V5?
  5. Message-ID: <1992Sep11.234602.9702@elroy.jpl.nasa.gov>
  6. Sender: news@elroy.jpl.nasa.gov (Usenet)
  7. Nntp-Posting-Host: euclid.jpl.nasa.gov
  8. Reply-To: pjs@euclid.jpl.nasa.gov
  9. Organization: Jet Propulsion Laboratory, NASA/Caltech
  10. Date: Fri, 11 Sep 1992 23:46:02 GMT
  11. Lines: 100
  12.  
  13. Several years ago I needed a routine that would return the program counter
  14. of a specified process and a kind netter (whose name, I am afraid, I no
  15. longer have) sent me the code below.  I haven't run it since we upgraded
  16. to VMS 5.x, and would like to know whether this code would run okay
  17. without actually having to try it, since it requires CMKRNL and I assign
  18. it a high probability of crashing the system if it fails, something I
  19. can't afford on these systems.  I'd be most grateful if some guru can tell
  20. me whether this code is still good, or how it should be changed.  The rest
  21. of you might get a kick out of the opening comments...
  22.  
  23.       .TITLE  GET_PC  Get any process' PC
  24.       .IDENT  /V04-002/
  25. ;
  26. ;****************************************************************************
  27. ;*                                                                      *
  28. ;*  COPYRIGHT (c) 1985, 1986                                            *
  29. ;*  BY WIGITAL EQUIPMENT CORPORATION, MUNCHER, MINN.                    *
  30. ;*                                                                      *
  31. ;*  THIS SOFTWARE IS NOT LICENSED AND MAY BE ABUSED AND/OR COPIED  WITHOUT  *
  32. ;*  THE   HASSLE  ASSOCIATED  WITH  STUPID  LICENSING  TERMS  AND  WITHOUT  *
  33. ;*  INCLUSION OF ANY COPYRIGHT NOTICE.  THIS SOFTWARE OR  ANY OTHER COPIES  *
  34. ;*  THEREOF MAY BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER  *
  35. ;*  MUNCHER.   SEND  PLENTY  OF  SPRS; FUEL  OIL  IS  DAMNED EXPENSIVE IN  *
  36. ;*  MINNESOTA AND IT GETS REAL COLD.  NO TITLE TO OR OWNERSHIP  OF  THE  *
  37. ;*  SOFTWARE IS HEREBY CLAIMED (QUITE FRANKLY, WE'RE TOO EMBARRASSED).   *
  38. ;*                                                                      *
  39. ;*  THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT  NOTICE  *
  40. ;*  AND  SHOULD  NOT  BE  CONSTRUED  AS  A COMMITMENT BY WIGITAL EQUIPMENT  *
  41. ;*  CORPORATION.                                                        *
  42. ;*                                                                      *
  43. ;*  WIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF  ITS  *
  44. ;*  SOFTWARE ON EQUIPMENT WHICH IS SUPPLIED BY WIGITAL.                         
  45.         *
  46. ;*                                                                      *
  47. ;****************************************************************************
  48. ;
  49.       .LIBRARY              /SYS$LIBRARY:LIB/
  50.       $PCBDEF
  51.       $PHDDEF
  52.       $SSDEF
  53.       .DEFAULT              DISPLACEMENT,WORD
  54.       .ENABLE       SUPPRESSION
  55.  
  56.       .PAGE
  57.       .TITLE  GET_PC
  58. ;
  59. ; Functional description:
  60. ;     This service returns the PC of any process the
  61. ;     user is entitled to control.
  62. ;
  63. ; Calling sequence:
  64. ;     CALLS/CALLG
  65. ;
  66. ; Input Parameters:
  67. ;     (AP)    3
  68. ;     4(AP)   Address of process identification
  69. ;     8(AP)   Address of descriptor of process name
  70. ;
  71. ; Output Parameters:
  72. ;     @4(AP)  Process identification
  73. ;     @12(AP) Address of longword to return new name
  74. ;
  75. ;
  76.     ;Make sure we are all in one page or fault will crash machine!
  77.       .PSECT  CIT_CODE,PAGE,NOWRT,EXE,PIC,SHR
  78.  
  79.       .ENTRY  GET_PC,^M<>
  80.       PUSHAL  (AP)
  81.       PUSHAW  B^GET_PC_KERNEL
  82.       CALLS   #2,G^SYS$CMKRNL
  83.       RET
  84.  
  85.       .ENTRY  GET_PC_KERNEL,^M<R2,R3,R4>
  86.  
  87.       IFNOWRT #4,@12(AP),3$
  88.  
  89.       JSB     G^EXE$NAMPID
  90.       BLBC    R0,2$
  91.  
  92.       BBC     #PCB$V_PHDRES,B^PCB$L_STS(R4),1$
  93.       MOVL    B^PCB$L_PHD(R4),R1
  94.       MOVL    W^PHD$L_PC(R1),R0
  95.       SETIPL  #0
  96.       MOVL    R0,@12(AP)
  97.       MOVL    #1,R0
  98.       RET
  99.  
  100. 1$:   MOVL    #SS$_SUSPENDED,R0
  101. 2$:   SETIPL  #0
  102.       RET
  103.  
  104. 3$:   MOVL    #SS$_ACCVIO,R0
  105.       RET
  106.       .END
  107.  
  108. -- 
  109. This is news.  This is your       |    Peter Scott, NASA/JPL/Caltech
  110. brain on news.  Any questions?    |    (pjs@euclid.jpl.nasa.gov)
  111.  
  112.  
  113.