aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/defs_windows.go
AgeCommit message (Collapse)Author
2021-02-19runtime: convert windows/arm64 assemblyRuss Cox
The assembly is mostly a straightforward conversion of the equivalent arm assembly. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. Change-Id: I61b15d712ade4d3a7285c7680de8e0987aacba10 Reviewed-on: https://go-review.googlesource.com/c/go/+/288828 Trust: Russ Cox <rsc@golang.org> Trust: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19runtime: factor common code out of defs_windows_*.goRuss Cox
Also give up on the fiction that these files can be regenerated. They contain many manual edits, and they're fairly small anyway. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: Ib4e4e20a43d8beb1d5390fd184160c33607641f6 Reviewed-on: https://go-review.googlesource.com/c/go/+/288807 Trust: Russ Cox <rsc@golang.org> Trust: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-08-29runtime: treat CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT as ↵Tianon Gravi
SIGTERM on Windows This matches the existing behavior of treating CTRL_C_EVENT, CTRL_BREAK_EVENT as a synthesized SIGINT event. See https://docs.microsoft.com/en-us/windows/console/handlerroutine for a good documentation source upstream to confirm these values. As for the usage of these events, the "Timeouts" section of that upstream documentation is important to note, especially the limited window in which to do any cleanup before the program will be forcibly killed (defaults typically 5s, but as low as 500ms, and in many cases configurable system-wide). These events are especially relevant for Windows containers, where these events (particularly `CTRL_SHUTDOWN_EVENT`) are one of the only ways containers can "gracefully" shut down (https://github.com/moby/moby/issues/25982#issuecomment-466804071). This was verified by making a simple `main()` which implements the same code as in `ExampleNotify_allSignals` but in a `for` loop, building a `main.exe`, running that in a container, then doing `docker kill -sTERM` on said container. The program prints `Got signal: SIGTERM`, then exits after the aforementioned timeout, as expected. Behavior before this patch is that the program gets no notification (and thus no output) but still exits after the timeout. Fixes #7479 Change-Id: I2af79421cd484a0fbb9467bb7ddb5f0e8bc3610e GitHub-Last-Rev: 9e05d631b542393f5ebb0eb3747157c8bd0de635 GitHub-Pull-Request: golang/go#33311 Reviewed-on: https://go-review.googlesource.com/c/go/+/187739 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-07-02runtime: query thread stack size from OS on WindowsAustin Clements
Currently, on Windows, the thread stack size is set or assumed in many different places. In non-cgo binaries, both the Go linker and the runtime have a copy of the stack size, the Go linker sets the size of the main thread stack, and the runtime sets the size of other thread stacks. In cgo binaries, the external linker sets the main thread stack size, the runtime assumes the size of the main thread stack will be the same as used by the Go linker, and the cgo entry code assumes the same. Furthermore, users can change the main thread stack size using editbin, so the runtime doesn't even really know what size it is, and user C code can create threads with unknown thread stack sizes, which we also assume have the same default stack size. This is all a mess. Fix the corner cases of this and the duplication of knowledge between the linker and the runtime by querying the OS for the stack bounds during thread setup. Furthermore, we unify all of this into just runtime.minit for both cgo and non-cgo binaries and for the main thread, other runtime-created threads, and C-created threads. Updates #20975. Change-Id: I45dbee2b5ea2ae721a85a27680737ff046f9d464 Reviewed-on: https://go-review.googlesource.com/120336 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-14runtime: log all thread stack traces during GODEBUG=crash on Linux and OS XRuss Cox
Normally, a panic/throw only shows the thread stack for the current thread and all paused goroutines. Goroutines running on other threads, or other threads running on their system stacks, are opaque. Change that when GODEBUG=crash, by passing a SIGQUIT around to all the threads when GODEBUG=crash. If this works out reasonably well, we might make the SIGQUIT relay part of the standard panic/throw death, perhaps eliding idle m's. Change-Id: If7dd354f7f3a6e326d17c254afcf4f7681af2f8b Reviewed-on: https://go-review.googlesource.com/2811 Reviewed-by: Rick Hudson <rlh@golang.org>
2015-01-01runtime: provide a dummy value of _SIGPROF on plan9 and windowsShenghou Ma
Fixes build on plan9 and windows. Change-Id: Ic9b02c641ab84e4f6d8149de71b9eb495e3343b2 Reviewed-on: https://go-review.googlesource.com/2233 Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2014-10-15runtime: handle all windows exception (second attempt)Alex Brainman
includes undo of 22318cd31d7d and also: - always use SetUnhandledExceptionFilter on windows-386; - crash when receive EXCEPTION_BREAKPOINT in exception handler. Fixes #8006. LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews https://golang.org/cl/155360043
2014-10-09undo CL 145150043 / 8b3d26697b8dAlex Brainman
That was complete failure - builders are broken, but original cl worked fine on my system. I will need access to builders to test this change properly. ««« original CL description runtime: handle all windows exception Fixes #8006. LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews https://golang.org/cl/145150043 »»» TBR=rsc R=golang-codereviews CC=golang-codereviews https://golang.org/cl/154180043
2014-10-09runtime: handle all windows exceptionAlex Brainman
Fixes #8006. LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews https://golang.org/cl/145150043
2014-09-19runtime: remove useless code around of EXCEPTION_BREAKPOINTAlex Brainman
This is to simplify VEH handler before making changes to fix issue 8006. Update #8006 LGTM=adg, rsc R=golang-codereviews, adg, rsc CC=golang-codereviews https://golang.org/cl/138630043
2014-09-08build: move package sources from src/pkg to srcRuss Cox
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.