131
"#define get_tls(r) MOVL 0x14(FS), r\n"
132
"#define g(r) 0(r)\n"
133
"#define m(r) 4(r)\n"
136
"// Plan 9 does not have per-process segment descriptors with\n"
137
"// which to do thread-local storage. Instead, we will use a\n"
138
"// fixed offset from the per-process TOS struct address for\n"
139
"// the local storage. Since the process ID is contained in the\n"
140
"// TOS struct, we specify an offset for that here as well.\n"
141
"#define get_tls(r) MOVL _tos(SB), r \n"
142
"#define g(r) -8(r)\n"
143
"#define m(r) -4(r)\n"
144
"#define procid(r) 48(r)\n"
147
"// On Linux systems, what we call 0(GS) and 4(GS) for g and m\n"
148
"// turn into %gs:-8 and %gs:-4 (using gcc syntax to denote\n"
149
"// what the machine sees as opposed to 8l input).\n"
150
"// 8l rewrites 0(GS) and 4(GS) into these.\n"
152
"// On Linux Xen, it is not allowed to use %gs:-8 and %gs:-4\n"
153
"// directly. Instead, we have to store %gs:0 into a temporary\n"
154
"// register and then use -8(%reg) and -4(%reg). This kind\n"
155
"// of addressing is correct even when not running Xen.\n"
157
"// 8l can rewrite MOVL 0(GS), CX into the appropriate pair\n"
158
"// of mov instructions, using CX as the intermediate register\n"
159
"// (safe because CX is about to be written to anyway).\n"
160
"// But 8l cannot handle other instructions, like storing into 0(GS),\n"
161
"// which is where these macros come into play.\n"
162
"// get_tls sets up the temporary and then g and r use it.\n"
164
"// Another wrinkle is that get_tls needs to read from %gs:0,\n"
165
"// but in 8l input it's called 8(GS), because 8l is going to\n"
166
"// subtract 8 from all the offsets, as described above.\n"
168
"// The final wrinkle is that when generating an ELF .o file for\n"
169
"// external linking mode, we need to be able to relocate the\n"
170
"// -8(r) and -4(r) instructions. Tag them with an extra (GS*1)\n"
171
"// that is ignored by the linker except for that identification.\n"
172
"#define get_tls(r) MOVL 8(GS), r\n"
173
"#define g(r) -8(r)(GS*1)\n"
174
"#define m(r) -4(r)(GS*1)\n"
177
"#define get_tls(r)\n"
178
"#define g(r) 0(GS)\n"
179
"#define m(r) 4(GS)\n"
183
"#define get_tls(r) MOVQ 0x28(GS), r\n"
184
"#define g(r) 0(r)\n"
185
"#define m(r) 8(r)\n"
188
"#define get_tls(r)\n"
189
"#define g(r) 0(GS)\n"
190
"#define m(r) 8(GS)\n"
191
"#define procid(r) 16(GS)\n"
193
// The TLS accessors here are defined here to use initial exec model.
194
// If the linker is not outputting a shared library, it will reduce
195
// the TLS accessors to the local exec model, effectively removing
198
"#define get_tls(r) MOVQ runtime·tlsgm(SB), r\n"
199
"#define g(r) 0(r)(GS*1)\n"
200
"#define m(r) 8(r)(GS*1)\n"
131
"#define get_tls(r) MOVL TLS, r\n"
132
"#define g(r) 0(r)(TLS*1)\n"
133
"#define m(r) 4(r)(TLS*1)\n"
136
"#define get_tls(r) MOVL TLS, r\n"
137
"#define g(r) 0(r)(TLS*1)\n"
138
"#define m(r) 4(r)(TLS*1)\n"
203
"#define get_tls(r)\n"
204
"#define g(r) 0(GS)\n"
205
"#define m(r) 8(GS)\n"
141
"#define get_tls(r) MOVQ TLS, r\n"
142
"#define g(r) 0(r)(TLS*1)\n"
143
"#define m(r) 8(r)(TLS*1)\n"
208
147
"#define LR R14\n"