13
13
TEXT runtime·asmstdcall(SB),NOSPLIT,$0
14
14
// asmcgocall will put first argument into CX.
15
15
PUSHQ CX // save for later
16
MOVQ wincall_fn(CX), AX
17
MOVQ wincall_args(CX), SI
18
MOVQ wincall_n(CX), CX
16
MOVQ libcall_fn(CX), AX
17
MOVQ libcall_args(CX), SI
18
MOVQ libcall_n(CX), CX
20
20
// SetLastError(0).
98
TEXT runtime·sigtramp(SB),NOSPLIT,$0
99
// CX: exception record
103
TESTL $6, 4(CX) // exception flags
107
// copy arguments for call to sighandler.
109
// Stack adjustment is here to hide from 6l,
110
// which doesn't understand that sigtramp
111
// runs on essentially unlimited stack.
118
// check that m exists
98
// Called by Windows as a Vectored Exception Handler (VEH).
99
// First argument is pointer to struct containing
100
// exception record and context pointers.
101
// Return 0 for 'not handled', -1 for handled.
102
TEXT runtime·sigtramp(SB),NOSPLIT,$0-0
103
// CX: PEXCEPTION_POINTERS ExceptionInfo
105
// DI SI BP BX R12 R13 R14 R15 registers and DF flag are preserved
106
// as required by windows callback convention.
118
MOVQ 0(CX), BX // ExceptionRecord*
119
MOVQ 8(CX), CX // Context*
125
MOVQ $0, AX // continue
122
130
CALL runtime·badsignal2(SB)
132
// call sighandler(ExceptionRecord*, Context*, G*)
132
136
CALL runtime·sighandler(SB)
137
// AX is set to report result back to Windows
140
// restore registers as required for windows callback
143
154
TEXT runtime·ctrlhandler(SB),NOSPLIT,$8
277
288
POPQ -8(CX)(DX*1) // restore bytes just after the args
280
TEXT runtime·setstacklimits(SB),NOSPLIT,$0
283
MOVQ $0xffffffffffff, AX
287
291
// uint32 tstart_stdcall(M *newm);
288
292
TEXT runtime·tstart_stdcall(SB),NOSPLIT,$0
289
293
// CX contains first arg newm
315
319
MOVQ DI, 0x28(GS)
318
// void install_exception_handler()
319
TEXT runtime·install_exception_handler(SB),NOSPLIT,$0
320
CALL runtime·setstacklimits(SB)
323
TEXT runtime·remove_exception_handler(SB),NOSPLIT,$0
326
322
// Sleep duration is in 100ns units.
327
323
TEXT runtime·usleep1(SB),NOSPLIT,$0
328
324
MOVL duration+0(FP), BX
338
// leave pc/sp for cpu profiler
340
MOVQ R12, m_libcallpc(R13)
342
MOVQ R12, m_libcallg(R13)
343
// sp must be the last, because once async cpu profiler finds
344
// all three values to be non-zero, it will use them
346
MOVQ R12, m_libcallsp(R13)
344
351
// executing on m->g0 already
348
356
// Switch to m->g0 stack and back.
349
357
MOVQ (g_sched+gobuf_sp)(R14), R14
364
MOVQ $0, m_libcallsp(R13)
356
367
// Runs on OS stack. duration (in 100ns units) is in BX.