diff options
| author | Russ Cox <rsc@golang.org> | 2014-03-24 21:22:16 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-03-24 21:22:16 -0400 |
| commit | 3750904a7efc36aa4f604497b53a9dc1ea67492b (patch) | |
| tree | 35ee5656b00d9f5a5d0ee04e8b4ea9e65be402d1 /src/pkg/runtime/proc.c | |
| parent | 3b27343c14fdfeaa19b20b26ce660aafa814d01d (diff) | |
| download | go-3750904a7efc36aa4f604497b53a9dc1ea67492b.tar.xz | |
runtime: use VEH, not SEH, for windows/386 exception handling
Structured Exception Handling (SEH) was the first way to handle
exceptions (memory faults, divides by zero) on Windows.
The S might as well stand for "stack-based": the implementation
interprets stack addresses in a few different ways, and it gets
subtly confused by Go's management of stacks. It's also something
that requires active maintenance during cgo switches, and we've
had bugs in that maintenance in the past.
We have recently come to believe that SEH cannot work with
Go's stack usage. See http://golang.org/issue/7325 for details.
Vectored Exception Handling (VEH) is more like a Unix signal
handler: you set it once for the whole process and forget about it.
This CL drops all the SEH code and replaces it with VEH code.
Many special cases and 7 #ifdefs disappear.
VEH was introduced in Windows XP, so Go on windows/386 will
now require Windows XP or later. The previous requirement was
Windows 2000 or later. Windows 2000 immediately preceded
Windows XP, so Windows 2000 is the only affected version.
Microsoft stopped supporting Windows 2000 in 2010.
See http://golang.org/s/win2000-golang-nuts for details.
Fixes #7325.
LGTM=alex.brainman, r
R=golang-codereviews, alex.brainman, stephen.gutekanst, dave
CC=golang-codereviews, iant, r
https://golang.org/cl/74790043
Diffstat (limited to 'src/pkg/runtime/proc.c')
| -rw-r--r-- | src/pkg/runtime/proc.c | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index b5093497d9..375dced240 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -599,13 +599,6 @@ runtime·starttheworld(void) void runtime·mstart(void) { -#ifdef GOOSARCH_windows_386 - // It is used by windows-386 only. Unfortunately, seh needs - // to be located on os stack, and mstart runs on os stack - // for both m0 and m. - SEH seh; -#endif - if(g != m->g0) runtime·throw("bad runtime·mstart"); @@ -615,9 +608,6 @@ runtime·mstart(void) runtime·gosave(&m->g0->sched); m->g0->sched.pc = (uintptr)-1; // make sure it is never used m->g0->stackguard = m->g0->stackguard0; // cgo sets only stackguard0, copy it to stackguard -#ifdef GOOSARCH_windows_386 - m->seh = &seh; -#endif runtime·asminit(); runtime·minit(); @@ -769,14 +759,6 @@ runtime·needm(byte x) g->stackguard = (uintptr)(&x - 32*1024); g->stackguard0 = g->stackguard; -#ifdef GOOSARCH_windows_386 - // On windows/386, we need to put an SEH frame (two words) - // somewhere on the current stack. We are called from cgocallback_gofunc - // and we know that it will leave two unused words below m->curg->sched.sp. - // Use those. - m->seh = (SEH*)((uintptr*)&x + 1); -#endif - // Initialize this thread to use the m. runtime·asminit(); runtime·minit(); @@ -854,10 +836,6 @@ runtime·dropm(void) // Undo whatever initialization minit did during needm. runtime·unminit(); -#ifdef GOOSARCH_windows_386 - m->seh = nil; // reset dangling typed pointer -#endif - // Clear m and g, and return m to the extra list. // After the call to setmg we can only call nosplit functions. mp = m; |
