github.com/maenmax/kairep@v0.0.0-20210218001208-55bf3df36788/src/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 MOVL 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 MOVQ ·cRegisterServiceCtrlHandlerW(SB), AX 17 CALL AX 18 CMPQ AX, $0 19 JE exit 20 MOVQ AX, ·ssHandle(SB) 21 22 MOVQ ·goWaitsH(SB), CX 23 MOVQ ·cSetEvent(SB), AX 24 CALL AX 25 26 MOVQ ·cWaitsH(SB), CX 27 MOVQ $4294967295, DX 28 MOVQ ·cWaitForSingleObject(SB), AX 29 CALL AX 30 31 exit: 32 ADDQ $32, SP 33 RET 34 35 // I do not know why, but this seems to be the only way to call 36 // ctlHandlerProc on Windows 7. 37 38 // func servicectlhandler(ctl uint32) uintptr 39 TEXT ·servicectlhandler(SB),7,$0 40 MOVQ ·ctlHandlerProc(SB), AX 41 JMP AX