github.com/Andyfoo/golang/x/sys@v0.0.0-20190901054642-57c1bf301704/windows/svc/sys_386.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 argc+0(FP), AX 10 MOVL AX, ·sArgc(SB) 11 MOVL argv+4(FP), AX 12 MOVL AX, ·sArgv(SB) 13 14 PUSHL BP 15 PUSHL BX 16 PUSHL SI 17 PUSHL DI 18 19 SUBL $12, SP 20 21 MOVL ·sName(SB), AX 22 MOVL AX, (SP) 23 MOVL $·servicectlhandler(SB), AX 24 MOVL AX, 4(SP) 25 // Set context to 123456 to test issue #25660. 26 MOVL $123456, 8(SP) 27 MOVL ·cRegisterServiceCtrlHandlerExW(SB), AX 28 MOVL SP, BP 29 CALL AX 30 MOVL BP, SP 31 CMPL AX, $0 32 JE exit 33 MOVL AX, ·ssHandle(SB) 34 35 MOVL ·goWaitsH(SB), AX 36 MOVL AX, (SP) 37 MOVL ·cSetEvent(SB), AX 38 MOVL SP, BP 39 CALL AX 40 MOVL BP, SP 41 42 MOVL ·cWaitsH(SB), AX 43 MOVL AX, (SP) 44 MOVL $-1, AX 45 MOVL AX, 4(SP) 46 MOVL ·cWaitForSingleObject(SB), AX 47 MOVL SP, BP 48 CALL AX 49 MOVL BP, SP 50 51 exit: 52 ADDL $12, SP 53 54 POPL DI 55 POPL SI 56 POPL BX 57 POPL BP 58 59 MOVL 0(SP), CX 60 ADDL $12, SP 61 JMP CX 62 63 // I do not know why, but this seems to be the only way to call 64 // ctlHandlerProc on Windows 7. 65 66 // func servicectlhandler(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr { 67 TEXT ·servicectlhandler(SB),7,$0 68 MOVL ·ctlHandlerExProc(SB), CX 69 JMP CX