]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: really pass return value to Windows in externalthreadhandler
authorAlex Brainman <alex.brainman@gmail.com>
Tue, 14 Apr 2015 00:48:05 +0000 (10:48 +1000)
committerAlex Brainman <alex.brainman@gmail.com>
Wed, 15 Apr 2015 05:03:42 +0000 (05:03 +0000)
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 <minux@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/os/signal/signal_windows_test.go
src/runtime/os1_windows.go
src/runtime/sys_windows_386.s
src/runtime/sys_windows_amd64.s

index 45c86f0e14c1c2aca1006ec3a0945a2782ea5fc6..f3e6706b7521edd9499e5b85affc357ea1e86aed 100644 (file)
@@ -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
index 1ab6ed1437872dcedd04717202a68469b5da6197..8df2968196fa8fa56de5d8db070077f006f81e9c 100644 (file)
@@ -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 {
index 5f4a63bcdd036267f7fedbfd096fbbce3df4ff16..e5fe88afd8ab8f6ba528708178826b59ca69b39f 100644 (file)
@@ -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
index dd81ce055af31c60a2f6b90ad60e5e304bf2cfac..ea4f3e03563a2aa2082e2808e2b56ff40ec4f0eb 100644 (file)
@@ -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