aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/time_windows.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-11-03 18:19:04 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2021-11-03 18:37:22 +0000
commitcfd016df1fba2a2a104f4cca705aa4357777986b (patch)
treea0704332a5565aa06525c733d7e935dab7eb2451 /src/runtime/time_windows.h
parentd4e0e8e4a41e5e1e7d0359287a1015791ce778ed (diff)
downloadgo-cfd016df1fba2a2a104f4cca705aa4357777986b.tar.xz
runtime: on windows, read nanotime with one instruction or issue barrier
On 64-bit, this is more efficient, and on ARM64, this prevents the time from moving backwards due to the weaker memory model. On ARM32 due to the weaker memory model, we issue a memory barrier. Updates #48072. Change-Id: If4695716c3039d8af14e14808af217f5c99fc93a Reviewed-on: https://go-review.googlesource.com/c/go/+/361057 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/time_windows.h')
-rw-r--r--src/runtime/time_windows.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/runtime/time_windows.h b/src/runtime/time_windows.h
index cd16fd163b..7c2e65c328 100644
--- a/src/runtime/time_windows.h
+++ b/src/runtime/time_windows.h
@@ -9,6 +9,7 @@
// http://web.archive.org/web/20210411000829/https://wrkhpi.wordpress.com/2007/08/09/getting-os-information-the-kuser_shared_data-structure/
// Must read hi1, then lo, then hi2. The snapshot is valid if hi1 == hi2.
+// Or, on 64-bit, just read lo:hi1 all at once atomically.
#define _INTERRUPT_TIME 0x7ffe0008
#define _SYSTEM_TIME 0x7ffe0014
#define time_lo 0