diff options
Diffstat (limited to 'src/runtime/sys_windows_amd64.s')
| -rw-r--r-- | src/runtime/sys_windows_amd64.s | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/runtime/sys_windows_amd64.s b/src/runtime/sys_windows_amd64.s index 6cc8e91952..c1b78e3976 100644 --- a/src/runtime/sys_windows_amd64.s +++ b/src/runtime/sys_windows_amd64.s @@ -102,7 +102,7 @@ TEXT runtime·getlasterror(SB),NOSPLIT,$0 // exception record and context pointers. // DX is the kind of sigtramp function. // Return value of sigtrampgo is stored in AX. -TEXT sigtramp<>(SB),NOSPLIT|NOFRAME,$0-0 +TEXT sigtramp<>(SB),NOSPLIT,$0-0 // Switch from the host ABI to the Go ABI. PUSH_REGS_HOST_TO_ABI0() @@ -155,6 +155,38 @@ TEXT runtime·lastcontinuetramp(SB),NOSPLIT|NOFRAME,$0-0 MOVQ $const_callbackLastVCH, DX JMP sigtramp<>(SB) +TEXT runtime·sehtramp(SB),NOSPLIT,$40-0 + // CX: PEXCEPTION_RECORD ExceptionRecord + // DX: ULONG64 EstablisherFrame + // R8: PCONTEXT ContextRecord + // R9: PDISPATCHER_CONTEXT DispatcherContext + // Switch from the host ABI to the Go ABI. + PUSH_REGS_HOST_TO_ABI0() + + get_tls(AX) + CMPQ AX, $0 + JNE 2(PC) + // This shouldn't happen, sehtramp is only attached to functions + // called from Go, and exception handlers are only called from + // the thread that threw the exception. + INT $3 + + // Exception from Go thread, set R14. + MOVQ g(AX), R14 + + ADJSP $40 + MOVQ CX, 0(SP) + MOVQ DX, 8(SP) + MOVQ R8, 16(SP) + MOVQ R9, 24(SP) + CALL runtime·sehhandler(SB) + MOVL 32(SP), AX + + ADJSP $-40 + + POP_REGS_HOST_TO_ABI0() + RET + TEXT runtime·callbackasm1(SB),NOSPLIT|NOFRAME,$0 // Construct args vector for cgocallback(). // By windows/amd64 calling convention first 4 args are in CX, DX, R8, R9 |
