.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / sys@v0.0.0-20210124154548-22da62e12c0c / windows / svc / sys_amd64.s
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         MOVQ    SP, AX
10         ANDQ    $~15, SP        // alignment as per Windows requirement
11         SUBQ    $48, SP         // room for SP and 4 args as per Windows requirement
12                                 // plus one extra word to keep stack 16 bytes aligned
13         MOVQ    AX, 32(SP)
14
15         MOVL    CX, ·sArgc(SB)
16         MOVQ    DX, ·sArgv(SB)
17
18         MOVQ    ·sName(SB), CX
19         MOVQ    $·servicectlhandler(SB), DX
20         // BUG(pastarmovj): Figure out a way to pass in context in R8.
21         // Set context to 123456 to test issue #25660.
22         MOVQ    $123456, R8
23         MOVQ    ·cRegisterServiceCtrlHandlerExW(SB), AX
24         CALL    AX
25         CMPQ    AX, $0
26         JE      exit
27         MOVQ    AX, ·ssHandle(SB)
28
29         MOVQ    ·goWaitsH(SB), CX
30         MOVQ    ·cSetEvent(SB), AX
31         CALL    AX
32
33         MOVQ    ·cWaitsH(SB), CX
34         MOVQ    $4294967295, DX
35         MOVQ    ·cWaitForSingleObject(SB), AX
36         CALL    AX
37
38 exit:
39         MOVQ    32(SP), SP
40         RET
41
42 // I do not know why, but this seems to be the only way to call
43 // ctlHandlerProc on Windows 7.
44
45 // func ·servicectlhandler(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr {
46 TEXT ·servicectlhandler(SB),7,$0
47         MOVQ    ·ctlHandlerExProc(SB), AX
48         JMP     AX