registers.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. ================================
  2. Register Usage for Linux/PA-RISC
  3. ================================
  4. [ an asterisk is used for planned usage which is currently unimplemented ]
  5. General Registers as specified by ABI
  6. =====================================
  7. Control Registers
  8. -----------------
  9. =============================== ===============================================
  10. CR 0 (Recovery Counter) used for ptrace
  11. CR 1-CR 7(undefined) unused
  12. CR 8 (Protection ID) per-process value*
  13. CR 9, 12, 13 (PIDS) unused
  14. CR10 (CCR) lazy FPU saving*
  15. CR11 as specified by ABI (SAR)
  16. CR14 (interruption vector) initialized to fault_vector
  17. CR15 (EIEM) initialized to all ones*
  18. CR16 (Interval Timer) read for cycle count/write starts Interval Tmr
  19. CR17-CR22 interruption parameters
  20. CR19 Interrupt Instruction Register
  21. CR20 Interrupt Space Register
  22. CR21 Interrupt Offset Register
  23. CR22 Interrupt PSW
  24. CR23 (EIRR) read for pending interrupts/write clears bits
  25. CR24 (TR 0) Kernel Space Page Directory Pointer
  26. CR25 (TR 1) User Space Page Directory Pointer
  27. CR26 (TR 2) not used
  28. CR27 (TR 3) Thread descriptor pointer
  29. CR28 (TR 4) not used
  30. CR29 (TR 5) not used
  31. CR30 (TR 6) current / 0
  32. CR31 (TR 7) Temporary register, used in various places
  33. =============================== ===============================================
  34. Space Registers (kernel mode)
  35. -----------------------------
  36. =============================== ===============================================
  37. SR0 temporary space register
  38. SR4-SR7 set to 0
  39. SR1 temporary space register
  40. SR2 kernel should not clobber this
  41. SR3 used for userspace accesses (current process)
  42. =============================== ===============================================
  43. Space Registers (user mode)
  44. ---------------------------
  45. =============================== ===============================================
  46. SR0 temporary space register
  47. SR1 temporary space register
  48. SR2 holds space of linux gateway page
  49. SR3 holds user address space value while in kernel
  50. SR4-SR7 Defines short address space for user/kernel
  51. =============================== ===============================================
  52. Processor Status Word
  53. ---------------------
  54. =============================== ===============================================
  55. W (64-bit addresses) 0
  56. E (Little-endian) 0
  57. S (Secure Interval Timer) 0
  58. T (Taken Branch Trap) 0
  59. H (Higher-privilege trap) 0
  60. L (Lower-privilege trap) 0
  61. N (Nullify next instruction) used by C code
  62. X (Data memory break disable) 0
  63. B (Taken Branch) used by C code
  64. C (code address translation) 1, 0 while executing real-mode code
  65. V (divide step correction) used by C code
  66. M (HPMC mask) 0, 1 while executing HPMC handler*
  67. C/B (carry/borrow bits) used by C code
  68. O (ordered references) 1*
  69. F (performance monitor) 0
  70. R (Recovery Counter trap) 0
  71. Q (collect interruption state) 1 (0 in code directly preceding an rfi)
  72. P (Protection Identifiers) 1*
  73. D (Data address translation) 1, 0 while executing real-mode code
  74. I (external interrupt mask) used by cli()/sti() macros
  75. =============================== ===============================================
  76. "Invisible" Registers
  77. ---------------------
  78. =============================== ===============================================
  79. PSW default W value 0
  80. PSW default E value 0
  81. Shadow Registers used by interruption handler code
  82. TOC enable bit 1
  83. =============================== ===============================================
  84. -------------------------------------------------------------------------
  85. The PA-RISC architecture defines 7 registers as "shadow registers".
  86. Those are used in RETURN FROM INTERRUPTION AND RESTORE instruction to reduce
  87. the state save and restore time by eliminating the need for general register
  88. (GR) saves and restores in interruption handlers.
  89. Shadow registers are the GRs 1, 8, 9, 16, 17, 24, and 25.
  90. -------------------------------------------------------------------------
  91. Register usage notes, originally from John Marvin, with some additional
  92. notes from Randolph Chung.
  93. For the general registers:
  94. r1,r2,r19-r26,r28,r29 & r31 can be used without saving them first. And of
  95. course, you need to save them if you care about them, before calling
  96. another procedure. Some of the above registers do have special meanings
  97. that you should be aware of:
  98. r1:
  99. The addil instruction is hardwired to place its result in r1,
  100. so if you use that instruction be aware of that.
  101. r2:
  102. This is the return pointer. In general you don't want to
  103. use this, since you need the pointer to get back to your
  104. caller. However, it is grouped with this set of registers
  105. since the caller can't rely on the value being the same
  106. when you return, i.e. you can copy r2 to another register
  107. and return through that register after trashing r2, and
  108. that should not cause a problem for the calling routine.
  109. r19-r22:
  110. these are generally regarded as temporary registers.
  111. Note that in 64 bit they are arg7-arg4.
  112. r23-r26:
  113. these are arg3-arg0, i.e. you can use them if you
  114. don't care about the values that were passed in anymore.
  115. r28,r29:
  116. are ret0 and ret1. They are what you pass return values
  117. in. r28 is the primary return. When returning small structures
  118. r29 may also be used to pass data back to the caller.
  119. r30:
  120. stack pointer
  121. r31:
  122. the ble instruction puts the return pointer in here.
  123. r3-r18,r27,r30 need to be saved and restored. r3-r18 are just
  124. general purpose registers. r27 is the data pointer, and is
  125. used to make references to global variables easier. r30 is
  126. the stack pointer.