|
3 | 3 | // license that can be found in the LICENSE file.
|
4 | 4 |
|
5 | 5 | //
|
6 |
| -// System calls and other sys.stuff for arm, tamago |
| 6 | +// System calls and other sys.stuff for amd64, tamago |
7 | 7 | //
|
8 | 8 |
|
9 | 9 | #include "go_asm.h"
|
10 | 10 | #include "go_tls.h"
|
11 | 11 | #include "textflag.h"
|
12 | 12 |
|
| 13 | +#define IA32_MSR_FS_BASE 0xc0000100 |
| 14 | + |
13 | 15 | #define SYS_arch_prctl 158
|
14 | 16 |
|
15 | 17 | TEXT runtime·rt0_amd64_tamago(SB),NOSPLIT|NOFRAME|TOPFRAME,$0
|
|
114 | 116 | JNE bad_cpu
|
115 | 117 | #endif
|
116 | 118 |
|
117 |
| -#ifdef NEED_DARWIN_SUPPORT |
118 |
| - MOVQ $commpage64_version, BX |
119 |
| - CMPW (BX), $13 // cpu_capabilities64 undefined in versions < 13 |
120 |
| - JL bad_cpu |
121 |
| - MOVQ $commpage64_cpu_capabilities64, BX |
122 |
| - MOVQ (BX), BX |
123 |
| - MOVQ $NEED_DARWIN_SUPPORT, CX |
124 |
| - ANDQ CX, BX |
125 |
| - CMPQ BX, CX |
126 |
| - JNE bad_cpu |
127 |
| -#endif |
128 |
| - |
129 | 119 | CALL runtime·check(SB)
|
130 | 120 |
|
131 | 121 | MOVL 24(SP), AX // copy argc
|
@@ -167,6 +157,17 @@ TEXT runtime·GetG(SB),NOSPLIT,$0-16
|
167 | 157 |
|
168 | 158 | // This is needed by asm_amd64.s
|
169 | 159 | TEXT runtime·settls(SB),NOSPLIT,$32
|
| 160 | + MOVW runtime·testBinary(SB), AX |
| 161 | + CMPW AX, $0 |
| 162 | + JA testing |
| 163 | + |
| 164 | + MOVQ $IA32_MSR_FS_BASE, CX |
| 165 | + MOVQ $0x0, DX |
| 166 | + MOVQ $0xfffffffffffffff8, AX // -8(FS) |
| 167 | + WRMSR |
| 168 | + RET |
| 169 | + |
| 170 | +testing: |
170 | 171 | ADDQ $8, DI // ELF wants to use -8(FS)
|
171 | 172 | MOVQ DI, SI
|
172 | 173 | MOVQ $0x1002, DI // ARCH_SET_FS
|
|
0 commit comments