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