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>
"os"
"os/exec"
"path/filepath"
- "runtime"
"syscall"
"testing"
"time"
}
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
sigprof(r.ip(), r.sp(), 0, gp, mp)
}
-func profileloop1() {
+func profileloop1(param uintptr) uint32 {
stdcall2(_SetThreadPriority, currentThread, _THREAD_PRIORITY_HIGHEST)
for {
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
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