aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime
diff options
context:
space:
mode:
authorAlex Brainman <alex.brainman@gmail.com>2014-07-10 14:23:50 +1000
committerAlex Brainman <alex.brainman@gmail.com>2014-07-10 14:23:50 +1000
commit418b39d436ceda146bbbced0bd716bff2f8371e2 (patch)
treef6c084f45df829d0eb43eae95f3adf759f5a6af4 /src/pkg/runtime
parenta1778ec1462c2f3f8865e02e5fd7e72ee25c2b64 (diff)
downloadgo-418b39d436ceda146bbbced0bd716bff2f8371e2.tar.xz
runtime: align stack before calling windows in usleep2
Fixes #8174. LGTM=minux R=golang-codereviews, minux CC=golang-codereviews https://golang.org/cl/102360043
Diffstat (limited to 'src/pkg/runtime')
-rw-r--r--src/pkg/runtime/sys_windows_amd64.s6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pkg/runtime/sys_windows_amd64.s b/src/pkg/runtime/sys_windows_amd64.s
index 72b905ef79..6dc13e293d 100644
--- a/src/pkg/runtime/sys_windows_amd64.s
+++ b/src/pkg/runtime/sys_windows_amd64.s
@@ -367,7 +367,10 @@ usleep1_ret:
RET
// Runs on OS stack. duration (in 100ns units) is in BX.
-TEXT runtime·usleep2(SB),NOSPLIT,$8
+TEXT runtime·usleep2(SB),NOSPLIT,$16
+ MOVQ SP, AX
+ ANDQ $~15, SP // alignment as per Windows requirement
+ MOVQ AX, 8(SP)
// Want negative 100ns units.
NEGQ BX
MOVQ SP, R8 // ptime
@@ -376,4 +379,5 @@ TEXT runtime·usleep2(SB),NOSPLIT,$8
MOVQ $0, DX // alertable
MOVQ runtime·NtWaitForSingleObject(SB), AX
CALL AX
+ MOVQ 8(SP), SP
RET