// calls that may need more stack than we think.
//
// The default stack reserve size directly affects only the main
- // thread, ctrlhandler thread, and profileloop thread. For
- // these, it must be greater than the stack size assumed by
+ // thread and threads that enter in externalthreadhandler.
+ // For this, it must be greater than the stack size assumed by
// externalthreadhandler.
//
// For other threads, the runtime explicitly asks the kernel
// to start new os thread.
func tstart_stdcall(newm *m)
-// Called by OS using stdcall ABI.
-func ctrlhandler()
-
// Init-time helper
func wintls()
initExceptionHandler()
- stdcall2(_SetConsoleCtrlHandler, funcPC(ctrlhandler), 1)
-
initHighResTimer()
timeBeginPeriodRetValue = osRelax(false)
stdcall1(_FreeEnvironmentStringsW, uintptr(strings))
- // We call this all the way here, late in init, so that malloc works
- // for the callback function this generates.
+ // We call these all the way here, late in init, so that malloc works
+ // for the callback functions these generate.
+ var fn interface{} = ctrlHandler
+ ctrlHandlerPC := compileCallback(*efaceOf(&fn), true)
+ stdcall2(_SetConsoleCtrlHandler, ctrlHandlerPC, 1)
+
monitorSuspendResume()
}
})
}
-func ctrlhandler1(_type uint32) uint32 {
+func ctrlHandler(_type uint32) uintptr {
var s uint32
switch _type {
MOVL $runtime·lastcontinuehandler(SB), AX
JMP sigtramp<>(SB)
-// Called by OS using stdcall ABI: bool ctrlhandler(uint32).
-TEXT runtime·ctrlhandler<ABIInternal>(SB),NOSPLIT,$0
- PUSHL $runtime·ctrlhandler1(SB)
- NOP SP // tell vet SP changed - stop checking offsets
- CALL runtime·externalthreadhandler<ABIInternal>(SB)
- MOVL 4(SP), CX
- ADDL $12, SP
- JMP CX
-
// Called by OS using stdcall ABI: uint32 profileloop(void*).
TEXT runtime·profileloop<ABIInternal>(SB),NOSPLIT,$0
PUSHL $runtime·profileloop1(SB)
MOVQ $runtime·lastcontinuehandler(SB), AX
JMP sigtramp<>(SB)
-TEXT runtime·ctrlhandler<ABIInternal>(SB),NOSPLIT|NOFRAME,$8
- MOVQ CX, 16(SP) // spill
- MOVQ $runtime·ctrlhandler1(SB), CX
- MOVQ CX, 0(SP)
- CALL runtime·externalthreadhandler<ABIInternal>(SB)
- RET
-
TEXT runtime·profileloop<ABIInternal>(SB),NOSPLIT|NOFRAME,$8
MOVQ $runtime·profileloop1(SB), CX
MOVQ CX, 0(SP)
MOVW $runtime·lastcontinuehandler(SB), R1
B sigtramp<>(SB)
-TEXT runtime·ctrlhandler<ABIInternal>(SB),NOSPLIT|NOFRAME,$0
- MOVW $runtime·ctrlhandler1(SB), R1
- B runtime·externalthreadhandler<ABIInternal>(SB)
-
TEXT runtime·profileloop<ABIInternal>(SB),NOSPLIT|NOFRAME,$0
MOVW $runtime·profileloop1(SB), R1
B runtime·externalthreadhandler<ABIInternal>(SB)
MOVD $runtime·lastcontinuehandler<ABIInternal>(SB), R1
B sigtramp<>(SB)
-TEXT runtime·ctrlhandler<ABIInternal>(SB),NOSPLIT|NOFRAME,$0
- MOVD $runtime·ctrlhandler1(SB), R1
- B runtime·externalthreadhandler<ABIInternal>(SB)
-
TEXT runtime·profileloop<ABIInternal>(SB),NOSPLIT|NOFRAME,$0
MOVD $runtime·profileloop1(SB), R1
B runtime·externalthreadhandler<ABIInternal>(SB)