diff options
| author | qmuntal <quimmuntal@gmail.com> | 2023-09-07 14:59:58 +0200 |
|---|---|---|
| committer | Quim Muntal <quimmuntal@gmail.com> | 2023-09-21 15:56:43 +0000 |
| commit | b6ae112ff1bb7ace761ed8dfee95626069280f07 (patch) | |
| tree | 571d45bce3397c43de95eb4bccb76fcb5191ebbd /src/runtime/sys_windows_arm.s | |
| parent | ace1494d9235be94f1325ab6e45105a446b3224c (diff) | |
| download | go-b6ae112ff1bb7ace761ed8dfee95626069280f07.tar.xz | |
runtime: implement usleep in Go instead of assembly on Windows
Windows APIs are normally not arch-specific, so it's better to
implement them in Go instead of assembly.
It was previously implemented in assembly because it was the only way
to support calls without a valid g. This CL defines a new function,
stdcall_no_g, that can be used in such cases.
While here, I've also replaced the use of the deprecated syscall
NtWaitForSingleObject with WaitForSingleObject. The former may
give the illusion of being more accurate, as it takes a higher
resolution timeout, but it's not. Windows time resolution is 15.6ms,
and can be as high as 1ms when using a high resolution timer, which
WaitForSingleObject supports.
Change-Id: I903400220ade4d4ccc15685c8da47182430f8686
Reviewed-on: https://go-review.googlesource.com/c/go/+/526477
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Diffstat (limited to 'src/runtime/sys_windows_arm.s')
| -rw-r--r-- | src/runtime/sys_windows_arm.s | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/src/runtime/sys_windows_arm.s b/src/runtime/sys_windows_arm.s index 4b941e40ae..d194899d50 100644 --- a/src/runtime/sys_windows_arm.s +++ b/src/runtime/sys_windows_arm.s @@ -195,25 +195,6 @@ TEXT runtime·tstart_stdcall(SB),NOSPLIT|NOFRAME,$0 MOVW $0, R0 MOVM.IA.W (R13), [R4-R11, R15] // pop {r4-r11, pc} -// Runs on OS stack. -// duration (in -100ns units) is in dt+0(FP). -// g may be nil. -TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$0-4 - MOVW dt+0(FP), R3 - MOVM.DB.W [R4, R14], (R13) // push {r4, lr} - MOVW R13, R4 // Save SP - SUB $8, R13 // R13 = R13 - 8 - BIC $0x7, R13 // Align SP for ABI - MOVW $0, R1 // R1 = FALSE (alertable) - MOVW $-1, R0 // R0 = handle - MOVW R13, R2 // R2 = pTime - MOVW R3, 0(R2) // time_lo - MOVW R0, 4(R2) // time_hi - MOVW runtime·_NtWaitForSingleObject(SB), R3 - BL (R3) - MOVW R4, R13 // Restore SP - MOVM.IA.W (R13), [R4, R15] // pop {R4, pc} - TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0 B runtime·armPublicationBarrier(SB) |
