aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_windows_386.s
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/sys_windows_386.s')
-rw-r--r--src/runtime/sys_windows_386.s11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/runtime/sys_windows_386.s b/src/runtime/sys_windows_386.s
index 2e5e82879c..ef8a3dd3c2 100644
--- a/src/runtime/sys_windows_386.s
+++ b/src/runtime/sys_windows_386.s
@@ -415,12 +415,15 @@ TEXT runtime·usleep2(SB),NOSPLIT,$20
// Runs on OS stack. duration (in 100ns units) is in BX.
TEXT runtime·usleep2HighRes(SB),NOSPLIT,$36
+ get_tls(CX)
+ CMPL CX, $0
+ JE gisnotset
+
// Want negative 100ns units.
NEGL BX
MOVL $-1, hi-4(SP)
MOVL BX, lo-8(SP)
- get_tls(CX)
MOVL g(CX), CX
MOVL g_m(CX), CX
MOVL (m_mOS+mOS_highResTimer)(CX), CX
@@ -449,6 +452,12 @@ TEXT runtime·usleep2HighRes(SB),NOSPLIT,$36
RET
+gisnotset:
+ // TLS is not configured. Call usleep2 instead.
+ MOVL $runtime·usleep2(SB), AX
+ CALL AX
+ RET
+
// Runs on OS stack.
TEXT runtime·switchtothread(SB),NOSPLIT,$0
MOVL SP, BP