diff options
| author | qmuntal <quimmuntal@gmail.com> | 2023-02-24 18:15:32 +0100 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-03-13 14:20:41 +0000 |
| commit | b6f29d23654eba09209db00704ccef1f01a60c71 (patch) | |
| tree | fbf02d071ad1a82d7bd6a85d014881543a936070 /src/runtime/sys_windows_amd64.s | |
| parent | b561ebab46124c3542ee2d67c68ca770b67cb8dc (diff) | |
| download | go-b6f29d23654eba09209db00704ccef1f01a60c71.tar.xz | |
runtime: implement high resolution timer on windows arm/arm64
This CL moves the usleep2HighRes from assembly to good old Go.
This is safe because since CL 288793 usleep is always called with
a g, else one wold have to call usleep_no_g. This condition was
not enforced when high resolution timers were first implemented
on Windows (CL 248699), so the implementation was done in assembly.
Other than removing a bunch of obscure assembly code, this CL makes
high resolution timers work on windows arm/arm64 by free, as the
system calls are the same in all windows platforms.
Change-Id: I41ecf78026fd7e11e85258a411ae074a77e8c7fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/471142
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Diffstat (limited to 'src/runtime/sys_windows_amd64.s')
| -rw-r--r-- | src/runtime/sys_windows_amd64.s | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/runtime/sys_windows_amd64.s b/src/runtime/sys_windows_amd64.s index 5eb03b014e..367cb2ba76 100644 --- a/src/runtime/sys_windows_amd64.s +++ b/src/runtime/sys_windows_amd64.s @@ -251,39 +251,6 @@ TEXT runtime·usleep2(SB),NOSPLIT,$48-4 MOVQ 40(SP), SP RET -// Runs on OS stack. duration (in -100ns units) is in dt+0(FP). -// g is valid. -TEXT runtime·usleep2HighRes(SB),NOSPLIT,$72-4 - MOVLQSX dt+0(FP), BX - get_tls(CX) - - MOVQ SP, AX - ANDQ $~15, SP // alignment as per Windows requirement - MOVQ AX, 64(SP) - - MOVQ g(CX), CX - MOVQ g_m(CX), CX - MOVQ (m_mOS+mOS_highResTimer)(CX), CX // hTimer - MOVQ CX, 48(SP) // save hTimer for later - LEAQ 56(SP), DX // lpDueTime - MOVQ BX, (DX) - MOVQ $0, R8 // lPeriod - MOVQ $0, R9 // pfnCompletionRoutine - MOVQ $0, AX - MOVQ AX, 32(SP) // lpArgToCompletionRoutine - MOVQ AX, 40(SP) // fResume - MOVQ runtime·_SetWaitableTimer(SB), AX - CALL AX - - MOVQ 48(SP), CX // handle - MOVQ $0, DX // alertable - MOVQ $0, R8 // ptime - MOVQ runtime·_NtWaitForSingleObject(SB), AX - CALL AX - - MOVQ 64(SP), SP - RET - // Runs on OS stack. TEXT runtime·switchtothread(SB),NOSPLIT,$0 MOVQ SP, AX |
