sys_386.s 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. // +build windows
  5. // func servicemain(argc uint32, argv **uint16)
  6. TEXT ·servicemain(SB),7,$0
  7. MOVL argc+0(FP), AX
  8. MOVL AX, ·sArgc(SB)
  9. MOVL argv+4(FP), AX
  10. MOVL AX, ·sArgv(SB)
  11. PUSHL BP
  12. PUSHL BX
  13. PUSHL SI
  14. PUSHL DI
  15. SUBL $12, SP
  16. MOVL ·sName(SB), AX
  17. MOVL AX, (SP)
  18. MOVL $·servicectlhandler(SB), AX
  19. MOVL AX, 4(SP)
  20. MOVL ·cRegisterServiceCtrlHandlerW(SB), AX
  21. MOVL SP, BP
  22. CALL AX
  23. MOVL BP, SP
  24. CMPL AX, $0
  25. JE exit
  26. MOVL AX, ·ssHandle(SB)
  27. MOVL ·goWaitsH(SB), AX
  28. MOVL AX, (SP)
  29. MOVL ·cSetEvent(SB), AX
  30. MOVL SP, BP
  31. CALL AX
  32. MOVL BP, SP
  33. MOVL ·cWaitsH(SB), AX
  34. MOVL AX, (SP)
  35. MOVL $-1, AX
  36. MOVL AX, 4(SP)
  37. MOVL ·cWaitForSingleObject(SB), AX
  38. MOVL SP, BP
  39. CALL AX
  40. MOVL BP, SP
  41. exit:
  42. ADDL $12, SP
  43. POPL DI
  44. POPL SI
  45. POPL BX
  46. POPL BP
  47. MOVL 0(SP), CX
  48. ADDL $12, SP
  49. JMP CX
  50. // I do not know why, but this seems to be the only way to call
  51. // ctlHandlerProc on Windows 7.
  52. // func servicectlhandler(ctl uint32) uintptr
  53. TEXT ·servicectlhandler(SB),7,$0
  54. MOVL ·ctlHandlerProc(SB), CX
  55. JMP CX