1 |
gbeauche |
1.5 |
/* 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 |
gbeauche |
1.2 |
#if (defined(__APPLE__) && defined(__MACH__)) |
26 |
gbeauche |
1.3 |
#define C_SYMBOL_NAME(NAME) _ ## NAME |
27 |
|
|
#define ASM_MACRO_END .endmacro |
28 |
gbeauche |
1.6 |
#define ASM_MACRO_ARG0_DEF /* nothing! */ |
29 |
|
|
#define ASM_MACRO_ARG0 $0 |
30 |
|
|
#define ASM_MACRO_ARG0_DEF /* nothing! */ |
31 |
|
|
#define ASM_MACRO_ARG1 $1 |
32 |
gbeauche |
1.3 |
#endif |
33 |
|
|
|
34 |
|
|
/* Defaults for GNU assembler */ |
35 |
|
|
#ifndef ASM_MACRO_START |
36 |
|
|
#define ASM_MACRO_START .macro |
37 |
|
|
#endif |
38 |
|
|
#ifndef ASM_MACRO_END |
39 |
|
|
#define ASM_MACRO_END .endm |
40 |
gbeauche |
1.2 |
#endif |
41 |
gbeauche |
1.6 |
#ifndef ASM_MACRO_ARG0_DEF |
42 |
|
|
#define ASM_MACRO_ARG0_DEF __asm_macro_arg0 |
43 |
|
|
#define ASM_MACRO_ARG0 \__asm_macro_arg0 |
44 |
|
|
#define ASM_MACRO_ARG1_DEF , __asm_macro_arg1 |
45 |
|
|
#define ASM_MACRO_ARG1 \__asm_macro_arg1 |
46 |
|
|
#endif |
47 |
gbeauche |
1.2 |
#ifndef C_SYMBOL_NAME |
48 |
gbeauche |
1.3 |
#define C_SYMBOL_NAME(NAME) NAME |
49 |
gbeauche |
1.2 |
#endif |
50 |
|
|
#ifndef ASM_GLOBAL_DIRECTIVE |
51 |
gbeauche |
1.3 |
#define ASM_GLOBAL_DIRECTIVE .globl |
52 |
gbeauche |
1.2 |
#endif |
53 |
|
|
|
54 |
cebix |
1.1 |
/* Register names */ |
55 |
gbeauche |
1.4 |
#if defined(__linux__) || defined(__NetBSD__) |
56 |
cebix |
1.1 |
#define r0 0 |
57 |
|
|
#define r1 1 |
58 |
|
|
#define r2 2 |
59 |
|
|
#define r3 3 |
60 |
|
|
#define r4 4 |
61 |
|
|
#define r5 5 |
62 |
|
|
#define r6 6 |
63 |
|
|
#define r7 7 |
64 |
|
|
#define r8 8 |
65 |
|
|
#define r9 9 |
66 |
|
|
#define r10 10 |
67 |
|
|
#define r11 11 |
68 |
|
|
#define r12 12 |
69 |
|
|
#define r13 13 |
70 |
|
|
#define r14 14 |
71 |
|
|
#define r15 15 |
72 |
|
|
#define r16 16 |
73 |
|
|
#define r17 17 |
74 |
|
|
#define r18 18 |
75 |
|
|
#define r19 19 |
76 |
|
|
#define r20 20 |
77 |
|
|
#define r21 21 |
78 |
|
|
#define r22 22 |
79 |
|
|
#define r23 23 |
80 |
|
|
#define r24 24 |
81 |
|
|
#define r25 25 |
82 |
|
|
#define r26 26 |
83 |
|
|
#define r27 27 |
84 |
|
|
#define r28 28 |
85 |
|
|
#define r29 29 |
86 |
|
|
#define r30 30 |
87 |
|
|
#define r31 31 |
88 |
gbeauche |
1.2 |
#endif |
89 |
cebix |
1.1 |
|
90 |
gbeauche |
1.4 |
#if defined(__linux__) || defined(__NetBSD__) |
91 |
cebix |
1.1 |
#define f0 0 |
92 |
|
|
#define f1 1 |
93 |
|
|
#define f2 2 |
94 |
|
|
#define f3 3 |
95 |
|
|
#define f4 4 |
96 |
|
|
#define f5 5 |
97 |
|
|
#define f6 6 |
98 |
|
|
#define f7 7 |
99 |
|
|
#define f8 8 |
100 |
|
|
#define f9 9 |
101 |
|
|
#define f10 10 |
102 |
|
|
#define f11 11 |
103 |
|
|
#define f12 12 |
104 |
|
|
#define f13 13 |
105 |
|
|
#define f14 14 |
106 |
|
|
#define f15 15 |
107 |
|
|
#define f16 16 |
108 |
|
|
#define f17 17 |
109 |
|
|
#define f18 18 |
110 |
|
|
#define f19 19 |
111 |
|
|
#define f20 20 |
112 |
|
|
#define f21 21 |
113 |
|
|
#define f22 22 |
114 |
|
|
#define f23 23 |
115 |
|
|
#define f24 24 |
116 |
|
|
#define f25 25 |
117 |
|
|
#define f26 26 |
118 |
|
|
#define f27 27 |
119 |
|
|
#define f28 28 |
120 |
|
|
#define f29 29 |
121 |
|
|
#define f30 30 |
122 |
|
|
#define f31 31 |
123 |
gbeauche |
1.2 |
#endif |
124 |
gbeauche |
1.5 |
#endif |