github.com/Andyfoo/golang/x/sys@v0.0.0-20190901054642-57c1bf301704/windows/svc/sys_arm.s (about)

     1  // Copyright 2018 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  #include "textflag.h"
     8  
     9  // func servicemain(argc uint32, argv **uint16)
    10  TEXT ·servicemain(SB),NOSPLIT|NOFRAME,$0
    11  	MOVM.DB.W [R4, R14], (R13)	// push {r4, lr}
    12  	MOVW    R13, R4
    13  	BIC     $0x7, R13		// alignment for ABI
    14  
    15  	MOVW	R0, ·sArgc(SB)
    16  	MOVW	R1, ·sArgv(SB)
    17  
    18  	MOVW	·sName(SB), R0
    19  	MOVW	·ctlHandlerExProc(SB), R1
    20  	MOVW	$0, R2
    21  	MOVW	·cRegisterServiceCtrlHandlerExW(SB), R3
    22  	BL      (R3)
    23  	CMP     $0, R0
    24  	BEQ     exit
    25  	MOVW	R0, ·ssHandle(SB)
    26  
    27  	MOVW	·goWaitsH(SB), R0
    28  	MOVW	·cSetEvent(SB), R1
    29  	BL      (R1)
    30  
    31  	MOVW	·cWaitsH(SB), R0
    32  	MOVW	$-1, R1
    33  	MOVW	·cWaitForSingleObject(SB), R2
    34  	BL      (R2)
    35  
    36  exit:
    37  	MOVW	R4, R13			// free extra stack space
    38  	MOVM.IA.W (R13), [R4, R15]	// pop {r4, pc}