From: Alex Brainman Date: Tue, 14 Apr 2015 00:48:05 +0000 (+1000) Subject: runtime: really pass return value to Windows in externalthreadhandler X-Git-Tag: go1.5beta1~1112 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9402e49450d57eb608f03980e7541602a346e5ae;p=gostls13.git runtime: really pass return value to Windows in externalthreadhandler When Windows calls externalthreadhandler it expects to receive return value in AX. We don't set AX anywhere. Change that. Store ctrlhandler1 and profileloop1 return values into AX before returning from externalthreadhandler. Fixes #10215. Change-Id: Ied04542cc3ebe7d4a26660e970f9f78098143591 Reviewed-on: https://go-review.googlesource.com/8901 Reviewed-by: Minux Ma Run-TryBot: Alex Brainman TryBot-Result: Gobot Gobot --- diff --git a/src/os/signal/signal_windows_test.go b/src/os/signal/signal_windows_test.go index 45c86f0e14..f3e6706b75 100644 --- a/src/os/signal/signal_windows_test.go +++ b/src/os/signal/signal_windows_test.go @@ -10,7 +10,6 @@ import ( "os" "os/exec" "path/filepath" - "runtime" "syscall" "testing" "time" @@ -32,9 +31,6 @@ func sendCtrlBreak(t *testing.T, pid int) { } func TestCtrlBreak(t *testing.T) { - if runtime.GOARCH == "386" { - t.Skip("known failing test on windows/386, see https://golang.org/issue/10215") - } // create source file const source = ` package main diff --git a/src/runtime/os1_windows.go b/src/runtime/os1_windows.go index 1ab6ed1437..8df2968196 100644 --- a/src/runtime/os1_windows.go +++ b/src/runtime/os1_windows.go @@ -492,7 +492,7 @@ func profilem(mp *m) { sigprof(r.ip(), r.sp(), 0, gp, mp) } -func profileloop1() { +func profileloop1(param uintptr) uint32 { stdcall2(_SetThreadPriority, currentThread, _THREAD_PRIORITY_HIGHEST) for { diff --git a/src/runtime/sys_windows_386.s b/src/runtime/sys_windows_386.s index 5f4a63bcdd..e5fe88afd8 100644 --- a/src/runtime/sys_windows_386.s +++ b/src/runtime/sys_windows_386.s @@ -213,9 +213,11 @@ TEXT runtime·externalthreadhandler(SB),NOSPLIT,$0 MOVL CX, g_stackguard1(SP) MOVL DX, (g_stack+stack_hi)(SP) + PUSHL AX // room for return value PUSHL 16(BP) // arg for handler CALL 8(BP) POPL CX + POPL AX // pass return value to Windows in AX get_tls(CX) MOVL g(CX), CX diff --git a/src/runtime/sys_windows_amd64.s b/src/runtime/sys_windows_amd64.s index dd81ce055a..ea4f3e0356 100644 --- a/src/runtime/sys_windows_amd64.s +++ b/src/runtime/sys_windows_amd64.s @@ -250,9 +250,11 @@ TEXT runtime·externalthreadhandler(SB),NOSPLIT,$0 MOVQ CX, g_stackguard1(SP) MOVQ DX, (g_stack+stack_hi)(SP) + PUSHQ AX // room for return value PUSHQ 32(BP) // arg for handler CALL 16(BP) POPQ CX + POPQ AX // pass return value to Windows in AX get_tls(CX) MOVQ g(CX), CX