aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/go-patches
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-12-02 16:15:23 -0500
committerJason A. Donenfeld <Jason@zx2c4.com>2021-12-02 23:16:58 -0500
commit32b3cb66eec33d1c8ba3e412fb749777fdcba8bc (patch)
treee6c1c5e50cca417cb8adc48c6d9c38a566f13b23 /go-patches
parentui: only set "(out of date)" window title if admin user (diff)
downloadwireguard-windows-32b3cb66eec33d1c8ba3e412fb749777fdcba8bc.tar.xz
wireguard-windows-32b3cb66eec33d1c8ba3e412fb749777fdcba8bc.zip
build: update to go 1.17.4 and drop upstreamed patches
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'go-patches')
-rw-r--r--go-patches/0003-release-branch.go1.17-runtime-support-non-cooperativ.patch (renamed from go-patches/0005-release-branch.go1.17-runtime-support-non-cooperativ.patch)0
-rw-r--r--go-patches/0003-runtime-on-windows-read-nanotime-with-one-instructio.patch200
-rw-r--r--go-patches/0004-runtime-support-non-cooperative-preemption-on-window.patch (renamed from go-patches/0006-runtime-support-non-cooperative-preemption-on-window.patch)0
-rw-r--r--go-patches/0004-runtime-use-correct-constant-when-computing-nsec-rem.patch81
4 files changed, 0 insertions, 281 deletions
diff --git a/go-patches/0005-release-branch.go1.17-runtime-support-non-cooperativ.patch b/go-patches/0003-release-branch.go1.17-runtime-support-non-cooperativ.patch
index dbab4ba0..dbab4ba0 100644
--- a/go-patches/0005-release-branch.go1.17-runtime-support-non-cooperativ.patch
+++ b/go-patches/0003-release-branch.go1.17-runtime-support-non-cooperativ.patch
diff --git a/go-patches/0003-runtime-on-windows-read-nanotime-with-one-instructio.patch b/go-patches/0003-runtime-on-windows-read-nanotime-with-one-instructio.patch
deleted file mode 100644
index 2ff79368..00000000
--- a/go-patches/0003-runtime-on-windows-read-nanotime-with-one-instructio.patch
+++ /dev/null
@@ -1,200 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: "Jason A. Donenfeld" <Jason@zx2c4.com>
-Date: Wed, 3 Nov 2021 18:19:04 +0100
-Subject: [PATCH] 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>
----
- src/runtime/sys_windows_amd64.s | 13 +++----------
- src/runtime/sys_windows_arm.s | 2 ++
- src/runtime/sys_windows_arm64.s | 10 +---------
- src/runtime/time_windows.h | 1 +
- src/runtime/time_windows_amd64.s | 19 +++----------------
- src/runtime/time_windows_arm.s | 4 ++++
- src/runtime/time_windows_arm64.s | 22 +++-------------------
- 7 files changed, 17 insertions(+), 54 deletions(-)
-
-diff --git a/src/runtime/sys_windows_amd64.s b/src/runtime/sys_windows_amd64.s
-index e7782846b2..64fa6791f4 100644
---- a/src/runtime/sys_windows_amd64.s
-+++ b/src/runtime/sys_windows_amd64.s
-@@ -348,16 +348,9 @@ TEXT runtime·nanotime1(SB),NOSPLIT,$0-8
- CMPB runtime·useQPCTime(SB), $0
- JNE useQPC
- MOVQ $_INTERRUPT_TIME, DI
--loop:
-- MOVL time_hi1(DI), AX
-- MOVL time_lo(DI), BX
-- MOVL time_hi2(DI), CX
-- CMPL AX, CX
-- JNE loop
-- SHLQ $32, CX
-- ORQ BX, CX
-- IMULQ $100, CX
-- MOVQ CX, ret+0(FP)
-+ MOVQ time_lo(DI), AX
-+ IMULQ $100, AX
-+ MOVQ AX, ret+0(FP)
- RET
- useQPC:
- JMP runtime·nanotimeQPC(SB)
-diff --git a/src/runtime/sys_windows_arm.s b/src/runtime/sys_windows_arm.s
-index 48f8c7dedf..d7ad244161 100644
---- a/src/runtime/sys_windows_arm.s
-+++ b/src/runtime/sys_windows_arm.s
-@@ -350,7 +350,9 @@ TEXT runtime·nanotime1(SB),NOSPLIT|NOFRAME,$0-8
- MOVW $_INTERRUPT_TIME, R3
- loop:
- MOVW time_hi1(R3), R1
-+ DMB MB_ISH
- MOVW time_lo(R3), R0
-+ DMB MB_ISH
- MOVW time_hi2(R3), R2
- CMP R1, R2
- BNE loop
-diff --git a/src/runtime/sys_windows_arm64.s b/src/runtime/sys_windows_arm64.s
-index 7a2e11f5ae..183128dd09 100644
---- a/src/runtime/sys_windows_arm64.s
-+++ b/src/runtime/sys_windows_arm64.s
-@@ -415,15 +415,7 @@ TEXT runtime·nanotime1(SB),NOSPLIT|NOFRAME,$0-8
- CMP $0, R0
- BNE useQPC
- MOVD $_INTERRUPT_TIME, R3
--loop:
-- MOVWU time_hi1(R3), R1
-- MOVWU time_lo(R3), R0
-- MOVWU time_hi2(R3), R2
-- CMP R1, R2
-- BNE loop
--
-- // wintime = R1:R0, multiply by 100
-- ORR R1<<32, R0
-+ MOVD time_lo(R3), R0
- MOVD $100, R1
- MUL R1, R0
- MOVD R0, ret+0(FP)
-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
-diff --git a/src/runtime/time_windows_amd64.s b/src/runtime/time_windows_amd64.s
-index 93ab960b06..045f64eb46 100644
---- a/src/runtime/time_windows_amd64.s
-+++ b/src/runtime/time_windows_amd64.s
-@@ -12,27 +12,14 @@
- TEXT time·now(SB),NOSPLIT,$0-24
- CMPB runtime·useQPCTime(SB), $0
- JNE useQPC
-+
- MOVQ $_INTERRUPT_TIME, DI
--loop:
-- MOVL time_hi1(DI), AX
-- MOVL time_lo(DI), BX
-- MOVL time_hi2(DI), CX
-- CMPL AX, CX
-- JNE loop
-- SHLQ $32, AX
-- ORQ BX, AX
-+ MOVQ time_lo(DI), AX
- IMULQ $100, AX
- MOVQ AX, mono+16(FP)
-
- MOVQ $_SYSTEM_TIME, DI
--wall:
-- MOVL time_hi1(DI), AX
-- MOVL time_lo(DI), BX
-- MOVL time_hi2(DI), CX
-- CMPL AX, CX
-- JNE wall
-- SHLQ $32, AX
-- ORQ BX, AX
-+ MOVQ time_lo(DI), AX
- MOVQ $116444736000000000, DI
- SUBQ DI, AX
- IMULQ $100, AX
-diff --git a/src/runtime/time_windows_arm.s b/src/runtime/time_windows_arm.s
-index 7c763b66ed..6552d75ff1 100644
---- a/src/runtime/time_windows_arm.s
-+++ b/src/runtime/time_windows_arm.s
-@@ -17,7 +17,9 @@ TEXT time·now(SB),NOSPLIT|NOFRAME,$0-20
- MOVW $_INTERRUPT_TIME, R3
- loop:
- MOVW time_hi1(R3), R1
-+ DMB MB_ISH
- MOVW time_lo(R3), R0
-+ DMB MB_ISH
- MOVW time_hi2(R3), R2
- CMP R1, R2
- BNE loop
-@@ -34,7 +36,9 @@ loop:
- MOVW $_SYSTEM_TIME, R3
- wall:
- MOVW time_hi1(R3), R1
-+ DMB MB_ISH
- MOVW time_lo(R3), R0
-+ DMB MB_ISH
- MOVW time_hi2(R3), R2
- CMP R1, R2
- BNE wall
-diff --git a/src/runtime/time_windows_arm64.s b/src/runtime/time_windows_arm64.s
-index ef52ce4c99..e8a0eb2f93 100644
---- a/src/runtime/time_windows_arm64.s
-+++ b/src/runtime/time_windows_arm64.s
-@@ -13,34 +13,18 @@ TEXT time·now(SB),NOSPLIT|NOFRAME,$0-24
- MOVB runtime·useQPCTime(SB), R0
- CMP $0, R0
- BNE useQPC
-- MOVD $_INTERRUPT_TIME, R3
--loop:
-- MOVWU time_hi1(R3), R1
-- MOVWU time_lo(R3), R0
-- MOVWU time_hi2(R3), R2
-- CMP R1, R2
-- BNE loop
-
-- // wintime = R1:R0, multiply by 100
-- ORR R1<<32, R0
-+ MOVD $_INTERRUPT_TIME, R3
-+ MOVD time_lo(R3), R0
- MOVD $100, R1
- MUL R1, R0
- MOVD R0, mono+16(FP)
-
- MOVD $_SYSTEM_TIME, R3
--wall:
-- MOVWU time_hi1(R3), R1
-- MOVWU time_lo(R3), R0
-- MOVWU time_hi2(R3), R2
-- CMP R1, R2
-- BNE wall
--
-- // w = R1:R0 in 100ns units
-+ MOVD time_lo(R3), R0
- // convert to Unix epoch (but still 100ns units)
- #define delta 116444736000000000
-- ORR R1<<32, R0
- SUB $delta, R0
--
- // Convert to nSec
- MOVD $100, R1
- MUL R1, R0
diff --git a/go-patches/0006-runtime-support-non-cooperative-preemption-on-window.patch b/go-patches/0004-runtime-support-non-cooperative-preemption-on-window.patch
index c99ea390..c99ea390 100644
--- a/go-patches/0006-runtime-support-non-cooperative-preemption-on-window.patch
+++ b/go-patches/0004-runtime-support-non-cooperative-preemption-on-window.patch
diff --git a/go-patches/0004-runtime-use-correct-constant-when-computing-nsec-rem.patch b/go-patches/0004-runtime-use-correct-constant-when-computing-nsec-rem.patch
deleted file mode 100644
index 4a826068..00000000
--- a/go-patches/0004-runtime-use-correct-constant-when-computing-nsec-rem.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: "Jason A. Donenfeld" <Jason@zx2c4.com>
-Date: Fri, 5 Nov 2021 00:10:31 +0100
-Subject: [PATCH] runtime: use correct constant when computing nsec remainder
-
-A code comment on amd64 for windows and plan9 contained a snippet for
-splitting apart the sec and nsec components of a unix timestamp, with
-produced assembly below, which was then cleaned up by hand. When arm64
-was ported, that code snippet in the comment went through the compiler
-to produce some code that was then pasted and cleaned up. Unfortunately,
-the comment had a typo in it, containing 8 zeros instead of 9.
-
-This resulted in the constant used in the assembly being wrong, spotted
-by @bufflig's eagle eyes. So, this commit fixes the comment on all three
-platforms, and the assembly on windows/arm64.
-
-Fixes #48072.
-
-Change-Id: I786fe89147328b0d25544f52c927ddfdb9f6f1cf
-Reviewed-on: https://go-review.googlesource.com/c/go/+/361474
-Trust: Jason A. Donenfeld <Jason@zx2c4.com>
-Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
-Reviewed-by: Patrik Nyblom <pnyb@google.com>
-TryBot-Result: Go Bot <gobot@golang.org>
----
- src/runtime/sys_plan9_amd64.s | 2 +-
- src/runtime/time_windows_amd64.s | 2 +-
- src/runtime/time_windows_arm64.s | 9 +++------
- 3 files changed, 5 insertions(+), 8 deletions(-)
-
-diff --git a/src/runtime/sys_plan9_amd64.s b/src/runtime/sys_plan9_amd64.s
-index 731306ab44..068200b7f3 100644
---- a/src/runtime/sys_plan9_amd64.s
-+++ b/src/runtime/sys_plan9_amd64.s
-@@ -94,7 +94,7 @@ TEXT runtime·walltime(SB),NOSPLIT,$8-12
- MOVQ 0(SP), AX
-
- // generated code for
-- // func f(x uint64) (uint64, uint64) { return x/1000000000, x%100000000 }
-+ // func f(x uint64) (uint64, uint64) { return x/1000000000, x%1000000000 }
- // adapted to reduce duplication
- MOVQ AX, CX
- MOVQ $1360296554856532783, AX
-diff --git a/src/runtime/time_windows_amd64.s b/src/runtime/time_windows_amd64.s
-index 045f64eb46..70f6a008cd 100644
---- a/src/runtime/time_windows_amd64.s
-+++ b/src/runtime/time_windows_amd64.s
-@@ -25,7 +25,7 @@ TEXT time·now(SB),NOSPLIT,$0-24
- IMULQ $100, AX
-
- // generated code for
-- // func f(x uint64) (uint64, uint64) { return x/1000000000, x%100000000 }
-+ // func f(x uint64) (uint64, uint64) { return x/1000000000, x%1000000000 }
- // adapted to reduce duplication
- MOVQ AX, CX
- MOVQ $1360296554856532783, AX
-diff --git a/src/runtime/time_windows_arm64.s b/src/runtime/time_windows_arm64.s
-index e8a0eb2f93..ef5b848473 100644
---- a/src/runtime/time_windows_arm64.s
-+++ b/src/runtime/time_windows_arm64.s
-@@ -32,17 +32,14 @@ TEXT time·now(SB),NOSPLIT|NOFRAME,$0-24
- // Code stolen from compiler output for:
- //
- // var x uint64
-- // func f() (sec uint64, nsec uint32) { return x / 1000000000, uint32(x % 100000000) }
-+ // func f() (sec uint64, nsec uint32) { return x / 1000000000, uint32(x % 1000000000) }
- //
- LSR $1, R0, R1
- MOVD $-8543223759426509416, R2
-- UMULH R2, R1, R1
-+ UMULH R1, R2, R1
- LSR $28, R1, R1
- MOVD R1, sec+0(FP)
-- MOVD $-6067343680855748867, R1
-- UMULH R0, R1, R1
-- LSR $26, R1, R1
-- MOVD $100000000, R2
-+ MOVD $1000000000, R2
- MSUB R1, R0, R2, R0
- MOVW R0, nsec+8(FP)
- RET