Commit 9402e494 authored by Alex Brainman's avatar Alex Brainman

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/8901Reviewed-by: 's avatarMinux Ma <minux@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 7e7d55f8
...@@ -10,7 +10,6 @@ import ( ...@@ -10,7 +10,6 @@ import (
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"runtime"
"syscall" "syscall"
"testing" "testing"
"time" "time"
...@@ -32,9 +31,6 @@ func sendCtrlBreak(t *testing.T, pid int) { ...@@ -32,9 +31,6 @@ func sendCtrlBreak(t *testing.T, pid int) {
} }
func TestCtrlBreak(t *testing.T) { 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 // create source file
const source = ` const source = `
package main package main
......
...@@ -492,7 +492,7 @@ func profilem(mp *m) { ...@@ -492,7 +492,7 @@ func profilem(mp *m) {
sigprof(r.ip(), r.sp(), 0, gp, mp) sigprof(r.ip(), r.sp(), 0, gp, mp)
} }
func profileloop1() { func profileloop1(param uintptr) uint32 {
stdcall2(_SetThreadPriority, currentThread, _THREAD_PRIORITY_HIGHEST) stdcall2(_SetThreadPriority, currentThread, _THREAD_PRIORITY_HIGHEST)
for { for {
......
...@@ -213,9 +213,11 @@ TEXT runtime·externalthreadhandler(SB),NOSPLIT,$0 ...@@ -213,9 +213,11 @@ TEXT runtime·externalthreadhandler(SB),NOSPLIT,$0
MOVL CX, g_stackguard1(SP) MOVL CX, g_stackguard1(SP)
MOVL DX, (g_stack+stack_hi)(SP) MOVL DX, (g_stack+stack_hi)(SP)
PUSHL AX // room for return value
PUSHL 16(BP) // arg for handler PUSHL 16(BP) // arg for handler
CALL 8(BP) CALL 8(BP)
POPL CX POPL CX
POPL AX // pass return value to Windows in AX
get_tls(CX) get_tls(CX)
MOVL g(CX), CX MOVL g(CX), CX
......
...@@ -250,9 +250,11 @@ TEXT runtime·externalthreadhandler(SB),NOSPLIT,$0 ...@@ -250,9 +250,11 @@ TEXT runtime·externalthreadhandler(SB),NOSPLIT,$0
MOVQ CX, g_stackguard1(SP) MOVQ CX, g_stackguard1(SP)
MOVQ DX, (g_stack+stack_hi)(SP) MOVQ DX, (g_stack+stack_hi)(SP)
PUSHQ AX // room for return value
PUSHQ 32(BP) // arg for handler PUSHQ 32(BP) // arg for handler
CALL 16(BP) CALL 16(BP)
POPQ CX POPQ CX
POPQ AX // pass return value to Windows in AX
get_tls(CX) get_tls(CX)
MOVQ g(CX), CX MOVQ g(CX), CX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment