1 |
/* Define usage of "reserved" registers */ |
2 |
#if defined(__linux__) |
3 |
#define SYSTEM_CLOBBERS_R2 1 /* Pointer to Thread Local Storage */ |
4 |
#define SYSTEM_CLOBBERS_R13 1 /* Pointer to .sdata section */ |
5 |
#endif |
6 |
|
7 |
#ifdef __ASSEMBLY__ |
8 |
/* Helper macros */ |
9 |
#ifdef SYSTEM_CLOBBERS_R2 |
10 |
#define RESTORE_SYSTEM_R2 lwz r2,XLM_TOC(0) |
11 |
#define SAVE_SYSTEM_R2 stw r2,XLM_TOC(0) |
12 |
#else |
13 |
#define RESTORE_SYSTEM_R2 |
14 |
#define SAVE_SYSTEM_R2 |
15 |
#endif |
16 |
#ifdef SYSTEM_CLOBBERS_R13 |
17 |
#define RESTORE_SYSTEM_R13 lwz r13,XLM_R13(0) |
18 |
#define SAVE_SYSTEM_R13 stw r13,XLM_R13(0) |
19 |
#else |
20 |
#define RESTORE_SYSTEM_R13 |
21 |
#define SAVE_SYSTEM_R13 |
22 |
#endif |
23 |
|
24 |
/* Apple assembler perticularities */ |
25 |
#if (defined(__APPLE__) && defined(__MACH__)) |
26 |
#define C_SYMBOL_NAME(NAME) _ ## NAME |
27 |
#define ASM_MACRO_END .endmacro |
28 |
#endif |
29 |
|
30 |
/* Defaults for GNU assembler */ |
31 |
#ifndef ASM_MACRO_START |
32 |
#define ASM_MACRO_START .macro |
33 |
#endif |
34 |
#ifndef ASM_MACRO_END |
35 |
#define ASM_MACRO_END .endm |
36 |
#endif |
37 |
#ifndef C_SYMBOL_NAME |
38 |
#define C_SYMBOL_NAME(NAME) NAME |
39 |
#endif |
40 |
#ifndef ASM_GLOBAL_DIRECTIVE |
41 |
#define ASM_GLOBAL_DIRECTIVE .globl |
42 |
#endif |
43 |
|
44 |
/* Register names */ |
45 |
#if defined(__linux__) || defined(__NetBSD__) |
46 |
#define r0 0 |
47 |
#define r1 1 |
48 |
#define r2 2 |
49 |
#define r3 3 |
50 |
#define r4 4 |
51 |
#define r5 5 |
52 |
#define r6 6 |
53 |
#define r7 7 |
54 |
#define r8 8 |
55 |
#define r9 9 |
56 |
#define r10 10 |
57 |
#define r11 11 |
58 |
#define r12 12 |
59 |
#define r13 13 |
60 |
#define r14 14 |
61 |
#define r15 15 |
62 |
#define r16 16 |
63 |
#define r17 17 |
64 |
#define r18 18 |
65 |
#define r19 19 |
66 |
#define r20 20 |
67 |
#define r21 21 |
68 |
#define r22 22 |
69 |
#define r23 23 |
70 |
#define r24 24 |
71 |
#define r25 25 |
72 |
#define r26 26 |
73 |
#define r27 27 |
74 |
#define r28 28 |
75 |
#define r29 29 |
76 |
#define r30 30 |
77 |
#define r31 31 |
78 |
#endif |
79 |
|
80 |
#if defined(__linux__) || defined(__NetBSD__) |
81 |
#define f0 0 |
82 |
#define f1 1 |
83 |
#define f2 2 |
84 |
#define f3 3 |
85 |
#define f4 4 |
86 |
#define f5 5 |
87 |
#define f6 6 |
88 |
#define f7 7 |
89 |
#define f8 8 |
90 |
#define f9 9 |
91 |
#define f10 10 |
92 |
#define f11 11 |
93 |
#define f12 12 |
94 |
#define f13 13 |
95 |
#define f14 14 |
96 |
#define f15 15 |
97 |
#define f16 16 |
98 |
#define f17 17 |
99 |
#define f18 18 |
100 |
#define f19 19 |
101 |
#define f20 20 |
102 |
#define f21 21 |
103 |
#define f22 22 |
104 |
#define f23 23 |
105 |
#define f24 24 |
106 |
#define f25 25 |
107 |
#define f26 26 |
108 |
#define f27 27 |
109 |
#define f28 28 |
110 |
#define f29 29 |
111 |
#define f30 30 |
112 |
#define f31 31 |
113 |
#endif |
114 |
#endif |