home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / hp / 9532 < prev    next >
Encoding:
Text File  |  1992-08-21  |  2.0 KB  |  58 lines

  1. Newsgroups: comp.sys.hp
  2. Path: sparky!uunet!paladin.american.edu!darwin.sura.net!mips!sdd.hp.com!hpscdc!cupnews0.cup.hp.com!lamont
  3. From: lamont@cup.hp.com (LaMont Jones)
  4. Subject: Re: PA assmembly to get current PC-offset (CR18)
  5. Sender: news@cupnews0.cup.hp.com
  6. Message-ID: <BtCo4L.H0q@cup.hp.com>
  7. Date: Fri, 21 Aug 1992 20:12:21 GMT
  8. References: <2787@tivoli.UUCP>
  9. Organization: Hewlett-Packard
  10. X-Newsreader: Tin 1.1lj PL5
  11. Lines: 45
  12.  
  13. Stuart Jarriel (stuart@TIVOLI.COM) wrote:
  14. : I am trying to unwind the stack and need the PC-Offset register.
  15. : Of course  MFCTL   18,28  wont do it since you must be at the
  16. : most priviledged level to do a MFCTL for most control registers.
  17.  
  18. Even if you could read CR17 & CR18 (iiaqs & iiaqo), it is not guaranteed
  19. to track PC (The closest I can come to a definition is:   
  20.    The queues generally contain the addresses ... of the two instructions
  21.    in the IA queues at the time of the interruption.
  22.  
  23.    The IIA queues are continually updated whenever the PSW Q-bit is 1 and
  24.    are frozen by an interruption (PSW Q-bit becomes 0).  After such an
  25.    interruption, the IIA queues contain copies of the IA queues.
  26.  
  27.    (PA-RISC 1.1 Architecture and Instruction Set, page 2-14)
  28.  
  29. Note that it does not say where in the pipe the registers are updated...
  30.  
  31. : I have never messed with privledges before, does anyone have an
  32. : example of how to do that?
  33.  
  34. All user code on hp-ux runs at privilege ring 3.  Kernel code runs at
  35. privilege ring 0.
  36.  
  37. : All I really want is PC-offset.  PC-space is much easier (mfsp    sr4,r20).
  38.  
  39. If you are coding this in C, you will be calling an assembly language
  40. routine to get your PC offset.  Since the PC offset of the return point
  41. of the call is stuffed in %rp by the caller, this routine is most easily
  42. coded as:
  43.  
  44.     .code
  45.     .proc
  46.     .callinfo
  47. get_my_pcofs
  48.     bv    0(%rp)
  49.     copy    %rp,%ret0
  50.     .procend
  51.  
  52. If you are coding in assembly, then the 'bl' instruction can be used to
  53. get your PC offset.   'bl .+8,%r19' will place 8 more than the address of
  54. the bl instruction (with a 3 in the low 2 bits) into r19 without disturbing
  55. the flow of the code.
  56.  
  57. lamont
  58.