aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/defs_windows_386.go
AgeCommit message (Collapse)Author
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-11-26runtime: windows/arm fix tracebacks printed from sigpanicJordan Rhee
The exception handler modifies the stack and continuation context so it looks like the faulting code calls sigpanic() directly. The call was not set up correctly on ARM, because it did not handle the link register correctly. This change handles the link register correctly for ARM. Updates #28854 Change-Id: I7ccf838adfc05cd968a5edd7d19ebba6a2478360 Reviewed-on: https://go-review.googlesource.com/c/150957 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-09-18runtime: support windows/armJordan Rhee
Updates #26148 Change-Id: I8f68b2c926c7b11dc86c9664ed7ff2d2f78b64b4 Reviewed-on: https://go-review.googlesource.com/128715 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
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-04-09runtime: use (*context) ip, setip, sp and setsp everywhere on windowsAlex Brainman
Also move dumpregs into defs_windows_*.go. Change-Id: Ic077d7dbb133c7b812856e758d696d6fed557afd Reviewed-on: https://go-review.googlesource.com/4650 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-10runtime: introduce CPU access functions on windowsAlex Brainman
This CL introduces new methods for 'context' type, so we can manipulate its values in an architecture independent way. Use new methods to replace both 386 and amd64 versions of dosigprof with single piece of code. There is more similar code to be converted in the following CLs. Also remove os_windows_386.go and os_windows_amd64.go. These contain unused functions. Change-Id: I28f76aeb97f6e4249843d30d3d0c33fb233d3f7f Reviewed-on: https://go-review.googlesource.com/2790 Reviewed-by: Minux Ma <minux@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-11-11[dev.cc] runtime: convert defs_$GOOS_$GOARCH.h to GoRuss Cox
The conversion was done with an automated tool and then modified only as necessary to make it compile and run. In a few cases, defs_$GOOS_$GOARCH.go already existed, so the target here is defs1_$GOOS_$GOARCH.go. [This CL is part of the removal of C code from package runtime. See golang.org/s/dev.cc for an overview.] LGTM=r R=r CC=austin, dvyukov, golang-codereviews, iant, khr https://golang.org/cl/171490043