github.com/zhongdalu/gf@v1.0.0/third/golang.org/x/sys/windows/svc/sys_amd64.s (about)

     1  // Copyright 2012 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build windows
     6  
     7  // func servicemain(argc uint32, argv **uint16)
     8  TEXT ·servicemain(SB),7,$0
     9  	MOVL	CX, ·sArgc(SB)
    10  	MOVQ	DX, ·sArgv(SB)
    11  
    12  	SUBQ	$32, SP		// stack for the first 4 syscall params
    13  
    14  	MOVQ	·sName(SB), CX
    15  	MOVQ	$·servicectlhandler(SB), DX
    16  	// BUG(pastarmovj): Figure out a way to pass in context in R8.
    17  	MOVQ	·cRegisterServiceCtrlHandlerExW(SB), AX
    18  	CALL	AX
    19  	CMPQ	AX, $0
    20  	JE	exit
    21  	MOVQ	AX, ·ssHandle(SB)
    22  
    23  	MOVQ	·goWaitsH(SB), CX
    24  	MOVQ	·cSetEvent(SB), AX
    25  	CALL	AX
    26  
    27  	MOVQ	·cWaitsH(SB), CX
    28  	MOVQ	$4294967295, DX
    29  	MOVQ	·cWaitForSingleObject(SB), AX
    30  	CALL	AX
    31  
    32  exit:
    33  	ADDQ	$32, SP
    34  	RET
    35  
    36  // I do not know why, but this seems to be the only way to call
    37  // ctlHandlerProc on Windows 7.
    38  
    39  // func ·servicectlhandler(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr {
    40  TEXT ·servicectlhandler(SB),7,$0
    41  	MOVQ	·ctlHandlerExProc(SB), AX
    42  	JMP	AX