Allow the use of R9 and R10 in primops; fixes trac #5423
[ghc.git] / includes / stg / Regs.h
1 /* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 1998-2009
4 *
5 * Registers in the STG machine.
6 *
7 * Do not #include this file directly: #include "Rts.h" instead.
8 *
9 * To understand the structure of the RTS headers, see the wiki:
10 * http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
11 *
12 * ---------------------------------------------------------------------------*/
13
14 #ifndef REGS_H
15 #define REGS_H
16
17 /*
18 * The STG machine has a collection of "registers", each one of which
19 * may or may not correspond to an actual machine register when
20 * running code.
21 *
22 * The register set is backed by a table in memory (struct
23 * StgRegTable). If a particular STG register is not mapped to a
24 * machine register, then the apprpriate slot in this table is used
25 * instead.
26 *
27 * This table is itself pointed to by another register, BaseReg. If
28 * BaseReg is not in a machine register, then the register table is
29 * used from an absolute location (MainCapability).
30 *
31 */
32
33 typedef struct {
34 StgWord stgEagerBlackholeInfo;
35 StgFunPtr stgGCEnter1;
36 StgFunPtr stgGCFun;
37 } StgFunTable;
38
39 /*
40 * Vanilla registers are given this union type, which is purely so
41 * that we can cast the vanilla reg to a variety of types with the
42 * minimum of syntax. eg. R1.w instead of (StgWord)R1.
43 */
44 typedef union {
45 StgWord w;
46 StgAddr a;
47 StgChar c;
48 StgFloat f;
49 StgInt i;
50 StgPtr p;
51 } StgUnion;
52
53 /*
54 * This is the table that holds shadow-locations for all the STG
55 * registers. The shadow locations are used when:
56 *
57 * 1) the particular register isn't mapped to a real machine
58 * register, probably because there's a shortage of real registers.
59 * 2) caller-saves registers are saved across a CCall
60 */
61 typedef struct StgRegTable_ {
62 StgUnion rR1;
63 StgUnion rR2;
64 StgUnion rR3;
65 StgUnion rR4;
66 StgUnion rR5;
67 StgUnion rR6;
68 StgUnion rR7;
69 StgUnion rR8;
70 StgUnion rR9; /* used occasionally by heap/stack checks */
71 StgUnion rR10; /* used occasionally by heap/stack checks */
72 StgFloat rF1;
73 StgFloat rF2;
74 StgFloat rF3;
75 StgFloat rF4;
76 StgDouble rD1;
77 StgDouble rD2;
78 StgWord64 rL1;
79 StgPtr rSp;
80 StgPtr rSpLim;
81 StgPtr rHp;
82 StgPtr rHpLim;
83 struct StgTSO_ * rCurrentTSO;
84 struct nursery_ * rNursery;
85 struct bdescr_ * rCurrentNursery; /* Hp/HpLim point into this block */
86 struct bdescr_ * rCurrentAlloc; /* for allocation using allocate() */
87 StgWord rHpAlloc; /* number of *bytes* being allocated in heap */
88 StgWord rRet; // holds the return code of the thread
89 } StgRegTable;
90
91 #if IN_STG_CODE
92
93 /*
94 * Registers Hp and HpLim are global across the entire system, and are
95 * copied into the RegTable before executing a thread.
96 *
97 * Registers Sp and SpLim are saved in the TSO for the
98 * thread, but are copied into the RegTable before executing a thread.
99 *
100 * All other registers are "general purpose", and are used for passing
101 * arguments to functions, and returning values. The code generator
102 * knows how many of these are in real registers, and avoids
103 * generating code that uses non-real registers. General purpose
104 * registers are never saved when returning to the scheduler, instead
105 * we save whatever is live at the time on the stack, and restore it
106 * later. This should reduce the context switch time, amongst other
107 * things.
108 *
109 * For argument passing, the stack will be used in preference to
110 * pseudo-registers if the architecture has too few general purpose
111 * registers.
112 *
113 * Some special RTS functions like newArray and the Integer primitives
114 * expect their arguments to be in registers R1-Rn, so we use these
115 * (pseudo-)registers in those cases.
116 */
117
118 /*
119 * Locations for saving per-thread registers.
120 */
121
122 #define SAVE_Sp (CurrentTSO->sp)
123 #define SAVE_SpLim (CurrentTSO->splim)
124
125 #define SAVE_Hp (BaseReg->rHp)
126
127 #define SAVE_CurrentTSO (BaseReg->rCurrentTSO)
128 #define SAVE_CurrentNursery (BaseReg->rCurrentNursery)
129 #define SAVE_HpAlloc (BaseReg->rHpAlloc)
130
131 /* We sometimes need to save registers across a C-call, eg. if they
132 * are clobbered in the standard calling convention. We define the
133 * save locations for all registers in the register table.
134 */
135
136 #define SAVE_R1 (BaseReg->rR1)
137 #define SAVE_R2 (BaseReg->rR2)
138 #define SAVE_R3 (BaseReg->rR3)
139 #define SAVE_R4 (BaseReg->rR4)
140 #define SAVE_R5 (BaseReg->rR5)
141 #define SAVE_R6 (BaseReg->rR6)
142 #define SAVE_R7 (BaseReg->rR7)
143 #define SAVE_R8 (BaseReg->rR8)
144 #define SAVE_R9 (BaseReg->rR9)
145 #define SAVE_R10 (BaseReg->rR10)
146
147 #define SAVE_F1 (BaseReg->rF1)
148 #define SAVE_F2 (BaseReg->rF2)
149 #define SAVE_F3 (BaseReg->rF3)
150 #define SAVE_F4 (BaseReg->rF4)
151
152 #define SAVE_D1 (BaseReg->rD1)
153 #define SAVE_D2 (BaseReg->rD2)
154
155 #define SAVE_L1 (BaseReg->rL1)
156
157 /* -----------------------------------------------------------------------------
158 * Emit the GCC-specific register declarations for each machine
159 * register being used. If any STG register isn't mapped to a machine
160 * register, then map it to an offset from BaseReg.
161 *
162 * First, the general purpose registers. The idea is, if a particular
163 * general-purpose STG register can't be mapped to a real machine
164 * register, it won't be used at all. Instead, we'll use the stack.
165 *
166 * This is an improvement on the way things used to be done, when all
167 * registers were mapped to locations in the register table, and stuff
168 * was being shifted from the stack to the register table and back
169 * again for no good reason (on register-poor architectures).
170 */
171
172 /* define NO_REGS to omit register declarations - used in RTS C code
173 * that needs all the STG definitions but not the global register
174 * settings.
175 */
176 #define GLOBAL_REG_DECL(type,name,reg) register type name REG(reg);
177
178 #if defined(REG_R1) && !defined(NO_GLOBAL_REG_DECLS)
179 GLOBAL_REG_DECL(StgUnion,R1,REG_R1)
180 #else
181 # define R1 (BaseReg->rR1)
182 #endif
183
184 #if defined(REG_R2) && !defined(NO_GLOBAL_REG_DECLS)
185 GLOBAL_REG_DECL(StgUnion,R2,REG_R2)
186 #else
187 # define R2 (BaseReg->rR2)
188 #endif
189
190 #if defined(REG_R3) && !defined(NO_GLOBAL_REG_DECLS)
191 GLOBAL_REG_DECL(StgUnion,R3,REG_R3)
192 #else
193 # define R3 (BaseReg->rR3)
194 #endif
195
196 #if defined(REG_R4) && !defined(NO_GLOBAL_REG_DECLS)
197 GLOBAL_REG_DECL(StgUnion,R4,REG_R4)
198 #else
199 # define R4 (BaseReg->rR4)
200 #endif
201
202 #if defined(REG_R5) && !defined(NO_GLOBAL_REG_DECLS)
203 GLOBAL_REG_DECL(StgUnion,R5,REG_R5)
204 #else
205 # define R5 (BaseReg->rR5)
206 #endif
207
208 #if defined(REG_R6) && !defined(NO_GLOBAL_REG_DECLS)
209 GLOBAL_REG_DECL(StgUnion,R6,REG_R6)
210 #else
211 # define R6 (BaseReg->rR6)
212 #endif
213
214 #if defined(REG_R7) && !defined(NO_GLOBAL_REG_DECLS)
215 GLOBAL_REG_DECL(StgUnion,R7,REG_R7)
216 #else
217 # define R7 (BaseReg->rR7)
218 #endif
219
220 #if defined(REG_R8) && !defined(NO_GLOBAL_REG_DECLS)
221 GLOBAL_REG_DECL(StgUnion,R8,REG_R8)
222 #else
223 # define R8 (BaseReg->rR8)
224 #endif
225
226 #if defined(REG_R9) && !defined(NO_GLOBAL_REG_DECLS)
227 GLOBAL_REG_DECL(StgUnion,R9,REG_R9)
228 #else
229 # define R9 (BaseReg->rR9)
230 #endif
231
232 #if defined(REG_R10) && !defined(NO_GLOBAL_REG_DECLS)
233 GLOBAL_REG_DECL(StgUnion,R10,REG_R10)
234 #else
235 # define R10 (BaseReg->rR10)
236 #endif
237
238 #if defined(REG_F1) && !defined(NO_GLOBAL_REG_DECLS)
239 GLOBAL_REG_DECL(StgFloat,F1,REG_F1)
240 #else
241 #define F1 (BaseReg->rF1)
242 #endif
243
244 #if defined(REG_F2) && !defined(NO_GLOBAL_REG_DECLS)
245 GLOBAL_REG_DECL(StgFloat,F2,REG_F2)
246 #else
247 #define F2 (BaseReg->rF2)
248 #endif
249
250 #if defined(REG_F3) && !defined(NO_GLOBAL_REG_DECLS)
251 GLOBAL_REG_DECL(StgFloat,F3,REG_F3)
252 #else
253 #define F3 (BaseReg->rF3)
254 #endif
255
256 #if defined(REG_F4) && !defined(NO_GLOBAL_REG_DECLS)
257 GLOBAL_REG_DECL(StgFloat,F4,REG_F4)
258 #else
259 #define F4 (BaseReg->rF4)
260 #endif
261
262 #if defined(REG_D1) && !defined(NO_GLOBAL_REG_DECLS)
263 GLOBAL_REG_DECL(StgDouble,D1,REG_D1)
264 #else
265 #define D1 (BaseReg->rD1)
266 #endif
267
268 #if defined(REG_D2) && !defined(NO_GLOBAL_REG_DECLS)
269 GLOBAL_REG_DECL(StgDouble,D2,REG_D2)
270 #else
271 #define D2 (BaseReg->rD2)
272 #endif
273
274 #if defined(REG_L1) && !defined(NO_GLOBAL_REG_DECLS)
275 GLOBAL_REG_DECL(StgWord64,L1,REG_L1)
276 #else
277 #define L1 (BaseReg->rL1)
278 #endif
279
280 /*
281 * If BaseReg isn't mapped to a machine register, just use the global
282 * address of the current register table (CurrentRegTable in
283 * concurrent Haskell, MainRegTable otherwise).
284 */
285
286 /* A capability is a combination of a FunTable and a RegTable. In STG
287 * code, BaseReg normally points to the RegTable portion of this
288 * structure, so that we can index both forwards and backwards to take
289 * advantage of shorter instruction forms on some archs (eg. x86).
290 * This is a cut-down version of the Capability structure; the full
291 * version is defined in Capability.h.
292 */
293 struct PartCapability_ {
294 StgFunTable f;
295 StgRegTable r;
296 };
297
298 /* No such thing as a MainCapability under THREADED_RTS - each thread must have
299 * its own Capability.
300 */
301 #if IN_STG_CODE && !(defined(THREADED_RTS) && !defined(NOSMP))
302 extern W_ MainCapability[];
303 #endif
304
305 /*
306 * Assigning to BaseReg (the ASSIGN_BaseReg macro): this happens on
307 * return from a "safe" foreign call, when the thread might be running
308 * on a new Capability. Obviously if BaseReg is not a register, then
309 * we are restricted to a single Capability (this invariant is enforced
310 * in Capability.c:initCapabilities), and assigning to BaseReg can be omitted.
311 */
312
313 #if defined(REG_Base) && !defined(NO_GLOBAL_REG_DECLS)
314 GLOBAL_REG_DECL(StgRegTable *,BaseReg,REG_Base)
315 #define ASSIGN_BaseReg(e) (BaseReg = (e))
316 #else
317 #if defined(THREADED_RTS) && !defined(NOSMP)
318 #error BaseReg must be in a register for THREADED_RTS
319 #endif
320 #define BaseReg (&((struct PartCapability_ *)MainCapability)->r)
321 #define ASSIGN_BaseReg(e) (e)
322 #endif
323
324 #if defined(REG_Sp) && !defined(NO_GLOBAL_REG_DECLS)
325 GLOBAL_REG_DECL(P_,Sp,REG_Sp)
326 #else
327 #define Sp (BaseReg->rSp)
328 #endif
329
330 #if defined(REG_SpLim) && !defined(NO_GLOBAL_REG_DECLS)
331 GLOBAL_REG_DECL(P_,SpLim,REG_SpLim)
332 #else
333 #define SpLim (BaseReg->rSpLim)
334 #endif
335
336 #if defined(REG_Hp) && !defined(NO_GLOBAL_REG_DECLS)
337 GLOBAL_REG_DECL(P_,Hp,REG_Hp)
338 #else
339 #define Hp (BaseReg->rHp)
340 #endif
341
342 #if defined(REG_HpLim) && !defined(NO_GLOBAL_REG_DECLS)
343 #error HpLim cannot be in a register
344 #else
345 #define HpLim (BaseReg->rHpLim)
346 #endif
347
348 #if defined(REG_CurrentTSO) && !defined(NO_GLOBAL_REG_DECLS)
349 GLOBAL_REG_DECL(struct _StgTSO *,CurrentTSO,REG_CurrentTSO)
350 #else
351 #define CurrentTSO (BaseReg->rCurrentTSO)
352 #endif
353
354 #if defined(REG_CurrentNursery) && !defined(NO_GLOBAL_REG_DECLS)
355 GLOBAL_REG_DECL(bdescr *,CurrentNursery,REG_CurrentNursery)
356 #else
357 #define CurrentNursery (BaseReg->rCurrentNursery)
358 #endif
359
360 #if defined(REG_HpAlloc) && !defined(NO_GLOBAL_REG_DECLS)
361 GLOBAL_REG_DECL(bdescr *,HpAlloc,REG_HpAlloc)
362 #else
363 #define HpAlloc (BaseReg->rHpAlloc)
364 #endif
365
366 /* -----------------------------------------------------------------------------
367 Get absolute function pointers from the register table, to save
368 code space. On x86,
369
370 jmp *-12(%ebx)
371
372 is shorter than
373
374 jmp absolute_address
375
376 as long as the offset is within the range of a signed byte
377 (-128..+127). So we pick some common absolute_addresses and put
378 them in the register table. As a bonus, linking time should also
379 be reduced.
380
381 Other possible candidates in order of importance:
382
383 stg_upd_frame_info
384 stg_CAF_BLACKHOLE_info
385 stg_IND_STATIC_info
386
387 anything else probably isn't worth the effort.
388
389 -------------------------------------------------------------------------- */
390
391
392 #define FunReg ((StgFunTable *)((void *)BaseReg - STG_FIELD_OFFSET(struct PartCapability_, r)))
393
394 #define stg_EAGER_BLACKHOLE_info (FunReg->stgEagerBlackholeInfo)
395 #define stg_gc_enter_1 (FunReg->stgGCEnter1)
396 #define stg_gc_fun (FunReg->stgGCFun)
397
398 /* -----------------------------------------------------------------------------
399 For any registers which are denoted "caller-saves" by the C calling
400 convention, we have to emit code to save and restore them across C
401 calls.
402 -------------------------------------------------------------------------- */
403
404 #ifdef CALLER_SAVES_R1
405 #define CALLER_SAVE_R1 SAVE_R1 = R1;
406 #define CALLER_RESTORE_R1 R1 = SAVE_R1;
407 #else
408 #define CALLER_SAVE_R1 /* nothing */
409 #define CALLER_RESTORE_R1 /* nothing */
410 #endif
411
412 #ifdef CALLER_SAVES_R2
413 #define CALLER_SAVE_R2 SAVE_R2 = R2;
414 #define CALLER_RESTORE_R2 R2 = SAVE_R2;
415 #else
416 #define CALLER_SAVE_R2 /* nothing */
417 #define CALLER_RESTORE_R2 /* nothing */
418 #endif
419
420 #ifdef CALLER_SAVES_R3
421 #define CALLER_SAVE_R3 SAVE_R3 = R3;
422 #define CALLER_RESTORE_R3 R3 = SAVE_R3;
423 #else
424 #define CALLER_SAVE_R3 /* nothing */
425 #define CALLER_RESTORE_R3 /* nothing */
426 #endif
427
428 #ifdef CALLER_SAVES_R4
429 #define CALLER_SAVE_R4 SAVE_R4 = R4;
430 #define CALLER_RESTORE_R4 R4 = SAVE_R4;
431 #else
432 #define CALLER_SAVE_R4 /* nothing */
433 #define CALLER_RESTORE_R4 /* nothing */
434 #endif
435
436 #ifdef CALLER_SAVES_R5
437 #define CALLER_SAVE_R5 SAVE_R5 = R5;
438 #define CALLER_RESTORE_R5 R5 = SAVE_R5;
439 #else
440 #define CALLER_SAVE_R5 /* nothing */
441 #define CALLER_RESTORE_R5 /* nothing */
442 #endif
443
444 #ifdef CALLER_SAVES_R6
445 #define CALLER_SAVE_R6 SAVE_R6 = R6;
446 #define CALLER_RESTORE_R6 R6 = SAVE_R6;
447 #else
448 #define CALLER_SAVE_R6 /* nothing */
449 #define CALLER_RESTORE_R6 /* nothing */
450 #endif
451
452 #ifdef CALLER_SAVES_R7
453 #define CALLER_SAVE_R7 SAVE_R7 = R7;
454 #define CALLER_RESTORE_R7 R7 = SAVE_R7;
455 #else
456 #define CALLER_SAVE_R7 /* nothing */
457 #define CALLER_RESTORE_R7 /* nothing */
458 #endif
459
460 #ifdef CALLER_SAVES_R8
461 #define CALLER_SAVE_R8 SAVE_R8 = R8;
462 #define CALLER_RESTORE_R8 R8 = SAVE_R8;
463 #else
464 #define CALLER_SAVE_R8 /* nothing */
465 #define CALLER_RESTORE_R8 /* nothing */
466 #endif
467
468 #ifdef CALLER_SAVES_R9
469 #define CALLER_SAVE_R9 SAVE_R9 = R9;
470 #define CALLER_RESTORE_R9 R9 = SAVE_R9;
471 #else
472 #define CALLER_SAVE_R9 /* nothing */
473 #define CALLER_RESTORE_R9 /* nothing */
474 #endif
475
476 #ifdef CALLER_SAVES_R10
477 #define CALLER_SAVE_R10 SAVE_R10 = R10;
478 #define CALLER_RESTORE_R10 R10 = SAVE_R10;
479 #else
480 #define CALLER_SAVE_R10 /* nothing */
481 #define CALLER_RESTORE_R10 /* nothing */
482 #endif
483
484 #ifdef CALLER_SAVES_F1
485 #define CALLER_SAVE_F1 SAVE_F1 = F1;
486 #define CALLER_RESTORE_F1 F1 = SAVE_F1;
487 #else
488 #define CALLER_SAVE_F1 /* nothing */
489 #define CALLER_RESTORE_F1 /* nothing */
490 #endif
491
492 #ifdef CALLER_SAVES_F2
493 #define CALLER_SAVE_F2 SAVE_F2 = F2;
494 #define CALLER_RESTORE_F2 F2 = SAVE_F2;
495 #else
496 #define CALLER_SAVE_F2 /* nothing */
497 #define CALLER_RESTORE_F2 /* nothing */
498 #endif
499
500 #ifdef CALLER_SAVES_F3
501 #define CALLER_SAVE_F3 SAVE_F3 = F3;
502 #define CALLER_RESTORE_F3 F3 = SAVE_F3;
503 #else
504 #define CALLER_SAVE_F3 /* nothing */
505 #define CALLER_RESTORE_F3 /* nothing */
506 #endif
507
508 #ifdef CALLER_SAVES_F4
509 #define CALLER_SAVE_F4 SAVE_F4 = F4;
510 #define CALLER_RESTORE_F4 F4 = SAVE_F4;
511 #else
512 #define CALLER_SAVE_F4 /* nothing */
513 #define CALLER_RESTORE_F4 /* nothing */
514 #endif
515
516 #ifdef CALLER_SAVES_D1
517 #define CALLER_SAVE_D1 SAVE_D1 = D1;
518 #define CALLER_RESTORE_D1 D1 = SAVE_D1;
519 #else
520 #define CALLER_SAVE_D1 /* nothing */
521 #define CALLER_RESTORE_D1 /* nothing */
522 #endif
523
524 #ifdef CALLER_SAVES_D2
525 #define CALLER_SAVE_D2 SAVE_D2 = D2;
526 #define CALLER_RESTORE_D2 D2 = SAVE_D2;
527 #else
528 #define CALLER_SAVE_D2 /* nothing */
529 #define CALLER_RESTORE_D2 /* nothing */
530 #endif
531
532 #ifdef CALLER_SAVES_L1
533 #define CALLER_SAVE_L1 SAVE_L1 = L1;
534 #define CALLER_RESTORE_L1 L1 = SAVE_L1;
535 #else
536 #define CALLER_SAVE_L1 /* nothing */
537 #define CALLER_RESTORE_L1 /* nothing */
538 #endif
539
540 #ifdef CALLER_SAVES_Sp
541 #define CALLER_SAVE_Sp SAVE_Sp = Sp;
542 #define CALLER_RESTORE_Sp Sp = SAVE_Sp;
543 #else
544 #define CALLER_SAVE_Sp /* nothing */
545 #define CALLER_RESTORE_Sp /* nothing */
546 #endif
547
548 #ifdef CALLER_SAVES_SpLim
549 #define CALLER_SAVE_SpLim SAVE_SpLim = SpLim;
550 #define CALLER_RESTORE_SpLim SpLim = SAVE_SpLim;
551 #else
552 #define CALLER_SAVE_SpLim /* nothing */
553 #define CALLER_RESTORE_SpLim /* nothing */
554 #endif
555
556 #ifdef CALLER_SAVES_Hp
557 #define CALLER_SAVE_Hp SAVE_Hp = Hp;
558 #define CALLER_RESTORE_Hp Hp = SAVE_Hp;
559 #else
560 #define CALLER_SAVE_Hp /* nothing */
561 #define CALLER_RESTORE_Hp /* nothing */
562 #endif
563
564 #ifdef CALLER_SAVES_Base
565 #ifdef THREADED_RTS
566 #error "Can't have caller-saved BaseReg with THREADED_RTS"
567 #endif
568 #define CALLER_SAVE_Base /* nothing */
569 #define CALLER_RESTORE_Base BaseReg = &MainRegTable;
570 #else
571 #define CALLER_SAVE_Base /* nothing */
572 #define CALLER_RESTORE_Base /* nothing */
573 #endif
574
575 #ifdef CALLER_SAVES_CurrentTSO
576 #define CALLER_SAVE_CurrentTSO SAVE_CurrentTSO = CurrentTSO;
577 #define CALLER_RESTORE_CurrentTSO CurrentTSO = SAVE_CurrentTSO;
578 #else
579 #define CALLER_SAVE_CurrentTSO /* nothing */
580 #define CALLER_RESTORE_CurrentTSO /* nothing */
581 #endif
582
583 #ifdef CALLER_SAVES_CurrentNursery
584 #define CALLER_SAVE_CurrentNursery SAVE_CurrentNursery = CurrentNursery;
585 #define CALLER_RESTORE_CurrentNursery CurrentNursery = SAVE_CurrentNursery;
586 #else
587 #define CALLER_SAVE_CurrentNursery /* nothing */
588 #define CALLER_RESTORE_CurrentNursery /* nothing */
589 #endif
590
591 #ifdef CALLER_SAVES_HpAlloc
592 #define CALLER_SAVE_HpAlloc SAVE_HpAlloc = HpAlloc;
593 #define CALLER_RESTORE_HpAlloc HpAlloc = SAVE_HpAlloc;
594 #else
595 #define CALLER_SAVE_HpAlloc /* nothing */
596 #define CALLER_RESTORE_HpAlloc /* nothing */
597 #endif
598
599 #endif /* IN_STG_CODE */
600
601 /* ----------------------------------------------------------------------------
602 Handy bunches of saves/restores
603 ------------------------------------------------------------------------ */
604
605 #if IN_STG_CODE
606
607 #define CALLER_SAVE_USER \
608 CALLER_SAVE_R1 \
609 CALLER_SAVE_R2 \
610 CALLER_SAVE_R3 \
611 CALLER_SAVE_R4 \
612 CALLER_SAVE_R5 \
613 CALLER_SAVE_R6 \
614 CALLER_SAVE_R7 \
615 CALLER_SAVE_R8 \
616 CALLER_SAVE_R9 \
617 CALLER_SAVE_R10 \
618 CALLER_SAVE_F1 \
619 CALLER_SAVE_F2 \
620 CALLER_SAVE_F3 \
621 CALLER_SAVE_F4 \
622 CALLER_SAVE_D1 \
623 CALLER_SAVE_D2 \
624 CALLER_SAVE_L1
625
626 /* Save Base last, since the others may
627 be addressed relative to it */
628 #define CALLER_SAVE_SYSTEM \
629 CALLER_SAVE_Sp \
630 CALLER_SAVE_SpLim \
631 CALLER_SAVE_Hp \
632 CALLER_SAVE_CurrentTSO \
633 CALLER_SAVE_CurrentNursery \
634 CALLER_SAVE_Base
635
636 #define CALLER_RESTORE_USER \
637 CALLER_RESTORE_R1 \
638 CALLER_RESTORE_R2 \
639 CALLER_RESTORE_R3 \
640 CALLER_RESTORE_R4 \
641 CALLER_RESTORE_R5 \
642 CALLER_RESTORE_R6 \
643 CALLER_RESTORE_R7 \
644 CALLER_RESTORE_R8 \
645 CALLER_RESTORE_R9 \
646 CALLER_RESTORE_R10 \
647 CALLER_RESTORE_F1 \
648 CALLER_RESTORE_F2 \
649 CALLER_RESTORE_F3 \
650 CALLER_RESTORE_F4 \
651 CALLER_RESTORE_D1 \
652 CALLER_RESTORE_D2 \
653 CALLER_RESTORE_L1
654
655 /* Restore Base first, since the others may
656 be addressed relative to it */
657 #define CALLER_RESTORE_SYSTEM \
658 CALLER_RESTORE_Base \
659 CALLER_RESTORE_Sp \
660 CALLER_RESTORE_SpLim \
661 CALLER_RESTORE_Hp \
662 CALLER_RESTORE_CurrentTSO \
663 CALLER_RESTORE_CurrentNursery
664
665 #else /* not IN_STG_CODE */
666
667 #define CALLER_SAVE_USER /* nothing */
668 #define CALLER_SAVE_SYSTEM /* nothing */
669 #define CALLER_RESTORE_USER /* nothing */
670 #define CALLER_RESTORE_SYSTEM /* nothing */
671
672 #endif /* IN_STG_CODE */
673 #define CALLER_SAVE_ALL \
674 CALLER_SAVE_SYSTEM \
675 CALLER_SAVE_USER
676
677 #define CALLER_RESTORE_ALL \
678 CALLER_RESTORE_SYSTEM \
679 CALLER_RESTORE_USER
680
681 #endif /* REGS_H */