aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/asm_386.s
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/asm_386.s')
-rw-r--r--src/runtime/asm_386.s19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s
index e16880c950..02179d2ee9 100644
--- a/src/runtime/asm_386.s
+++ b/src/runtime/asm_386.s
@@ -171,8 +171,12 @@ nocpuinfo:
MOVL $runtime·tls_g(SB), 8(SP) // arg 3: &tls_g
#else
MOVL $0, BX
- MOVL BX, 12(SP) // arg 3,4: not used when using platform's TLS
- MOVL BX, 8(SP)
+ MOVL BX, 12(SP) // arg 4: not used when using platform's TLS
+#ifdef GOOS_windows
+ MOVL $runtime·tls_g(SB), 8(SP) // arg 3: &tls_g
+#else
+ MOVL BX, 8(SP) // arg 3: not used when using platform's TLS
+#endif
#endif
MOVL $setg_gcc<>(SB), BX
MOVL BX, 4(SP) // arg 2: setg_gcc
@@ -795,14 +799,15 @@ havem:
TEXT runtime·setg(SB), NOSPLIT, $0-4
MOVL gg+0(FP), BX
#ifdef GOOS_windows
+ MOVL runtime·tls_g(SB), CX
CMPL BX, $0
JNE settls
- MOVL $0, 0x14(FS)
+ MOVL $0, 0(CX)(FS)
RET
settls:
MOVL g_m(BX), AX
LEAL m_tls(AX), AX
- MOVL AX, 0x14(FS)
+ MOVL AX, 0(CX)(FS)
#endif
get_tls(CX)
MOVL BX, g(CX)
@@ -867,6 +872,9 @@ rdtsc:
JMP done
TEXT ldt0setup<>(SB),NOSPLIT,$16-0
+#ifdef GOOS_windows
+ CALL runtime·wintls(SB)
+#endif
// set up ldt 7 to point at m0.tls
// ldt 1 would be fine on Linux, but on OS X, 7 is as low as we can go.
// the entry number is just a hint. setldt will set up GS with what it used.
@@ -1577,3 +1585,6 @@ TEXT runtime·panicExtendSlice3CU(SB),NOSPLIT,$0-12
DATA runtime·tls_g+0(SB)/4, $8
GLOBL runtime·tls_g+0(SB), NOPTR, $4
#endif
+#ifdef GOOS_windows
+GLOBL runtime·tls_g+0(SB), NOPTR, $4
+#endif