mirror of
https://github.com/golang/sys.git
synced 2026-02-08 11:46:04 +03:00
New Context field will be used in the following CL to test ctlHandler parameter alignments. Also adjust TestExample to pass hard coded Context value of 123456 to test service, and verify that correct value is logged. Final part of the test is commented out, and will be adjusted in the next CL. Updates golang/go#25660 Change-Id: Iad2896ae497ee1edc0d62655eaf08671ec2651c5 Reviewed-on: https://go-review.googlesource.com/c/158697 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
45 lines
1.1 KiB
ArmAsm
45 lines
1.1 KiB
ArmAsm
// 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)
|
|
MOVQ DX, ·sArgv(SB)
|
|
|
|
SUBQ $32, SP // stack for the first 4 syscall params
|
|
|
|
MOVQ ·sName(SB), CX
|
|
MOVQ $·servicectlhandler(SB), DX
|
|
// BUG(pastarmovj): Figure out a way to pass in context in R8.
|
|
// Set context to 123456 to test issue #25660.
|
|
MOVQ $123456, R8
|
|
MOVQ ·cRegisterServiceCtrlHandlerExW(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, evtype uint32, evdata uintptr, context uintptr) uintptr {
|
|
TEXT ·servicectlhandler(SB),7,$0
|
|
MOVQ ·ctlHandlerExProc(SB), AX
|
|
JMP AX
|