aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/defs_windows_386.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2018-06-21 12:08:36 -0400
committerAustin Clements <austin@google.com>2018-07-02 15:18:26 +0000
commit99e9be804379d0607de4a322353b317aa087073d (patch)
tree8243a4b056bb7ef2674d2061dfed50054cd908f1 /src/runtime/defs_windows_386.go
parent52e782a2d6e83065e394d127ea5df20e4aaaa8af (diff)
downloadgo-99e9be804379d0607de4a322353b317aa087073d.tar.gz
go-99e9be804379d0607de4a322353b317aa087073d.zip
runtime: query thread stack size from OS on Windows
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>
Diffstat (limited to 'src/runtime/defs_windows_386.go')
-rw-r--r--src/runtime/defs_windows_386.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/runtime/defs_windows_386.go b/src/runtime/defs_windows_386.go
index bac6ce78ce..589a7884cd 100644
--- a/src/runtime/defs_windows_386.go
+++ b/src/runtime/defs_windows_386.go
@@ -129,3 +129,13 @@ type overlapped struct {
anon0 [8]byte
hevent *byte
}
+
+type memoryBasicInformation struct {
+ baseAddress uintptr
+ allocationBase uintptr
+ allocationProtect uint32
+ regionSize uintptr
+ state uint32
+ protect uint32
+ type_ uint32
+}