github.com/HACKERALERT/Picocrypt/src/external/sys@v0.0.0-20210609020157-e519952f829f/windows/svc/sys_windows_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 // func servicemain(argc uint32, argv **uint16) 6 TEXT ·servicemain(SB),7,$0 7 MOVQ SP, AX 8 ANDQ $~15, SP // alignment as per Windows requirement 9 SUBQ $48, SP // room for SP and 4 args as per Windows requirement 10 // plus one extra word to keep stack 16 bytes aligned 11 MOVQ AX, 32(SP) 12 13 MOVL CX, ·sArgc(SB) 14 MOVQ DX, ·sArgv(SB) 15 16 MOVQ ·sName(SB), CX 17 MOVQ $·servicectlhandler(SB), DX 18 // BUG(pastarmovj): Figure out a way to pass in context in R8. 19 // Set context to 123456 to test issue #25660. 20 MOVQ $123456, R8 21 MOVQ ·cRegisterServiceCtrlHandlerExW(SB), AX 22 CALL AX 23 CMPQ AX, $0 24 JE exit 25 MOVQ AX, ·ssHandle(SB) 26 27 MOVQ ·goWaitsH(SB), CX 28 MOVQ ·cSetEvent(SB), AX 29 CALL AX 30 31 MOVQ ·cWaitsH(SB), CX 32 MOVQ $4294967295, DX 33 MOVQ ·cWaitForSingleObject(SB), AX 34 CALL AX 35 36 exit: 37 MOVQ 32(SP), SP 38 RET 39 40 // I do not know why, but this seems to be the only way to call 41 // ctlHandlerProc on Windows 7. 42 43 // func ·servicectlhandler(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr { 44 TEXT ·servicectlhandler(SB),7,$0 45 MOVQ ·ctlHandlerExProc(SB), AX 46 JMP AX