File: sys_amd64.s

package info (click to toggle)
golang-golang-x-sys 0.0~git20160517.0.d4feaf1-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 4,356 kB
  • sloc: perl: 1,152; sh: 670; asm: 332; ansic: 37; makefile: 14
file content (41 lines) | stat: -rw-r--r-- 911 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build windows

// func servicemain(argc uint32, argv **uint16)
TEXT ·servicemain(SB),7,$0
	MOVL	CX, ·sArgc(SB)
	MOVL	DX, ·sArgv(SB)

	SUBQ	$32, SP		// stack for the first 4 syscall params

	MOVQ	·sName(SB), CX
	MOVQ	$·servicectlhandler(SB), DX
	MOVQ	·cRegisterServiceCtrlHandlerW(SB), AX
	CALL	AX
	CMPQ	AX, $0
	JE	exit
	MOVQ	AX, ·ssHandle(SB)

	MOVQ	·goWaitsH(SB), CX
	MOVQ	·cSetEvent(SB), AX
	CALL	AX

	MOVQ	·cWaitsH(SB), CX
	MOVQ	$4294967295, DX
	MOVQ	·cWaitForSingleObject(SB), AX
	CALL	AX

exit:
	ADDQ	$32, SP
	RET

// I do not know why, but this seems to be the only way to call
// ctlHandlerProc on Windows 7.

// func servicectlhandler(ctl uint32) uintptr
TEXT ·servicectlhandler(SB),7,$0
	MOVQ	·ctlHandlerProc(SB), AX
	JMP	AX