github.com/reiver/go@v0.0.0-20150109200633-1d0c7792f172/src/runtime/os_windows.go (about)

     1  // Copyright 2014 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  package runtime
     6  
     7  import _ "unsafe" // for go:linkname
     8  
     9  type stdFunction *byte
    10  
    11  //go:linkname os_sigpipe os.sigpipe
    12  func os_sigpipe() {
    13  	throw("too many writes on closed pipe")
    14  }
    15  
    16  func sigpanic() {
    17  	g := getg()
    18  	if !canpanic(g) {
    19  		throw("unexpected signal during runtime execution")
    20  	}
    21  
    22  	switch uint32(g.sig) {
    23  	case _EXCEPTION_ACCESS_VIOLATION:
    24  		if g.sigcode1 < 0x1000 || g.paniconfault {
    25  			panicmem()
    26  		}
    27  		print("unexpected fault address ", hex(g.sigcode1), "\n")
    28  		throw("fault")
    29  	case _EXCEPTION_INT_DIVIDE_BY_ZERO:
    30  		panicdivide()
    31  	case _EXCEPTION_INT_OVERFLOW:
    32  		panicoverflow()
    33  	case _EXCEPTION_FLT_DENORMAL_OPERAND,
    34  		_EXCEPTION_FLT_DIVIDE_BY_ZERO,
    35  		_EXCEPTION_FLT_INEXACT_RESULT,
    36  		_EXCEPTION_FLT_OVERFLOW,
    37  		_EXCEPTION_FLT_UNDERFLOW:
    38  		panicfloat()
    39  	}
    40  	throw("fault")
    41  }