xref: /OK3568_Linux_fs/kernel/Documentation/parisc/registers.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun================================
2*4882a593SmuzhiyunRegister Usage for Linux/PA-RISC
3*4882a593Smuzhiyun================================
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun[ an asterisk is used for planned usage which is currently unimplemented ]
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunGeneral Registers as specified by ABI
8*4882a593Smuzhiyun=====================================
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunControl Registers
11*4882a593Smuzhiyun-----------------
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun===============================	===============================================
14*4882a593SmuzhiyunCR 0 (Recovery Counter)		used for ptrace
15*4882a593SmuzhiyunCR 1-CR 7(undefined)		unused
16*4882a593SmuzhiyunCR 8 (Protection ID)		per-process value*
17*4882a593SmuzhiyunCR 9, 12, 13 (PIDS)		unused
18*4882a593SmuzhiyunCR10 (CCR)			lazy FPU saving*
19*4882a593SmuzhiyunCR11				as specified by ABI (SAR)
20*4882a593SmuzhiyunCR14 (interruption vector)	initialized to fault_vector
21*4882a593SmuzhiyunCR15 (EIEM)			initialized to all ones*
22*4882a593SmuzhiyunCR16 (Interval Timer)		read for cycle count/write starts Interval Tmr
23*4882a593SmuzhiyunCR17-CR22			interruption parameters
24*4882a593SmuzhiyunCR19				Interrupt Instruction Register
25*4882a593SmuzhiyunCR20				Interrupt Space Register
26*4882a593SmuzhiyunCR21				Interrupt Offset Register
27*4882a593SmuzhiyunCR22				Interrupt PSW
28*4882a593SmuzhiyunCR23 (EIRR)			read for pending interrupts/write clears bits
29*4882a593SmuzhiyunCR24 (TR 0)			Kernel Space Page Directory Pointer
30*4882a593SmuzhiyunCR25 (TR 1)			User   Space Page Directory Pointer
31*4882a593SmuzhiyunCR26 (TR 2)			not used
32*4882a593SmuzhiyunCR27 (TR 3)			Thread descriptor pointer
33*4882a593SmuzhiyunCR28 (TR 4)			not used
34*4882a593SmuzhiyunCR29 (TR 5)			not used
35*4882a593SmuzhiyunCR30 (TR 6)			current / 0
36*4882a593SmuzhiyunCR31 (TR 7)			Temporary register, used in various places
37*4882a593Smuzhiyun===============================	===============================================
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunSpace Registers (kernel mode)
40*4882a593Smuzhiyun-----------------------------
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun===============================	===============================================
43*4882a593SmuzhiyunSR0				temporary space register
44*4882a593SmuzhiyunSR4-SR7 			set to 0
45*4882a593SmuzhiyunSR1				temporary space register
46*4882a593SmuzhiyunSR2				kernel should not clobber this
47*4882a593SmuzhiyunSR3				used for userspace accesses (current process)
48*4882a593Smuzhiyun===============================	===============================================
49*4882a593Smuzhiyun
50*4882a593SmuzhiyunSpace Registers (user mode)
51*4882a593Smuzhiyun---------------------------
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun===============================	===============================================
54*4882a593SmuzhiyunSR0				temporary space register
55*4882a593SmuzhiyunSR1                             temporary space register
56*4882a593SmuzhiyunSR2                             holds space of linux gateway page
57*4882a593SmuzhiyunSR3                             holds user address space value while in kernel
58*4882a593SmuzhiyunSR4-SR7                         Defines short address space for user/kernel
59*4882a593Smuzhiyun===============================	===============================================
60*4882a593Smuzhiyun
61*4882a593Smuzhiyun
62*4882a593SmuzhiyunProcessor Status Word
63*4882a593Smuzhiyun---------------------
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun===============================	===============================================
66*4882a593SmuzhiyunW (64-bit addresses)		0
67*4882a593SmuzhiyunE (Little-endian)		0
68*4882a593SmuzhiyunS (Secure Interval Timer)	0
69*4882a593SmuzhiyunT (Taken Branch Trap)		0
70*4882a593SmuzhiyunH (Higher-privilege trap)	0
71*4882a593SmuzhiyunL (Lower-privilege trap)	0
72*4882a593SmuzhiyunN (Nullify next instruction)	used by C code
73*4882a593SmuzhiyunX (Data memory break disable)	0
74*4882a593SmuzhiyunB (Taken Branch)		used by C code
75*4882a593SmuzhiyunC (code address translation)	1, 0 while executing real-mode code
76*4882a593SmuzhiyunV (divide step correction)	used by C code
77*4882a593SmuzhiyunM (HPMC mask)			0, 1 while executing HPMC handler*
78*4882a593SmuzhiyunC/B (carry/borrow bits)		used by C code
79*4882a593SmuzhiyunO (ordered references)		1*
80*4882a593SmuzhiyunF (performance monitor)		0
81*4882a593SmuzhiyunR (Recovery Counter trap)	0
82*4882a593SmuzhiyunQ (collect interruption state)	1 (0 in code directly preceding an rfi)
83*4882a593SmuzhiyunP (Protection Identifiers)	1*
84*4882a593SmuzhiyunD (Data address translation)	1, 0 while executing real-mode code
85*4882a593SmuzhiyunI (external interrupt mask)	used by cli()/sti() macros
86*4882a593Smuzhiyun===============================	===============================================
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun"Invisible" Registers
89*4882a593Smuzhiyun---------------------
90*4882a593Smuzhiyun
91*4882a593Smuzhiyun===============================	===============================================
92*4882a593SmuzhiyunPSW default W value		0
93*4882a593SmuzhiyunPSW default E value		0
94*4882a593SmuzhiyunShadow Registers		used by interruption handler code
95*4882a593SmuzhiyunTOC enable bit			1
96*4882a593Smuzhiyun===============================	===============================================
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun-------------------------------------------------------------------------
99*4882a593Smuzhiyun
100*4882a593SmuzhiyunThe PA-RISC architecture defines 7 registers as "shadow registers".
101*4882a593SmuzhiyunThose are used in RETURN FROM INTERRUPTION AND RESTORE instruction to reduce
102*4882a593Smuzhiyunthe state save and restore time by eliminating the need for general register
103*4882a593Smuzhiyun(GR) saves and restores in interruption handlers.
104*4882a593SmuzhiyunShadow registers are the GRs 1, 8, 9, 16, 17, 24, and 25.
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun-------------------------------------------------------------------------
107*4882a593Smuzhiyun
108*4882a593SmuzhiyunRegister usage notes, originally from John Marvin, with some additional
109*4882a593Smuzhiyunnotes from Randolph Chung.
110*4882a593Smuzhiyun
111*4882a593SmuzhiyunFor the general registers:
112*4882a593Smuzhiyun
113*4882a593Smuzhiyunr1,r2,r19-r26,r28,r29 & r31 can be used without saving them first. And of
114*4882a593Smuzhiyuncourse, you need to save them if you care about them, before calling
115*4882a593Smuzhiyunanother procedure. Some of the above registers do have special meanings
116*4882a593Smuzhiyunthat you should be aware of:
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun    r1:
119*4882a593Smuzhiyun	The addil instruction is hardwired to place its result in r1,
120*4882a593Smuzhiyun	so if you use that instruction be aware of that.
121*4882a593Smuzhiyun
122*4882a593Smuzhiyun    r2:
123*4882a593Smuzhiyun	This is the return pointer. In general you don't want to
124*4882a593Smuzhiyun	use this, since you need the pointer to get back to your
125*4882a593Smuzhiyun	caller. However, it is grouped with this set of registers
126*4882a593Smuzhiyun	since the caller can't rely on the value being the same
127*4882a593Smuzhiyun	when you return, i.e. you can copy r2 to another register
128*4882a593Smuzhiyun	and return through that register after trashing r2, and
129*4882a593Smuzhiyun	that should not cause a problem for the calling routine.
130*4882a593Smuzhiyun
131*4882a593Smuzhiyun    r19-r22:
132*4882a593Smuzhiyun	these are generally regarded as temporary registers.
133*4882a593Smuzhiyun	Note that in 64 bit they are arg7-arg4.
134*4882a593Smuzhiyun
135*4882a593Smuzhiyun    r23-r26:
136*4882a593Smuzhiyun	these are arg3-arg0, i.e. you can use them if you
137*4882a593Smuzhiyun	don't care about the values that were passed in anymore.
138*4882a593Smuzhiyun
139*4882a593Smuzhiyun    r28,r29:
140*4882a593Smuzhiyun	are ret0 and ret1. They are what you pass return values
141*4882a593Smuzhiyun	in. r28 is the primary return. When returning small structures
142*4882a593Smuzhiyun	r29 may also be used to pass data back to the caller.
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun    r30:
145*4882a593Smuzhiyun	stack pointer
146*4882a593Smuzhiyun
147*4882a593Smuzhiyun    r31:
148*4882a593Smuzhiyun	the ble instruction puts the return pointer in here.
149*4882a593Smuzhiyun
150*4882a593Smuzhiyun
151*4882a593Smuzhiyun    r3-r18,r27,r30 need to be saved and restored. r3-r18 are just
152*4882a593Smuzhiyun    general purpose registers. r27 is the data pointer, and is
153*4882a593Smuzhiyun    used to make references to global variables easier. r30 is
154*4882a593Smuzhiyun    the stack pointer.
155