diff --git a/.travis.yml b/.travis.yml index f98362b..871e73d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,3 +12,5 @@ go: - 1.6.3 - 1.7 - 1.7.1 + - 1.7.2 + - 1.7.3 diff --git a/README.md b/README.md index a1e62ba..ed2037e 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ println(id) See [godoc](https://godoc.org/github.com/huandu/goroutine) for more details. -## Caveats ## +## Supported builds ## Package goroutine is not well tested due to lack of test machines. Ideally, it should work on all go >= go1.5. @@ -32,6 +32,7 @@ Tested platforms. * go1.6.3 * go1.7 * go1.7.1 + * go1.7.3 * Travis CI (See https://travis-ci.org/huandu/goroutine) * go1.5 * go1.5.1 @@ -44,6 +45,30 @@ Tested platforms. * go1.6.3 * go1.7 * go1.7.1 + * go1.7.2 + * go1.7.3 + +## How it works ## + +Go program is a statically built binary. The runtime inside a binary is statically linked. It means, if I know Go version +and runtime source code for this version, I can copy struct declaration from runtime package source to my package and +cast runtime internal pointers to its underlying struct safely. As Go is an open source project, I can always find the right +struct for an interesting runtime pointer and then manipulate it. + +In this package, I just get current goroutine pointer (copy the `getg()` implementation from compiler) and cast it to a right +struct. It sounds simple. However, the struct `g` refers many other internal types defined in `runtime` package. I cannot +simply copy some necessary types to my package to make it work. I have to scan all types and constants in `runtime` and its +internal packages to make the struct `g` well defined. Another challenge is that Go authors update `runtime` structs in nearly +every major version (or even in a minor version). I have to maintain hacked code for every Go release. I develop a +semi-automatical tool to make things easier. I guess I may need to think of other better way to avoid to generate hacked source +for every Go release. + +NOTE: Starting from go1.7.2, Go compiler generates some constants definition for `runtime` package according to build flags and +environment when building. It makes current hack impossible to handle all posibile flag and environment combinations. I make a +hack to detour it and no impact to the major task of this package - get goroutine id. However, it's not a perfect solution. +If I want to do more tricks in runtime, such constants may bother me. + +I'm think of a perfect solution. If you have any suggestion, please open issue and let me know. Many thanks. ## License ## diff --git a/hack/go1_7_2/runtime/alg.go b/hack/go1_7_2/runtime/alg.go new file mode 100644 index 0000000..0e0209a --- /dev/null +++ b/hack/go1_7_2/runtime/alg.go @@ -0,0 +1,44 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_2/runtime/internal/sys" + "unsafe" +) + +const ( + c0 = uintptr((8-sys.PtrSize)/4*2860486313 + (sys.PtrSize-4)/4*33054211828000289) + c1 = uintptr((8-sys.PtrSize)/4*3267000013 + (sys.PtrSize-4)/4*23344194077549503) +) + +// type algorithms - known to compiler +const ( + alg_NOEQ = iota + alg_MEM0 + alg_MEM8 + alg_MEM16 + alg_MEM32 + alg_MEM64 + alg_MEM128 + alg_STRING + alg_INTER + alg_NILINTER + alg_FLOAT32 + alg_FLOAT64 + alg_CPLX64 + alg_CPLX128 + alg_max +) + +// typeAlg is also copied/used in reflect/type.go. +// keep them in sync. +type typeAlg struct { + hash func(unsafe.Pointer, uintptr) uintptr + + equal func(unsafe.Pointer, unsafe.Pointer) bool +} + +const hashRandomBytes = sys.PtrSize / 4 * 64 diff --git a/hack/go1_7_2/runtime/cgocall.go b/hack/go1_7_2/runtime/cgocall.go new file mode 100644 index 0000000..c58a56a --- /dev/null +++ b/hack/go1_7_2/runtime/cgocall.go @@ -0,0 +1,87 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Cgo call and callback support. +// +// To call into the C function f from Go, the cgo-generated code calls +// runtime.cgocall(_cgo_Cfunc_f, frame), where _cgo_Cfunc_f is a +// gcc-compiled function written by cgo. +// +// runtime.cgocall (below) locks g to m, calls entersyscall +// so as not to block other goroutines or the garbage collector, +// and then calls runtime.asmcgocall(_cgo_Cfunc_f, frame). +// +// runtime.asmcgocall (in asm_$GOARCH.s) switches to the m->g0 stack +// (assumed to be an operating system-allocated stack, so safe to run +// gcc-compiled code on) and calls _cgo_Cfunc_f(frame). +// +// _cgo_Cfunc_f invokes the actual C function f with arguments +// taken from the frame structure, records the results in the frame, +// and returns to runtime.asmcgocall. +// +// After it regains control, runtime.asmcgocall switches back to the +// original g (m->curg)'s stack and returns to runtime.cgocall. +// +// After it regains control, runtime.cgocall calls exitsyscall, which blocks +// until this m can run Go code without violating the $GOMAXPROCS limit, +// and then unlocks g from m. +// +// The above description skipped over the possibility of the gcc-compiled +// function f calling back into Go. If that happens, we continue down +// the rabbit hole during the execution of f. +// +// To make it possible for gcc-compiled C code to call a Go function p.GoF, +// cgo writes a gcc-compiled function named GoF (not p.GoF, since gcc doesn't +// know about packages). The gcc-compiled C function f calls GoF. +// +// GoF calls crosscall2(_cgoexp_GoF, frame, framesize). Crosscall2 +// (in cgo/gcc_$GOARCH.S, a gcc-compiled assembly file) is a two-argument +// adapter from the gcc function call ABI to the 6c function call ABI. +// It is called from gcc to call 6c functions. In this case it calls +// _cgoexp_GoF(frame, framesize), still running on m->g0's stack +// and outside the $GOMAXPROCS limit. Thus, this code cannot yet +// call arbitrary Go code directly and must be careful not to allocate +// memory or use up m->g0's stack. +// +// _cgoexp_GoF calls runtime.cgocallback(p.GoF, frame, framesize, ctxt). +// (The reason for having _cgoexp_GoF instead of writing a crosscall3 +// to make this call directly is that _cgoexp_GoF, because it is compiled +// with 6c instead of gcc, can refer to dotted names like +// runtime.cgocallback and p.GoF.) +// +// runtime.cgocallback (in asm_$GOARCH.s) switches from m->g0's +// stack to the original g (m->curg)'s stack, on which it calls +// runtime.cgocallbackg(p.GoF, frame, framesize). +// As part of the stack switch, runtime.cgocallback saves the current +// SP as m->g0->sched.sp, so that any use of m->g0's stack during the +// execution of the callback will be done below the existing stack frames. +// Before overwriting m->g0->sched.sp, it pushes the old value on the +// m->g0 stack, so that it can be restored later. +// +// runtime.cgocallbackg (below) is now running on a real goroutine +// stack (not an m->g0 stack). First it calls runtime.exitsyscall, which will +// block until the $GOMAXPROCS limit allows running this goroutine. +// Once exitsyscall has returned, it is safe to do things like call the memory +// allocator or invoke the Go callback function p.GoF. runtime.cgocallbackg +// first defers a function to unwind m->g0.sched.sp, so that if p.GoF +// panics, m->g0.sched.sp will be restored to its old value: the m->g0 stack +// and the m->curg stack will be unwound in lock step. +// Then it calls p.GoF. Finally it pops but does not execute the deferred +// function, calls runtime.entersyscall, and returns to runtime.cgocallback. +// +// After it regains control, runtime.cgocallback switches back to +// m->g0's stack (the pointer is still in m->g0.sched.sp), restores the old +// m->g0.sched.sp value from the stack, and returns to _cgoexp_GoF. +// +// _cgoexp_GoF immediately returns to crosscall2, which restores the +// callee-save registers for gcc and returns to GoF, which returns to f. + +package runtime + +// Addresses collected in a cgo backtrace when crashing. +// Length must match arg.Max in x_cgo_callers in runtime/cgo/gcc_traceback.c. +type cgoCallers [32]uintptr + +const cgoCheckPointerFail = "cgo argument has Go pointer to Go pointer" +const cgoResultFail = "cgo result has Go pointer" diff --git a/hack/go1_7_2/runtime/cgocheck.go b/hack/go1_7_2/runtime/cgocheck.go new file mode 100644 index 0000000..742035c --- /dev/null +++ b/hack/go1_7_2/runtime/cgocheck.go @@ -0,0 +1,10 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code to check that pointer writes follow the cgo rules. +// These functions are invoked via the write barrier when debug.cgocheck > 1. + +package runtime + +const cgoWriteBarrierFail = "Go pointer stored into non-Go memory" diff --git a/hack/go1_7_2/runtime/chan.go b/hack/go1_7_2/runtime/chan.go new file mode 100644 index 0000000..f116158 --- /dev/null +++ b/hack/go1_7_2/runtime/chan.go @@ -0,0 +1,35 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +const ( + maxAlign = 8 + hchanSize = unsafe.Sizeof(hchan{}) + uintptr(-int(unsafe.Sizeof(hchan{}))&(maxAlign-1)) + debugChan = false +) + +type hchan struct { + qcount uint + dataqsiz uint + buf unsafe.Pointer + elemsize uint16 + closed uint32 + elemtype *_type + sendx uint + recvx uint + recvq waitq + sendq waitq + + lock mutex +} + +type waitq struct { + first *sudog + last *sudog +} diff --git a/hack/go1_7_2/runtime/compiler.go b/hack/go1_7_2/runtime/compiler.go new file mode 100644 index 0000000..1ebc62d --- /dev/null +++ b/hack/go1_7_2/runtime/compiler.go @@ -0,0 +1,13 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +// Compiler is the name of the compiler toolchain that built the +// running binary. Known toolchains are: +// +// gc Also known as cmd/compile. +// gccgo The gccgo front end, part of the GCC compiler suite. +// +const Compiler = "gc" diff --git a/hack/go1_7_2/runtime/cpuprof.go b/hack/go1_7_2/runtime/cpuprof.go new file mode 100644 index 0000000..3aa254a --- /dev/null +++ b/hack/go1_7_2/runtime/cpuprof.go @@ -0,0 +1,86 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// CPU profiling. +// Based on algorithms and data structures used in +// http://code.google.com/p/google-perftools/. +// +// The main difference between this code and the google-perftools +// code is that this code is written to allow copying the profile data +// to an arbitrary io.Writer, while the google-perftools code always +// writes to an operating system file. +// +// The signal handler for the profiling clock tick adds a new stack trace +// to a hash table tracking counts for recent traces. Most clock ticks +// hit in the cache. In the event of a cache miss, an entry must be +// evicted from the hash table, copied to a log that will eventually be +// written as profile data. The google-perftools code flushed the +// log itself during the signal handler. This code cannot do that, because +// the io.Writer might block or need system calls or locks that are not +// safe to use from within the signal handler. Instead, we split the log +// into two halves and let the signal handler fill one half while a goroutine +// is writing out the other half. When the signal handler fills its half, it +// offers to swap with the goroutine. If the writer is not done with its half, +// we lose the stack trace for this clock tick (and record that loss). +// The goroutine interacts with the signal handler by calling getprofile() to +// get the next log piece to write, implicitly handing back the last log +// piece it obtained. +// +// The state of this dance between the signal handler and the goroutine +// is encoded in the Profile.handoff field. If handoff == 0, then the goroutine +// is not using either log half and is waiting (or will soon be waiting) for +// a new piece by calling notesleep(&p.wait). If the signal handler +// changes handoff from 0 to non-zero, it must call notewakeup(&p.wait) +// to wake the goroutine. The value indicates the number of entries in the +// log half being handed off. The goroutine leaves the non-zero value in +// place until it has finished processing the log half and then flips the number +// back to zero. Setting the high bit in handoff means that the profiling is over, +// and the goroutine is now in charge of flushing the data left in the hash table +// to the log and returning that data. +// +// The handoff field is manipulated using atomic operations. +// For the most part, the manipulation of handoff is orderly: if handoff == 0 +// then the signal handler owns it and can change it to non-zero. +// If handoff != 0 then the goroutine owns it and can change it to zero. +// If that were the end of the story then we would not need to manipulate +// handoff using atomic operations. The operations are needed, however, +// in order to let the log closer set the high bit to indicate "EOF" safely +// in the situation when normally the goroutine "owns" handoff. + +package runtime + +const ( + numBuckets = 1 << 10 + logSize = 1 << 17 + assoc = 4 + maxCPUProfStack = 64 +) + +type cpuprofEntry struct { + count uintptr + depth int + stack [maxCPUProfStack]uintptr +} + +type cpuProfile struct { + on bool + wait note + count uintptr + evicts uintptr + lost uintptr + + hash [numBuckets]struct { + entry [assoc]cpuprofEntry + } + + log [2][logSize / 2]uintptr + nlog int + toggle int32 + handoff uint32 + + wtoggle uint32 + wholding bool + flushing bool + eodSent bool +} diff --git a/hack/go1_7_2/runtime/defs1_netbsd_386.go b/hack/go1_7_2/runtime/defs1_netbsd_386.go new file mode 100644 index 0000000..9ce0fa6 --- /dev/null +++ b/hack/go1_7_2/runtime/defs1_netbsd_386.go @@ -0,0 +1,168 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_netbsd.go defs_netbsd_386.go + +package runtime + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x6 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0 + _EV_ERROR = 0x4000 + _EVFILT_READ = 0x0 + _EVFILT_WRITE = 0x1 +) + +type sigaltstackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type sigset struct { + __bits [4]uint32 +} + +type siginfo struct { + _signo int32 + _code int32 + _errno int32 + _reason [20]byte +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type timespec struct { + tv_sec int64 + tv_nsec int32 +} + +type timeval struct { + tv_sec int64 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type mcontextt struct { + __gregs [19]uint32 + __fpregs [644]byte + _mc_tlsbase int32 +} + +type ucontextt struct { + uc_flags uint32 + uc_link *ucontextt + uc_sigmask sigset + uc_stack stackt + uc_mcontext mcontextt + __uc_pad [4]int32 +} + +type keventt struct { + ident uint32 + filter uint32 + flags uint32 + fflags uint32 + data int64 + udata *byte +} + +const ( + _REG_GS = 0x0 + _REG_FS = 0x1 + _REG_ES = 0x2 + _REG_DS = 0x3 + _REG_EDI = 0x4 + _REG_ESI = 0x5 + _REG_EBP = 0x6 + _REG_ESP = 0x7 + _REG_EBX = 0x8 + _REG_EDX = 0x9 + _REG_ECX = 0xa + _REG_EAX = 0xb + _REG_TRAPNO = 0xc + _REG_ERR = 0xd + _REG_EIP = 0xe + _REG_CS = 0xf + _REG_EFL = 0x10 + _REG_UESP = 0x11 + _REG_SS = 0x12 +) diff --git a/hack/go1_7_2/runtime/defs1_netbsd_amd64.go b/hack/go1_7_2/runtime/defs1_netbsd_amd64.go new file mode 100644 index 0000000..7eeea83 --- /dev/null +++ b/hack/go1_7_2/runtime/defs1_netbsd_amd64.go @@ -0,0 +1,180 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_netbsd.go defs_netbsd_amd64.go + +package runtime + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x6 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0 + _EV_ERROR = 0x4000 + _EVFILT_READ = 0x0 + _EVFILT_WRITE = 0x1 +) + +type sigaltstackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type sigset struct { + __bits [4]uint32 +} + +type siginfo struct { + _signo int32 + _code int32 + _errno int32 + _pad int32 + _reason [24]byte +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int32 + pad_cgo_0 [4]byte +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type mcontextt struct { + __gregs [26]uint64 + _mc_tlsbase uint64 + __fpregs [512]int8 +} + +type ucontextt struct { + uc_flags uint32 + pad_cgo_0 [4]byte + uc_link *ucontextt + uc_sigmask sigset + uc_stack stackt + uc_mcontext mcontextt +} + +type keventt struct { + ident uint64 + filter uint32 + flags uint32 + fflags uint32 + pad_cgo_0 [4]byte + data int64 + udata *byte +} + +const ( + _REG_RDI = 0x0 + _REG_RSI = 0x1 + _REG_RDX = 0x2 + _REG_RCX = 0x3 + _REG_R8 = 0x4 + _REG_R9 = 0x5 + _REG_R10 = 0x6 + _REG_R11 = 0x7 + _REG_R12 = 0x8 + _REG_R13 = 0x9 + _REG_R14 = 0xa + _REG_R15 = 0xb + _REG_RBP = 0xc + _REG_RBX = 0xd + _REG_RAX = 0xe + _REG_GS = 0xf + _REG_FS = 0x10 + _REG_ES = 0x11 + _REG_DS = 0x12 + _REG_TRAPNO = 0x13 + _REG_ERR = 0x14 + _REG_RIP = 0x15 + _REG_CS = 0x16 + _REG_RFLAGS = 0x17 + _REG_RSP = 0x18 + _REG_SS = 0x19 +) diff --git a/hack/go1_7_2/runtime/defs1_netbsd_arm.go b/hack/go1_7_2/runtime/defs1_netbsd_arm.go new file mode 100644 index 0000000..543b080 --- /dev/null +++ b/hack/go1_7_2/runtime/defs1_netbsd_arm.go @@ -0,0 +1,168 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_netbsd.go defs_netbsd_arm.go + +package runtime + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x6 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0 + _EV_ERROR = 0x4000 + _EVFILT_READ = 0x0 + _EVFILT_WRITE = 0x1 +) + +type sigaltstackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type sigset struct { + __bits [4]uint32 +} + +type siginfo struct { + _signo int32 + _code int32 + _errno int32 + _reason uintptr + _reasonx [16]byte +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type timespec struct { + tv_sec int64 + tv_nsec int32 +} + +type timeval struct { + tv_sec int64 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type mcontextt struct { + __gregs [17]uint32 + __fpu [4 + 8*32 + 4]byte + + _mc_tlsbase uint32 +} + +type ucontextt struct { + uc_flags uint32 + uc_link *ucontextt + uc_sigmask sigset + uc_stack stackt + uc_mcontext mcontextt + __uc_pad [2]int32 +} + +type keventt struct { + ident uint32 + filter uint32 + flags uint32 + fflags uint32 + data int64 + udata *byte +} + +const ( + _REG_R0 = 0x0 + _REG_R1 = 0x1 + _REG_R2 = 0x2 + _REG_R3 = 0x3 + _REG_R4 = 0x4 + _REG_R5 = 0x5 + _REG_R6 = 0x6 + _REG_R7 = 0x7 + _REG_R8 = 0x8 + _REG_R9 = 0x9 + _REG_R10 = 0xa + _REG_R11 = 0xb + _REG_R12 = 0xc + _REG_R13 = 0xd + _REG_R14 = 0xe + _REG_R15 = 0xf + _REG_CPSR = 0x10 +) diff --git a/hack/go1_7_2/runtime/defs1_solaris_amd64.go b/hack/go1_7_2/runtime/defs1_solaris_amd64.go new file mode 100644 index 0000000..cd472a4 --- /dev/null +++ b/hack/go1_7_2/runtime/defs1_solaris_amd64.go @@ -0,0 +1,238 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_solaris.go defs_solaris_amd64.go + +package runtime + +const ( + _EINTR = 0x4 + _EBADF = 0x9 + _EFAULT = 0xe + _EAGAIN = 0xb + _ETIMEDOUT = 0x91 + _EWOULDBLOCK = 0xb + _EINPROGRESS = 0x96 + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x100 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x5 + + _SA_SIGINFO = 0x8 + _SA_RESTART = 0x4 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x15 + _SIGSTOP = 0x17 + _SIGTSTP = 0x18 + _SIGCONT = 0x19 + _SIGCHLD = 0x12 + _SIGTTIN = 0x1a + _SIGTTOU = 0x1b + _SIGIO = 0x16 + _SIGXCPU = 0x1e + _SIGXFSZ = 0x1f + _SIGVTALRM = 0x1c + _SIGPROF = 0x1d + _SIGWINCH = 0x14 + _SIGUSR1 = 0x10 + _SIGUSR2 = 0x11 + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + __SC_NPROCESSORS_ONLN = 0xf + + _PTHREAD_CREATE_DETACHED = 0x40 + + _FORK_NOSIGCHLD = 0x1 + _FORK_WAITPID = 0x2 + + _MAXHOSTNAMELEN = 0x100 + + _O_NONBLOCK = 0x80 + _FD_CLOEXEC = 0x1 + _F_GETFL = 0x3 + _F_SETFL = 0x4 + _F_SETFD = 0x2 + + _POLLIN = 0x1 + _POLLOUT = 0x4 + _POLLHUP = 0x10 + _POLLERR = 0x8 + + _PORT_SOURCE_FD = 0x4 +) + +type semt struct { + sem_count uint32 + sem_type uint16 + sem_magic uint16 + sem_pad1 [3]uint64 + sem_pad2 [2]uint64 +} + +type sigaltstackt struct { + ss_sp *byte + ss_size uint64 + ss_flags int32 + pad_cgo_0 [4]byte +} + +type sigset struct { + __sigbits [4]uint32 +} + +type stackt struct { + ss_sp *byte + ss_size uint64 + ss_flags int32 + pad_cgo_0 [4]byte +} + +type siginfo struct { + si_signo int32 + si_code int32 + si_errno int32 + si_pad int32 + __data [240]byte +} + +type sigactiont struct { + sa_flags int32 + pad_cgo_0 [4]byte + _funcptr [8]byte + sa_mask sigset +} + +type fpregset struct { + fp_reg_set [528]byte +} + +type mcontext struct { + gregs [28]int64 + fpregs fpregset +} + +type ucontext struct { + uc_flags uint64 + uc_link *ucontext + uc_sigmask sigset + uc_stack stackt + pad_cgo_0 [8]byte + uc_mcontext mcontext + uc_filler [5]int64 + pad_cgo_1 [8]byte +} + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type portevent struct { + portev_events int32 + portev_source uint16 + portev_pad uint16 + portev_object uint64 + portev_user *byte +} + +type pthread uint32 +type pthreadattr struct { + __pthread_attrp *byte +} + +type stat struct { + st_dev uint64 + st_ino uint64 + st_mode uint32 + st_nlink uint32 + st_uid uint32 + st_gid uint32 + st_rdev uint64 + st_size int64 + st_atim timespec + st_mtim timespec + st_ctim timespec + st_blksize int32 + pad_cgo_0 [4]byte + st_blocks int64 + st_fstype [16]int8 +} + +const ( + _REG_RDI = 0x8 + _REG_RSI = 0x9 + _REG_RDX = 0xc + _REG_RCX = 0xd + _REG_R8 = 0x7 + _REG_R9 = 0x6 + _REG_R10 = 0x5 + _REG_R11 = 0x4 + _REG_R12 = 0x3 + _REG_R13 = 0x2 + _REG_R14 = 0x1 + _REG_R15 = 0x0 + _REG_RBP = 0xa + _REG_RBX = 0xb + _REG_RAX = 0xe + _REG_GS = 0x17 + _REG_FS = 0x16 + _REG_ES = 0x18 + _REG_DS = 0x19 + _REG_TRAPNO = 0xf + _REG_ERR = 0x10 + _REG_RIP = 0x11 + _REG_CS = 0x12 + _REG_RFLAGS = 0x13 + _REG_RSP = 0x14 + _REG_SS = 0x15 +) diff --git a/hack/go1_7_2/runtime/defs_darwin_386.go b/hack/go1_7_2/runtime/defs_darwin_386.go new file mode 100644 index 0000000..4387a6d --- /dev/null +++ b/hack/go1_7_2/runtime/defs_darwin_386.go @@ -0,0 +1,384 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_darwin.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_FREE = 0x5 + + _MACH_MSG_TYPE_MOVE_RECEIVE = 0x10 + _MACH_MSG_TYPE_MOVE_SEND = 0x11 + _MACH_MSG_TYPE_MOVE_SEND_ONCE = 0x12 + _MACH_MSG_TYPE_COPY_SEND = 0x13 + _MACH_MSG_TYPE_MAKE_SEND = 0x14 + _MACH_MSG_TYPE_MAKE_SEND_ONCE = 0x15 + _MACH_MSG_TYPE_COPY_RECEIVE = 0x16 + + _MACH_MSG_PORT_DESCRIPTOR = 0x0 + _MACH_MSG_OOL_DESCRIPTOR = 0x1 + _MACH_MSG_OOL_PORTS_DESCRIPTOR = 0x2 + _MACH_MSG_OOL_VOLATILE_DESCRIPTOR = 0x3 + + _MACH_MSGH_BITS_COMPLEX = 0x80000000 + + _MACH_SEND_MSG = 0x1 + _MACH_RCV_MSG = 0x2 + _MACH_RCV_LARGE = 0x4 + + _MACH_SEND_TIMEOUT = 0x10 + _MACH_SEND_INTERRUPT = 0x40 + _MACH_SEND_ALWAYS = 0x10000 + _MACH_SEND_TRAILER = 0x20000 + _MACH_RCV_TIMEOUT = 0x100 + _MACH_RCV_NOTIFY = 0x200 + _MACH_RCV_INTERRUPT = 0x400 + _MACH_RCV_OVERWRITE = 0x1000 + + _NDR_PROTOCOL_2_0 = 0x0 + _NDR_INT_BIG_ENDIAN = 0x0 + _NDR_INT_LITTLE_ENDIAN = 0x1 + _NDR_FLOAT_IEEE = 0x0 + _NDR_CHAR_ASCII = 0x0 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + _SA_USERTRAMP = 0x100 + _SA_64REGSET = 0x200 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x7 + _FPE_INTOVF = 0x8 + _FPE_FLTDIV = 0x1 + _FPE_FLTOVF = 0x2 + _FPE_FLTUND = 0x3 + _FPE_FLTRES = 0x4 + _FPE_FLTINV = 0x5 + _FPE_FLTSUB = 0x6 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0x40 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type machbody struct { + msgh_descriptor_count uint32 +} + +type machheader struct { + msgh_bits uint32 + msgh_size uint32 + msgh_remote_port uint32 + msgh_local_port uint32 + msgh_reserved uint32 + msgh_id int32 +} + +type machndr struct { + mig_vers uint8 + if_vers uint8 + reserved1 uint8 + mig_encoding uint8 + int_rep uint8 + char_rep uint8 + float_rep uint8 + reserved2 uint8 +} + +type machport struct { + name uint32 + pad1 uint32 + pad2 uint16 + disposition uint8 + _type uint8 +} + +type stackt struct { + ss_sp *byte + ss_size uintptr + ss_flags int32 +} + +type sigactiont struct { + __sigaction_u [4]byte + sa_tramp unsafe.Pointer + sa_mask uint32 + sa_flags int32 +} + +type usigactiont struct { + __sigaction_u [4]byte + sa_mask uint32 + sa_flags int32 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr uint32 + si_value [4]byte + si_band int32 + __pad [7]uint32 +} + +type timeval struct { + tv_sec int32 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type timespec struct { + tv_sec int32 + tv_nsec int32 +} + +type fpcontrol struct { + pad_cgo_0 [2]byte +} + +type fpstatus struct { + pad_cgo_0 [2]byte +} + +type regmmst struct { + mmst_reg [10]int8 + mmst_rsrv [6]int8 +} + +type regxmm struct { + xmm_reg [16]int8 +} + +type regs64 struct { + rax uint64 + rbx uint64 + rcx uint64 + rdx uint64 + rdi uint64 + rsi uint64 + rbp uint64 + rsp uint64 + r8 uint64 + r9 uint64 + r10 uint64 + r11 uint64 + r12 uint64 + r13 uint64 + r14 uint64 + r15 uint64 + rip uint64 + rflags uint64 + cs uint64 + fs uint64 + gs uint64 +} + +type floatstate64 struct { + fpu_reserved [2]int32 + fpu_fcw fpcontrol + fpu_fsw fpstatus + fpu_ftw uint8 + fpu_rsrv1 uint8 + fpu_fop uint16 + fpu_ip uint32 + fpu_cs uint16 + fpu_rsrv2 uint16 + fpu_dp uint32 + fpu_ds uint16 + fpu_rsrv3 uint16 + fpu_mxcsr uint32 + fpu_mxcsrmask uint32 + fpu_stmm0 regmmst + fpu_stmm1 regmmst + fpu_stmm2 regmmst + fpu_stmm3 regmmst + fpu_stmm4 regmmst + fpu_stmm5 regmmst + fpu_stmm6 regmmst + fpu_stmm7 regmmst + fpu_xmm0 regxmm + fpu_xmm1 regxmm + fpu_xmm2 regxmm + fpu_xmm3 regxmm + fpu_xmm4 regxmm + fpu_xmm5 regxmm + fpu_xmm6 regxmm + fpu_xmm7 regxmm + fpu_xmm8 regxmm + fpu_xmm9 regxmm + fpu_xmm10 regxmm + fpu_xmm11 regxmm + fpu_xmm12 regxmm + fpu_xmm13 regxmm + fpu_xmm14 regxmm + fpu_xmm15 regxmm + fpu_rsrv4 [96]int8 + fpu_reserved1 int32 +} + +type exceptionstate64 struct { + trapno uint16 + cpu uint16 + err uint32 + faultvaddr uint64 +} + +type mcontext64 struct { + es exceptionstate64 + ss regs64 + fs floatstate64 +} + +type regs32 struct { + eax uint32 + ebx uint32 + ecx uint32 + edx uint32 + edi uint32 + esi uint32 + ebp uint32 + esp uint32 + ss uint32 + eflags uint32 + eip uint32 + cs uint32 + ds uint32 + es uint32 + fs uint32 + gs uint32 +} + +type floatstate32 struct { + fpu_reserved [2]int32 + fpu_fcw fpcontrol + fpu_fsw fpstatus + fpu_ftw uint8 + fpu_rsrv1 uint8 + fpu_fop uint16 + fpu_ip uint32 + fpu_cs uint16 + fpu_rsrv2 uint16 + fpu_dp uint32 + fpu_ds uint16 + fpu_rsrv3 uint16 + fpu_mxcsr uint32 + fpu_mxcsrmask uint32 + fpu_stmm0 regmmst + fpu_stmm1 regmmst + fpu_stmm2 regmmst + fpu_stmm3 regmmst + fpu_stmm4 regmmst + fpu_stmm5 regmmst + fpu_stmm6 regmmst + fpu_stmm7 regmmst + fpu_xmm0 regxmm + fpu_xmm1 regxmm + fpu_xmm2 regxmm + fpu_xmm3 regxmm + fpu_xmm4 regxmm + fpu_xmm5 regxmm + fpu_xmm6 regxmm + fpu_xmm7 regxmm + fpu_rsrv4 [224]int8 + fpu_reserved1 int32 +} + +type exceptionstate32 struct { + trapno uint16 + cpu uint16 + err uint32 + faultvaddr uint32 +} + +type mcontext32 struct { + es exceptionstate32 + ss regs32 + fs floatstate32 +} + +type ucontext struct { + uc_onstack int32 + uc_sigmask uint32 + uc_stack stackt + uc_link *ucontext + uc_mcsize uint32 + uc_mcontext *mcontext32 +} + +type keventt struct { + ident uint32 + filter int16 + flags uint16 + fflags uint32 + data int32 + udata *byte +} diff --git a/hack/go1_7_2/runtime/defs_darwin_amd64.go b/hack/go1_7_2/runtime/defs_darwin_amd64.go new file mode 100644 index 0000000..519a1ae --- /dev/null +++ b/hack/go1_7_2/runtime/defs_darwin_amd64.go @@ -0,0 +1,387 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_darwin.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_FREE = 0x5 + + _MACH_MSG_TYPE_MOVE_RECEIVE = 0x10 + _MACH_MSG_TYPE_MOVE_SEND = 0x11 + _MACH_MSG_TYPE_MOVE_SEND_ONCE = 0x12 + _MACH_MSG_TYPE_COPY_SEND = 0x13 + _MACH_MSG_TYPE_MAKE_SEND = 0x14 + _MACH_MSG_TYPE_MAKE_SEND_ONCE = 0x15 + _MACH_MSG_TYPE_COPY_RECEIVE = 0x16 + + _MACH_MSG_PORT_DESCRIPTOR = 0x0 + _MACH_MSG_OOL_DESCRIPTOR = 0x1 + _MACH_MSG_OOL_PORTS_DESCRIPTOR = 0x2 + _MACH_MSG_OOL_VOLATILE_DESCRIPTOR = 0x3 + + _MACH_MSGH_BITS_COMPLEX = 0x80000000 + + _MACH_SEND_MSG = 0x1 + _MACH_RCV_MSG = 0x2 + _MACH_RCV_LARGE = 0x4 + + _MACH_SEND_TIMEOUT = 0x10 + _MACH_SEND_INTERRUPT = 0x40 + _MACH_SEND_ALWAYS = 0x10000 + _MACH_SEND_TRAILER = 0x20000 + _MACH_RCV_TIMEOUT = 0x100 + _MACH_RCV_NOTIFY = 0x200 + _MACH_RCV_INTERRUPT = 0x400 + _MACH_RCV_OVERWRITE = 0x1000 + + _NDR_PROTOCOL_2_0 = 0x0 + _NDR_INT_BIG_ENDIAN = 0x0 + _NDR_INT_LITTLE_ENDIAN = 0x1 + _NDR_FLOAT_IEEE = 0x0 + _NDR_CHAR_ASCII = 0x0 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + _SA_USERTRAMP = 0x100 + _SA_64REGSET = 0x200 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x7 + _FPE_INTOVF = 0x8 + _FPE_FLTDIV = 0x1 + _FPE_FLTOVF = 0x2 + _FPE_FLTUND = 0x3 + _FPE_FLTRES = 0x4 + _FPE_FLTINV = 0x5 + _FPE_FLTSUB = 0x6 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0x40 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type machbody struct { + msgh_descriptor_count uint32 +} + +type machheader struct { + msgh_bits uint32 + msgh_size uint32 + msgh_remote_port uint32 + msgh_local_port uint32 + msgh_reserved uint32 + msgh_id int32 +} + +type machndr struct { + mig_vers uint8 + if_vers uint8 + reserved1 uint8 + mig_encoding uint8 + int_rep uint8 + char_rep uint8 + float_rep uint8 + reserved2 uint8 +} + +type machport struct { + name uint32 + pad1 uint32 + pad2 uint16 + disposition uint8 + _type uint8 +} + +type stackt struct { + ss_sp *byte + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type sigactiont struct { + __sigaction_u [8]byte + sa_tramp unsafe.Pointer + sa_mask uint32 + sa_flags int32 +} + +type usigactiont struct { + __sigaction_u [8]byte + sa_mask uint32 + sa_flags int32 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr uint64 + si_value [8]byte + si_band int64 + __pad [7]uint64 +} + +type timeval struct { + tv_sec int64 + tv_usec int32 + pad_cgo_0 [4]byte +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type fpcontrol struct { + pad_cgo_0 [2]byte +} + +type fpstatus struct { + pad_cgo_0 [2]byte +} + +type regmmst struct { + mmst_reg [10]int8 + mmst_rsrv [6]int8 +} + +type regxmm struct { + xmm_reg [16]int8 +} + +type regs64 struct { + rax uint64 + rbx uint64 + rcx uint64 + rdx uint64 + rdi uint64 + rsi uint64 + rbp uint64 + rsp uint64 + r8 uint64 + r9 uint64 + r10 uint64 + r11 uint64 + r12 uint64 + r13 uint64 + r14 uint64 + r15 uint64 + rip uint64 + rflags uint64 + cs uint64 + fs uint64 + gs uint64 +} + +type floatstate64 struct { + fpu_reserved [2]int32 + fpu_fcw fpcontrol + fpu_fsw fpstatus + fpu_ftw uint8 + fpu_rsrv1 uint8 + fpu_fop uint16 + fpu_ip uint32 + fpu_cs uint16 + fpu_rsrv2 uint16 + fpu_dp uint32 + fpu_ds uint16 + fpu_rsrv3 uint16 + fpu_mxcsr uint32 + fpu_mxcsrmask uint32 + fpu_stmm0 regmmst + fpu_stmm1 regmmst + fpu_stmm2 regmmst + fpu_stmm3 regmmst + fpu_stmm4 regmmst + fpu_stmm5 regmmst + fpu_stmm6 regmmst + fpu_stmm7 regmmst + fpu_xmm0 regxmm + fpu_xmm1 regxmm + fpu_xmm2 regxmm + fpu_xmm3 regxmm + fpu_xmm4 regxmm + fpu_xmm5 regxmm + fpu_xmm6 regxmm + fpu_xmm7 regxmm + fpu_xmm8 regxmm + fpu_xmm9 regxmm + fpu_xmm10 regxmm + fpu_xmm11 regxmm + fpu_xmm12 regxmm + fpu_xmm13 regxmm + fpu_xmm14 regxmm + fpu_xmm15 regxmm + fpu_rsrv4 [96]int8 + fpu_reserved1 int32 +} + +type exceptionstate64 struct { + trapno uint16 + cpu uint16 + err uint32 + faultvaddr uint64 +} + +type mcontext64 struct { + es exceptionstate64 + ss regs64 + fs floatstate64 + pad_cgo_0 [4]byte +} + +type regs32 struct { + eax uint32 + ebx uint32 + ecx uint32 + edx uint32 + edi uint32 + esi uint32 + ebp uint32 + esp uint32 + ss uint32 + eflags uint32 + eip uint32 + cs uint32 + ds uint32 + es uint32 + fs uint32 + gs uint32 +} + +type floatstate32 struct { + fpu_reserved [2]int32 + fpu_fcw fpcontrol + fpu_fsw fpstatus + fpu_ftw uint8 + fpu_rsrv1 uint8 + fpu_fop uint16 + fpu_ip uint32 + fpu_cs uint16 + fpu_rsrv2 uint16 + fpu_dp uint32 + fpu_ds uint16 + fpu_rsrv3 uint16 + fpu_mxcsr uint32 + fpu_mxcsrmask uint32 + fpu_stmm0 regmmst + fpu_stmm1 regmmst + fpu_stmm2 regmmst + fpu_stmm3 regmmst + fpu_stmm4 regmmst + fpu_stmm5 regmmst + fpu_stmm6 regmmst + fpu_stmm7 regmmst + fpu_xmm0 regxmm + fpu_xmm1 regxmm + fpu_xmm2 regxmm + fpu_xmm3 regxmm + fpu_xmm4 regxmm + fpu_xmm5 regxmm + fpu_xmm6 regxmm + fpu_xmm7 regxmm + fpu_rsrv4 [224]int8 + fpu_reserved1 int32 +} + +type exceptionstate32 struct { + trapno uint16 + cpu uint16 + err uint32 + faultvaddr uint32 +} + +type mcontext32 struct { + es exceptionstate32 + ss regs32 + fs floatstate32 +} + +type ucontext struct { + uc_onstack int32 + uc_sigmask uint32 + uc_stack stackt + uc_link *ucontext + uc_mcsize uint64 + uc_mcontext *mcontext64 +} + +type keventt struct { + ident uint64 + filter int16 + flags uint16 + fflags uint32 + data int64 + udata *byte +} diff --git a/hack/go1_7_2/runtime/defs_darwin_arm.go b/hack/go1_7_2/runtime/defs_darwin_arm.go new file mode 100644 index 0000000..2c9f638 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_darwin_arm.go @@ -0,0 +1,247 @@ +// Note: cgo can't handle some Darwin/ARM structures, so this file can't +// be auto generated by cgo yet. +// Created based on output of `cgo -cdefs defs_darwin.go` and Darwin/ARM +// specific header (mainly mcontext and ucontext related stuff) + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_FREE = 0x5 + + _MACH_MSG_TYPE_MOVE_RECEIVE = 0x10 + _MACH_MSG_TYPE_MOVE_SEND = 0x11 + _MACH_MSG_TYPE_MOVE_SEND_ONCE = 0x12 + _MACH_MSG_TYPE_COPY_SEND = 0x13 + _MACH_MSG_TYPE_MAKE_SEND = 0x14 + _MACH_MSG_TYPE_MAKE_SEND_ONCE = 0x15 + _MACH_MSG_TYPE_COPY_RECEIVE = 0x16 + + _MACH_MSG_PORT_DESCRIPTOR = 0x0 + _MACH_MSG_OOL_DESCRIPTOR = 0x1 + _MACH_MSG_OOL_PORTS_DESCRIPTOR = 0x2 + _MACH_MSG_OOL_VOLATILE_DESCRIPTOR = 0x3 + + _MACH_MSGH_BITS_COMPLEX = 0x80000000 + + _MACH_SEND_MSG = 0x1 + _MACH_RCV_MSG = 0x2 + _MACH_RCV_LARGE = 0x4 + + _MACH_SEND_TIMEOUT = 0x10 + _MACH_SEND_INTERRUPT = 0x40 + _MACH_SEND_ALWAYS = 0x10000 + _MACH_SEND_TRAILER = 0x20000 + _MACH_RCV_TIMEOUT = 0x100 + _MACH_RCV_NOTIFY = 0x200 + _MACH_RCV_INTERRUPT = 0x400 + _MACH_RCV_OVERWRITE = 0x1000 + + _NDR_PROTOCOL_2_0 = 0x0 + _NDR_INT_BIG_ENDIAN = 0x0 + _NDR_INT_LITTLE_ENDIAN = 0x1 + _NDR_FLOAT_IEEE = 0x0 + _NDR_CHAR_ASCII = 0x0 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + _SA_USERTRAMP = 0x100 + _SA_64REGSET = 0x200 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x7 + _FPE_INTOVF = 0x8 + _FPE_FLTDIV = 0x1 + _FPE_FLTOVF = 0x2 + _FPE_FLTUND = 0x3 + _FPE_FLTRES = 0x4 + _FPE_FLTINV = 0x5 + _FPE_FLTSUB = 0x6 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0x40 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type machbody struct { + msgh_descriptor_count uint32 +} + +type machheader struct { + msgh_bits uint32 + msgh_size uint32 + msgh_remote_port uint32 + msgh_local_port uint32 + msgh_reserved uint32 + msgh_id int32 +} + +type machndr struct { + mig_vers uint8 + if_vers uint8 + reserved1 uint8 + mig_encoding uint8 + int_rep uint8 + char_rep uint8 + float_rep uint8 + reserved2 uint8 +} + +type machport struct { + name uint32 + pad1 uint32 + pad2 uint16 + disposition uint8 + _type uint8 +} + +type stackt struct { + ss_sp *byte + ss_size uintptr + ss_flags int32 +} + +type sigactiont struct { + __sigaction_u [4]byte + sa_tramp unsafe.Pointer + sa_mask uint32 + sa_flags int32 +} + +type usigactiont struct { + __sigaction_u [4]byte + sa_mask uint32 + sa_flags int32 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr uint32 + si_value [4]byte + si_band int32 + __pad [7]uint32 +} + +type timeval struct { + tv_sec int32 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type timespec struct { + tv_sec int32 + tv_nsec int32 +} + +type floatstate32 struct { + r [32]uint32 + fpscr uint32 +} + +type regs32 struct { + r [13]uint32 + sp uint32 + lr uint32 + pc uint32 + cpsr uint32 +} + +type exceptionstate32 struct { + trapno uint32 + err uint32 + faultvaddr uint32 +} + +type mcontext32 struct { + es exceptionstate32 + ss regs32 + fs floatstate32 +} + +type ucontext struct { + uc_onstack int32 + uc_sigmask uint32 + uc_stack stackt + uc_link *ucontext + uc_mcsize uint32 + uc_mcontext *mcontext32 +} + +type keventt struct { + ident uint32 + filter int16 + flags uint16 + fflags uint32 + data int32 + udata *byte +} diff --git a/hack/go1_7_2/runtime/defs_darwin_arm64.go b/hack/go1_7_2/runtime/defs_darwin_arm64.go new file mode 100644 index 0000000..58472ff --- /dev/null +++ b/hack/go1_7_2/runtime/defs_darwin_arm64.go @@ -0,0 +1,250 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_darwin.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_FREE = 0x5 + + _MACH_MSG_TYPE_MOVE_RECEIVE = 0x10 + _MACH_MSG_TYPE_MOVE_SEND = 0x11 + _MACH_MSG_TYPE_MOVE_SEND_ONCE = 0x12 + _MACH_MSG_TYPE_COPY_SEND = 0x13 + _MACH_MSG_TYPE_MAKE_SEND = 0x14 + _MACH_MSG_TYPE_MAKE_SEND_ONCE = 0x15 + _MACH_MSG_TYPE_COPY_RECEIVE = 0x16 + + _MACH_MSG_PORT_DESCRIPTOR = 0x0 + _MACH_MSG_OOL_DESCRIPTOR = 0x1 + _MACH_MSG_OOL_PORTS_DESCRIPTOR = 0x2 + _MACH_MSG_OOL_VOLATILE_DESCRIPTOR = 0x3 + + _MACH_MSGH_BITS_COMPLEX = 0x80000000 + + _MACH_SEND_MSG = 0x1 + _MACH_RCV_MSG = 0x2 + _MACH_RCV_LARGE = 0x4 + + _MACH_SEND_TIMEOUT = 0x10 + _MACH_SEND_INTERRUPT = 0x40 + _MACH_SEND_ALWAYS = 0x10000 + _MACH_SEND_TRAILER = 0x20000 + _MACH_RCV_TIMEOUT = 0x100 + _MACH_RCV_NOTIFY = 0x200 + _MACH_RCV_INTERRUPT = 0x400 + _MACH_RCV_OVERWRITE = 0x1000 + + _NDR_PROTOCOL_2_0 = 0x0 + _NDR_INT_BIG_ENDIAN = 0x0 + _NDR_INT_LITTLE_ENDIAN = 0x1 + _NDR_FLOAT_IEEE = 0x0 + _NDR_CHAR_ASCII = 0x0 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + _SA_USERTRAMP = 0x100 + _SA_64REGSET = 0x200 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x7 + _FPE_INTOVF = 0x8 + _FPE_FLTDIV = 0x1 + _FPE_FLTOVF = 0x2 + _FPE_FLTUND = 0x3 + _FPE_FLTRES = 0x4 + _FPE_FLTINV = 0x5 + _FPE_FLTSUB = 0x6 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0x40 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type machbody struct { + msgh_descriptor_count uint32 +} + +type machheader struct { + msgh_bits uint32 + msgh_size uint32 + msgh_remote_port uint32 + msgh_local_port uint32 + msgh_reserved uint32 + msgh_id int32 +} + +type machndr struct { + mig_vers uint8 + if_vers uint8 + reserved1 uint8 + mig_encoding uint8 + int_rep uint8 + char_rep uint8 + float_rep uint8 + reserved2 uint8 +} + +type machport struct { + name uint32 + pad1 uint32 + pad2 uint16 + disposition uint8 + _type uint8 +} + +type stackt struct { + ss_sp *byte + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type sigactiont struct { + __sigaction_u [8]byte + sa_tramp unsafe.Pointer + sa_mask uint32 + sa_flags int32 +} + +type usigactiont struct { + __sigaction_u [8]byte + sa_mask uint32 + sa_flags int32 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr *byte + si_value [8]byte + si_band int64 + __pad [7]uint64 +} + +type timeval struct { + tv_sec int64 + tv_usec int32 + pad_cgo_0 [4]byte +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type exceptionstate64 struct { + far uint64 + esr uint32 + exc uint32 +} + +type regs64 struct { + x [29]uint64 + fp uint64 + lr uint64 + sp uint64 + pc uint64 + cpsr uint32 + __pad uint32 +} + +type neonstate64 struct { + v [64]uint64 + fpsr uint32 + fpcr uint32 +} + +type mcontext64 struct { + es exceptionstate64 + ss regs64 + ns neonstate64 +} + +type ucontext struct { + uc_onstack int32 + uc_sigmask uint32 + uc_stack stackt + uc_link *ucontext + uc_mcsize uint64 + uc_mcontext *mcontext64 +} + +type keventt struct { + ident uint64 + filter int16 + flags uint16 + fflags uint32 + data int64 + udata *byte +} diff --git a/hack/go1_7_2/runtime/defs_dragonfly_amd64.go b/hack/go1_7_2/runtime/defs_dragonfly_amd64.go new file mode 100644 index 0000000..850a1a9 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_dragonfly_amd64.go @@ -0,0 +1,200 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_dragonfly.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + _EBUSY = 0x10 + _EAGAIN = 0x23 + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x5 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x2 + _FPE_INTOVF = 0x1 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type rtprio struct { + _type uint16 + prio uint16 +} + +type lwpparams struct { + start_func uintptr + arg unsafe.Pointer + stack uintptr + tid1 unsafe.Pointer + tid2 unsafe.Pointer +} + +type sigaltstackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type sigset struct { + __bits [4]uint32 +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr uint64 + si_value [8]byte + si_band int64 + __spare__ [7]int32 + pad_cgo_0 [4]byte +} + +type mcontext struct { + mc_onstack uint64 + mc_rdi uint64 + mc_rsi uint64 + mc_rdx uint64 + mc_rcx uint64 + mc_r8 uint64 + mc_r9 uint64 + mc_rax uint64 + mc_rbx uint64 + mc_rbp uint64 + mc_r10 uint64 + mc_r11 uint64 + mc_r12 uint64 + mc_r13 uint64 + mc_r14 uint64 + mc_r15 uint64 + mc_xflags uint64 + mc_trapno uint64 + mc_addr uint64 + mc_flags uint64 + mc_err uint64 + mc_rip uint64 + mc_cs uint64 + mc_rflags uint64 + mc_rsp uint64 + mc_ss uint64 + mc_len uint32 + mc_fpformat uint32 + mc_ownedfp uint32 + mc_reserved uint32 + mc_unused [8]uint32 + mc_fpregs [256]int32 +} + +type ucontext struct { + uc_sigmask sigset + pad_cgo_0 [48]byte + uc_mcontext mcontext + uc_link *ucontext + uc_stack stackt + __spare__ [8]int32 +} + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type keventt struct { + ident uint64 + filter int16 + flags uint16 + fflags uint32 + data int64 + udata *byte +} diff --git a/hack/go1_7_2/runtime/defs_freebsd_386.go b/hack/go1_7_2/runtime/defs_freebsd_386.go new file mode 100644 index 0000000..385bb08 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_freebsd_386.go @@ -0,0 +1,213 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_freebsd.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x5 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _CLOCK_MONOTONIC = 0x4 + + _UMTX_OP_WAIT_UINT = 0xb + _UMTX_OP_WAIT_UINT_PRIVATE = 0xf + _UMTX_OP_WAKE = 0x3 + _UMTX_OP_WAKE_PRIVATE = 0x10 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x2 + _FPE_INTOVF = 0x1 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0x40 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type rtprio struct { + _type uint16 + prio uint16 +} + +type thrparam struct { + start_func uintptr + arg unsafe.Pointer + stack_base uintptr + stack_size uintptr + tls_base unsafe.Pointer + tls_size uintptr + child_tid unsafe.Pointer + parent_tid *int32 + flags int32 + rtp *rtprio + spare [3]uintptr +} + +type sigaltstackt struct { + ss_sp *int8 + ss_size uint32 + ss_flags int32 +} + +type sigset struct { + __bits [4]uint32 +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr uintptr + si_value [4]byte + _reason [32]byte +} + +type mcontext struct { + mc_onstack uint32 + mc_gs uint32 + mc_fs uint32 + mc_es uint32 + mc_ds uint32 + mc_edi uint32 + mc_esi uint32 + mc_ebp uint32 + mc_isp uint32 + mc_ebx uint32 + mc_edx uint32 + mc_ecx uint32 + mc_eax uint32 + mc_trapno uint32 + mc_err uint32 + mc_eip uint32 + mc_cs uint32 + mc_eflags uint32 + mc_esp uint32 + mc_ss uint32 + mc_len uint32 + mc_fpformat uint32 + mc_ownedfp uint32 + mc_flags uint32 + mc_fpstate [128]uint32 + mc_fsbase uint32 + mc_gsbase uint32 + mc_xfpustate uint32 + mc_xfpustate_len uint32 + mc_spare2 [4]uint32 +} + +type ucontext struct { + uc_sigmask sigset + uc_mcontext mcontext + uc_link *ucontext + uc_stack stackt + uc_flags int32 + __spare__ [4]int32 + pad_cgo_0 [12]byte +} + +type timespec struct { + tv_sec int32 + tv_nsec int32 +} + +type timeval struct { + tv_sec int32 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type umtx_time struct { + _timeout timespec + _flags uint32 + _clockid uint32 +} + +type keventt struct { + ident uint32 + filter int16 + flags uint16 + fflags uint32 + data int32 + udata *byte +} diff --git a/hack/go1_7_2/runtime/defs_freebsd_amd64.go b/hack/go1_7_2/runtime/defs_freebsd_amd64.go new file mode 100644 index 0000000..cb0484d --- /dev/null +++ b/hack/go1_7_2/runtime/defs_freebsd_amd64.go @@ -0,0 +1,224 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_freebsd.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x5 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _CLOCK_MONOTONIC = 0x4 + + _UMTX_OP_WAIT_UINT = 0xb + _UMTX_OP_WAIT_UINT_PRIVATE = 0xf + _UMTX_OP_WAKE = 0x3 + _UMTX_OP_WAKE_PRIVATE = 0x10 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x2 + _FPE_INTOVF = 0x1 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0x40 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type rtprio struct { + _type uint16 + prio uint16 +} + +type thrparam struct { + start_func uintptr + arg unsafe.Pointer + stack_base uintptr + stack_size uintptr + tls_base unsafe.Pointer + tls_size uintptr + child_tid unsafe.Pointer + parent_tid *int64 + flags int32 + pad_cgo_0 [4]byte + rtp *rtprio + spare [3]uintptr +} + +type sigaltstackt struct { + ss_sp *int8 + ss_size uint64 + ss_flags int32 + pad_cgo_0 [4]byte +} + +type sigset struct { + __bits [4]uint32 +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr uint64 + si_value [8]byte + _reason [40]byte +} + +type mcontext struct { + mc_onstack uint64 + mc_rdi uint64 + mc_rsi uint64 + mc_rdx uint64 + mc_rcx uint64 + mc_r8 uint64 + mc_r9 uint64 + mc_rax uint64 + mc_rbx uint64 + mc_rbp uint64 + mc_r10 uint64 + mc_r11 uint64 + mc_r12 uint64 + mc_r13 uint64 + mc_r14 uint64 + mc_r15 uint64 + mc_trapno uint32 + mc_fs uint16 + mc_gs uint16 + mc_addr uint64 + mc_flags uint32 + mc_es uint16 + mc_ds uint16 + mc_err uint64 + mc_rip uint64 + mc_cs uint64 + mc_rflags uint64 + mc_rsp uint64 + mc_ss uint64 + mc_len uint64 + mc_fpformat uint64 + mc_ownedfp uint64 + mc_fpstate [64]uint64 + mc_fsbase uint64 + mc_gsbase uint64 + mc_xfpustate uint64 + mc_xfpustate_len uint64 + mc_spare [4]uint64 +} + +type ucontext struct { + uc_sigmask sigset + uc_mcontext mcontext + uc_link *ucontext + uc_stack stackt + uc_flags int32 + __spare__ [4]int32 + pad_cgo_0 [12]byte +} + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type umtx_time struct { + _timeout timespec + _flags uint32 + _clockid uint32 +} + +type keventt struct { + ident uint64 + filter int16 + flags uint16 + fflags uint32 + data int64 + udata *byte +} diff --git a/hack/go1_7_2/runtime/defs_freebsd_arm.go b/hack/go1_7_2/runtime/defs_freebsd_arm.go new file mode 100644 index 0000000..ea2551e --- /dev/null +++ b/hack/go1_7_2/runtime/defs_freebsd_arm.go @@ -0,0 +1,186 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_freebsd.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x5 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _CLOCK_MONOTONIC = 0x4 + + _UMTX_OP_WAIT_UINT = 0xb + _UMTX_OP_WAIT_UINT_PRIVATE = 0xf + _UMTX_OP_WAKE = 0x3 + _UMTX_OP_WAKE_PRIVATE = 0x10 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x2 + _FPE_INTOVF = 0x1 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0x40 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type rtprio struct { + _type uint16 + prio uint16 +} + +type thrparam struct { + start_func uintptr + arg unsafe.Pointer + stack_base uintptr + stack_size uintptr + tls_base unsafe.Pointer + tls_size uintptr + child_tid unsafe.Pointer + parent_tid *int32 + flags int32 + rtp *rtprio + spare [3]uintptr +} + +type sigaltstackt struct { + ss_sp *uint8 + ss_size uint32 + ss_flags int32 +} + +type sigset struct { + __bits [4]uint32 +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr uintptr + si_value [4]byte + _reason [32]byte +} + +type mcontext struct { + __gregs [17]uint32 + __fpu [140]byte +} + +type ucontext struct { + uc_sigmask sigset + uc_mcontext mcontext + uc_link *ucontext + uc_stack stackt + uc_flags int32 + __spare__ [4]int32 +} + +type timespec struct { + tv_sec int64 + tv_nsec int32 + pad_cgo_0 [4]byte +} + +type timeval struct { + tv_sec int64 + tv_usec int32 + pad_cgo_0 [4]byte +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type umtx_time struct { + _timeout timespec + _flags uint32 + _clockid uint32 +} + +type keventt struct { + ident uint32 + filter int16 + flags uint16 + fflags uint32 + data int32 + udata *byte +} diff --git a/hack/go1_7_2/runtime/defs_linux_386.go b/hack/go1_7_2/runtime/defs_linux_386.go new file mode 100644 index 0000000..43f6d52 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_linux_386.go @@ -0,0 +1,217 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs2_linux.go + +package runtime + +const ( + _EINTR = 0x4 + _EAGAIN = 0xb + _ENOMEM = 0xc + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x20 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_RESTORER = 0x4000000 + _SA_SIGINFO = 0x4 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _O_RDONLY = 0x0 + _O_CLOEXEC = 0x80000 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 + + _AF_UNIX = 0x1 + _F_SETFL = 0x4 + _SOCK_DGRAM = 0x2 +) + +type fpreg struct { + significand [4]uint16 + exponent uint16 +} + +type fpxreg struct { + significand [4]uint16 + exponent uint16 + padding [3]uint16 +} + +type xmmreg struct { + element [4]uint32 +} + +type fpstate struct { + cw uint32 + sw uint32 + tag uint32 + ipoff uint32 + cssel uint32 + dataoff uint32 + datasel uint32 + _st [8]fpreg + status uint16 + magic uint16 + _fxsr_env [6]uint32 + mxcsr uint32 + reserved uint32 + _fxsr_st [8]fpxreg + _xmm [8]xmmreg + padding1 [44]uint32 + anon0 [48]byte +} + +type timespec struct { + tv_sec int32 + tv_nsec int32 +} + +type timeval struct { + tv_sec int32 + tv_usec int32 +} + +type sigactiont struct { + sa_handler uintptr + sa_flags uint32 + sa_restorer uintptr + sa_mask uint64 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + + si_addr uint32 +} + +type sigaltstackt struct { + ss_sp *byte + ss_flags int32 + ss_size uintptr +} + +type sigcontext struct { + gs uint16 + __gsh uint16 + fs uint16 + __fsh uint16 + es uint16 + __esh uint16 + ds uint16 + __dsh uint16 + edi uint32 + esi uint32 + ebp uint32 + esp uint32 + ebx uint32 + edx uint32 + ecx uint32 + eax uint32 + trapno uint32 + err uint32 + eip uint32 + cs uint16 + __csh uint16 + eflags uint32 + esp_at_signal uint32 + ss uint16 + __ssh uint16 + fpstate *fpstate + oldmask uint32 + cr2 uint32 +} + +type ucontext struct { + uc_flags uint32 + uc_link *ucontext + uc_stack sigaltstackt + uc_mcontext sigcontext + uc_sigmask uint32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type epollevent struct { + events uint32 + data [8]byte +} + +type sockaddr_un struct { + family uint16 + path [108]byte +} diff --git a/hack/go1_7_2/runtime/defs_linux_amd64.go b/hack/go1_7_2/runtime/defs_linux_amd64.go new file mode 100644 index 0000000..2d7742c --- /dev/null +++ b/hack/go1_7_2/runtime/defs_linux_amd64.go @@ -0,0 +1,249 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_linux.go defs1_linux.go + +package runtime + +const ( + _EINTR = 0x4 + _EAGAIN = 0xb + _ENOMEM = 0xc + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x20 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_RESTORER = 0x4000000 + _SA_SIGINFO = 0x4 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 + + _AF_UNIX = 0x1 + _F_SETFL = 0x4 + _SOCK_DGRAM = 0x2 +) + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type sigactiont struct { + sa_handler uintptr + sa_flags uint64 + sa_restorer uintptr + sa_mask uint64 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + + si_addr uint64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type epollevent struct { + events uint32 + data [8]byte +} + +const ( + _O_RDONLY = 0x0 + _O_CLOEXEC = 0x80000 +) + +type usigset struct { + __val [16]uint64 +} + +type fpxreg struct { + significand [4]uint16 + exponent uint16 + padding [3]uint16 +} + +type xmmreg struct { + element [4]uint32 +} + +type fpstate struct { + cwd uint16 + swd uint16 + ftw uint16 + fop uint16 + rip uint64 + rdp uint64 + mxcsr uint32 + mxcr_mask uint32 + _st [8]fpxreg + _xmm [16]xmmreg + padding [24]uint32 +} + +type fpxreg1 struct { + significand [4]uint16 + exponent uint16 + padding [3]uint16 +} + +type xmmreg1 struct { + element [4]uint32 +} + +type fpstate1 struct { + cwd uint16 + swd uint16 + ftw uint16 + fop uint16 + rip uint64 + rdp uint64 + mxcsr uint32 + mxcr_mask uint32 + _st [8]fpxreg1 + _xmm [16]xmmreg1 + padding [24]uint32 +} + +type fpreg1 struct { + significand [4]uint16 + exponent uint16 +} + +type sigaltstackt struct { + ss_sp *byte + ss_flags int32 + pad_cgo_0 [4]byte + ss_size uintptr +} + +type mcontext struct { + gregs [23]uint64 + fpregs *fpstate + __reserved1 [8]uint64 +} + +type ucontext struct { + uc_flags uint64 + uc_link *ucontext + uc_stack sigaltstackt + uc_mcontext mcontext + uc_sigmask usigset + __fpregs_mem fpstate +} + +type sigcontext struct { + r8 uint64 + r9 uint64 + r10 uint64 + r11 uint64 + r12 uint64 + r13 uint64 + r14 uint64 + r15 uint64 + rdi uint64 + rsi uint64 + rbp uint64 + rbx uint64 + rdx uint64 + rax uint64 + rcx uint64 + rsp uint64 + rip uint64 + eflags uint64 + cs uint16 + gs uint16 + fs uint16 + __pad0 uint16 + err uint64 + trapno uint64 + oldmask uint64 + cr2 uint64 + fpstate *fpstate1 + __reserved1 [8]uint64 +} + +type sockaddr_un struct { + family uint16 + path [108]byte +} diff --git a/hack/go1_7_2/runtime/defs_linux_arm.go b/hack/go1_7_2/runtime/defs_linux_arm.go new file mode 100644 index 0000000..a666b92 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_linux_arm.go @@ -0,0 +1,170 @@ +package runtime + +// Constants +const ( + _EINTR = 0x4 + _ENOMEM = 0xc + _EAGAIN = 0xb + + _PROT_NONE = 0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x20 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_RESTORER = 0 + _SA_SIGINFO = 0x4 + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + _ITIMER_REAL = 0 + _ITIMER_PROF = 0x2 + _ITIMER_VIRTUAL = 0x1 + _O_RDONLY = 0 + _O_CLOEXEC = 0x80000 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 + + _AF_UNIX = 0x1 + _F_SETFL = 0x4 + _SOCK_DGRAM = 0x2 +) + +type timespec struct { + tv_sec int32 + tv_nsec int32 +} + +type sigaltstackt struct { + ss_sp *byte + ss_flags int32 + ss_size uintptr +} + +type sigcontext struct { + trap_no uint32 + error_code uint32 + oldmask uint32 + r0 uint32 + r1 uint32 + r2 uint32 + r3 uint32 + r4 uint32 + r5 uint32 + r6 uint32 + r7 uint32 + r8 uint32 + r9 uint32 + r10 uint32 + fp uint32 + ip uint32 + sp uint32 + lr uint32 + pc uint32 + cpsr uint32 + fault_address uint32 +} + +type ucontext struct { + uc_flags uint32 + uc_link *ucontext + uc_stack sigaltstackt + uc_mcontext sigcontext + uc_sigmask uint32 + __unused [31]int32 + uc_regspace [128]uint32 +} + +type timeval struct { + tv_sec int32 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + + si_addr uint32 +} + +type sigactiont struct { + sa_handler uintptr + sa_flags uint32 + sa_restorer uintptr + sa_mask uint64 +} + +type epollevent struct { + events uint32 + _pad uint32 + data [8]byte +} + +type sockaddr_un struct { + family uint16 + path [108]byte +} diff --git a/hack/go1_7_2/runtime/defs_linux_arm64.go b/hack/go1_7_2/runtime/defs_linux_arm64.go new file mode 100644 index 0000000..8eacf10 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_linux_arm64.go @@ -0,0 +1,172 @@ +// Created by cgo -cdefs and converted (by hand) to Go +// ../cmd/cgo/cgo -cdefs defs_linux.go defs1_linux.go defs2_linux.go + +package runtime + +const ( + _EINTR = 0x4 + _EAGAIN = 0xb + _ENOMEM = 0xc + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x20 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_RESTORER = 0x0 + _SA_SIGINFO = 0x4 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 + + _AF_UNIX = 0x1 + _F_SETFL = 0x4 + _SOCK_DGRAM = 0x2 +) + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type sigactiont struct { + sa_handler uintptr + sa_flags uint64 + sa_restorer uintptr + sa_mask uint64 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + + si_addr uint64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type epollevent struct { + events uint32 + _pad uint32 + data [8]byte +} + +const ( + _O_RDONLY = 0x0 + _O_CLOEXEC = 0x80000 +) + +type usigset struct { + __val [16]uint64 +} + +type sigaltstackt struct { + ss_sp *byte + ss_flags int32 + pad_cgo_0 [4]byte + ss_size uintptr +} + +type sigcontext struct { + fault_address uint64 + + regs [31]uint64 + sp uint64 + pc uint64 + pstate uint64 + _pad [8]byte + __reserved [4096]byte +} + +type sockaddr_un struct { + family uint16 + path [108]byte +} + +type ucontext struct { + uc_flags uint64 + uc_link *ucontext + uc_stack sigaltstackt + uc_sigmask uint64 + _pad [(1024 - 64) / 8]byte + _pad2 [8]byte + uc_mcontext sigcontext +} diff --git a/hack/go1_7_2/runtime/defs_linux_mips64x.go b/hack/go1_7_2/runtime/defs_linux_mips64x.go new file mode 100644 index 0000000..be729e3 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_linux_mips64x.go @@ -0,0 +1,165 @@ +// +build mips64 mips64le +// +build linux + +package runtime + +const ( + _EINTR = 0x4 + _EAGAIN = 0xb + _ENOMEM = 0xc + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x800 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_SIGINFO = 0x8 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGUSR1 = 0x10 + _SIGUSR2 = 0x11 + _SIGCHLD = 0x12 + _SIGPWR = 0x13 + _SIGWINCH = 0x14 + _SIGURG = 0x15 + _SIGIO = 0x16 + _SIGSTOP = 0x17 + _SIGTSTP = 0x18 + _SIGCONT = 0x19 + _SIGTTIN = 0x1a + _SIGTTOU = 0x1b + _SIGVTALRM = 0x1c + _SIGPROF = 0x1d + _SIGXCPU = 0x1e + _SIGXFSZ = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 +) + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type sigactiont struct { + sa_flags uint32 + sa_handler uintptr + sa_mask [2]uint64 + + sa_restorer uintptr +} + +type siginfo struct { + si_signo int32 + si_code int32 + si_errno int32 + __pad0 [1]int32 + + si_addr uint64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type epollevent struct { + events uint32 + pad_cgo_0 [4]byte + data [8]byte +} + +const ( + _O_RDONLY = 0x0 + _O_CLOEXEC = 0x80000 + _SA_RESTORER = 0 +) + +type sigaltstackt struct { + ss_sp *byte + ss_size uintptr + ss_flags int32 +} + +type sigcontext struct { + sc_regs [32]uint64 + sc_fpregs [32]uint64 + sc_mdhi uint64 + sc_hi1 uint64 + sc_hi2 uint64 + sc_hi3 uint64 + sc_mdlo uint64 + sc_lo1 uint64 + sc_lo2 uint64 + sc_lo3 uint64 + sc_pc uint64 + sc_fpc_csr uint32 + sc_used_math uint32 + sc_dsp uint32 + sc_reserved uint32 +} + +type ucontext struct { + uc_flags uint64 + uc_link *ucontext + uc_stack sigaltstackt + uc_mcontext sigcontext + uc_sigmask uint64 +} diff --git a/hack/go1_7_2/runtime/defs_linux_ppc64.go b/hack/go1_7_2/runtime/defs_linux_ppc64.go new file mode 100644 index 0000000..eef35bd --- /dev/null +++ b/hack/go1_7_2/runtime/defs_linux_ppc64.go @@ -0,0 +1,180 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_linux.go defs3_linux.go + +package runtime + +const ( + _EINTR = 0x4 + _EAGAIN = 0xb + _ENOMEM = 0xc + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x20 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_SIGINFO = 0x4 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 +) + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type sigactiont struct { + sa_handler uintptr + sa_flags uint64 + sa_restorer uintptr + sa_mask uint64 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + + si_addr uint64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type epollevent struct { + events uint32 + pad_cgo_0 [4]byte + data [8]byte +} + +const ( + _O_RDONLY = 0x0 + _O_CLOEXEC = 0x80000 + _SA_RESTORER = 0 +) + +type ptregs struct { + gpr [32]uint64 + nip uint64 + msr uint64 + orig_gpr3 uint64 + ctr uint64 + link uint64 + xer uint64 + ccr uint64 + softe uint64 + trap uint64 + dar uint64 + dsisr uint64 + result uint64 +} + +type vreg struct { + u [4]uint32 +} + +type sigaltstackt struct { + ss_sp *byte + ss_flags int32 + pad_cgo_0 [4]byte + ss_size uintptr +} + +type sigcontext struct { + _unused [4]uint64 + signal int32 + _pad0 int32 + handler uint64 + oldmask uint64 + regs *ptregs + gp_regs [48]uint64 + fp_regs [33]float64 + v_regs *vreg + vmx_reserve [101]int64 +} + +type ucontext struct { + uc_flags uint64 + uc_link *ucontext + uc_stack sigaltstackt + uc_sigmask uint64 + __unused [15]uint64 + uc_mcontext sigcontext +} diff --git a/hack/go1_7_2/runtime/defs_linux_ppc64le.go b/hack/go1_7_2/runtime/defs_linux_ppc64le.go new file mode 100644 index 0000000..eef35bd --- /dev/null +++ b/hack/go1_7_2/runtime/defs_linux_ppc64le.go @@ -0,0 +1,180 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_linux.go defs3_linux.go + +package runtime + +const ( + _EINTR = 0x4 + _EAGAIN = 0xb + _ENOMEM = 0xc + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x20 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_SIGINFO = 0x4 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 +) + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type sigactiont struct { + sa_handler uintptr + sa_flags uint64 + sa_restorer uintptr + sa_mask uint64 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + + si_addr uint64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type epollevent struct { + events uint32 + pad_cgo_0 [4]byte + data [8]byte +} + +const ( + _O_RDONLY = 0x0 + _O_CLOEXEC = 0x80000 + _SA_RESTORER = 0 +) + +type ptregs struct { + gpr [32]uint64 + nip uint64 + msr uint64 + orig_gpr3 uint64 + ctr uint64 + link uint64 + xer uint64 + ccr uint64 + softe uint64 + trap uint64 + dar uint64 + dsisr uint64 + result uint64 +} + +type vreg struct { + u [4]uint32 +} + +type sigaltstackt struct { + ss_sp *byte + ss_flags int32 + pad_cgo_0 [4]byte + ss_size uintptr +} + +type sigcontext struct { + _unused [4]uint64 + signal int32 + _pad0 int32 + handler uint64 + oldmask uint64 + regs *ptregs + gp_regs [48]uint64 + fp_regs [33]float64 + v_regs *vreg + vmx_reserve [101]int64 +} + +type ucontext struct { + uc_flags uint64 + uc_link *ucontext + uc_stack sigaltstackt + uc_sigmask uint64 + __unused [15]uint64 + uc_mcontext sigcontext +} diff --git a/hack/go1_7_2/runtime/defs_linux_s390x.go b/hack/go1_7_2/runtime/defs_linux_s390x.go new file mode 100644 index 0000000..241ccf9 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_linux_s390x.go @@ -0,0 +1,155 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _EINTR = 0x4 + _EAGAIN = 0xb + _ENOMEM = 0xc + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x20 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_SIGINFO = 0x4 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 +) + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type sigactiont struct { + sa_handler uintptr + sa_flags uint64 + sa_restorer uintptr + sa_mask uint64 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + + si_addr uint64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type epollevent struct { + events uint32 + pad_cgo_0 [4]byte + data [8]byte +} + +const ( + _O_RDONLY = 0x0 + _O_CLOEXEC = 0x80000 + _SA_RESTORER = 0 +) + +type sigaltstackt struct { + ss_sp *byte + ss_flags int32 + ss_size uintptr +} + +type sigcontext struct { + psw_mask uint64 + psw_addr uint64 + gregs [16]uint64 + aregs [16]uint32 + fpc uint32 + fpregs [16]uint64 +} + +type ucontext struct { + uc_flags uint64 + uc_link *ucontext + uc_stack sigaltstackt + uc_mcontext sigcontext + uc_sigmask uint64 +} diff --git a/hack/go1_7_2/runtime/defs_nacl_386.go b/hack/go1_7_2/runtime/defs_nacl_386.go new file mode 100644 index 0000000..14cbcd3 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_nacl_386.go @@ -0,0 +1,41 @@ +package runtime + +const ( + _SIGQUIT = 3 + _SIGSEGV = 11 + _SIGPROF = 27 +) + +type timespec struct { + tv_sec int64 + tv_nsec int32 +} + +type excregs386 struct { + eax uint32 + ecx uint32 + edx uint32 + ebx uint32 + esp uint32 + ebp uint32 + esi uint32 + edi uint32 + eip uint32 + eflags uint32 +} + +type exccontext struct { + size uint32 + portable_context_offset uint32 + portable_context_size uint32 + arch uint32 + regs_size uint32 + reserved [11]uint32 + regs excregs386 +} + +type excportablecontext struct { + pc uint32 + sp uint32 + fp uint32 +} diff --git a/hack/go1_7_2/runtime/defs_nacl_amd64p32.go b/hack/go1_7_2/runtime/defs_nacl_amd64p32.go new file mode 100644 index 0000000..3162756 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_nacl_amd64p32.go @@ -0,0 +1,62 @@ +package runtime + +const ( + _SIGQUIT = 3 + _SIGSEGV = 11 + _SIGPROF = 27 +) + +type timespec struct { + tv_sec int64 + tv_nsec int32 +} + +type excregs386 struct { + eax uint32 + ecx uint32 + edx uint32 + ebx uint32 + esp uint32 + ebp uint32 + esi uint32 + edi uint32 + eip uint32 + eflags uint32 +} + +type excregsamd64 struct { + rax uint64 + rcx uint64 + rdx uint64 + rbx uint64 + rsp uint64 + rbp uint64 + rsi uint64 + rdi uint64 + r8 uint64 + r9 uint64 + r10 uint64 + r11 uint64 + r12 uint64 + r13 uint64 + r14 uint64 + r15 uint64 + rip uint64 + rflags uint32 +} + +type exccontext struct { + size uint32 + portable_context_offset uint32 + portable_context_size uint32 + arch uint32 + regs_size uint32 + reserved [11]uint32 + regs excregsamd64 +} + +type excportablecontext struct { + pc uint32 + sp uint32 + fp uint32 +} diff --git a/hack/go1_7_2/runtime/defs_nacl_arm.go b/hack/go1_7_2/runtime/defs_nacl_arm.go new file mode 100644 index 0000000..e8a2143 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_nacl_arm.go @@ -0,0 +1,48 @@ +package runtime + +const ( + _SIGQUIT = 3 + _SIGSEGV = 11 + _SIGPROF = 27 +) + +type timespec struct { + tv_sec int64 + tv_nsec int32 +} + +type excregsarm struct { + r0 uint32 + r1 uint32 + r2 uint32 + r3 uint32 + r4 uint32 + r5 uint32 + r6 uint32 + r7 uint32 + r8 uint32 + r9 uint32 + r10 uint32 + r11 uint32 + r12 uint32 + sp uint32 + lr uint32 + pc uint32 + cpsr uint32 +} + +type exccontext struct { + size uint32 + portable_context_offset uint32 + portable_context_size uint32 + arch uint32 + regs_size uint32 + reserved [11]uint32 + regs excregsarm +} + +type excportablecontext struct { + pc uint32 + sp uint32 + fp uint32 +} diff --git a/hack/go1_7_2/runtime/defs_openbsd_386.go b/hack/go1_7_2/runtime/defs_openbsd_386.go new file mode 100644 index 0000000..85c8765 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_openbsd_386.go @@ -0,0 +1,158 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_openbsd.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x6 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type tforkt struct { + tf_tcb unsafe.Pointer + tf_tid *int32 + tf_stack uintptr +} + +type sigaltstackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type sigcontext struct { + sc_gs uint32 + sc_fs uint32 + sc_es uint32 + sc_ds uint32 + sc_edi uint32 + sc_esi uint32 + sc_ebp uint32 + sc_ebx uint32 + sc_edx uint32 + sc_ecx uint32 + sc_eax uint32 + sc_eip uint32 + sc_cs uint32 + sc_eflags uint32 + sc_esp uint32 + sc_ss uint32 + __sc_unused uint32 + sc_mask uint32 + sc_trapno uint32 + sc_err uint32 + sc_fpstate unsafe.Pointer +} + +type siginfo struct { + si_signo int32 + si_code int32 + si_errno int32 + _data [116]byte +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type timespec struct { + tv_sec int64 + tv_nsec int32 +} + +type timeval struct { + tv_sec int64 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type keventt struct { + ident uint32 + filter int16 + flags uint16 + fflags uint32 + data int64 + udata *byte +} diff --git a/hack/go1_7_2/runtime/defs_openbsd_amd64.go b/hack/go1_7_2/runtime/defs_openbsd_amd64.go new file mode 100644 index 0000000..3167fd6 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_openbsd_amd64.go @@ -0,0 +1,169 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_openbsd.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x6 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type tforkt struct { + tf_tcb unsafe.Pointer + tf_tid *int32 + tf_stack uintptr +} + +type sigaltstackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type sigcontext struct { + sc_rdi uint64 + sc_rsi uint64 + sc_rdx uint64 + sc_rcx uint64 + sc_r8 uint64 + sc_r9 uint64 + sc_r10 uint64 + sc_r11 uint64 + sc_r12 uint64 + sc_r13 uint64 + sc_r14 uint64 + sc_r15 uint64 + sc_rbp uint64 + sc_rbx uint64 + sc_rax uint64 + sc_gs uint64 + sc_fs uint64 + sc_es uint64 + sc_ds uint64 + sc_trapno uint64 + sc_err uint64 + sc_rip uint64 + sc_cs uint64 + sc_rflags uint64 + sc_rsp uint64 + sc_ss uint64 + sc_fpstate unsafe.Pointer + __sc_unused int32 + sc_mask int32 +} + +type siginfo struct { + si_signo int32 + si_code int32 + si_errno int32 + pad_cgo_0 [4]byte + _data [120]byte +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type keventt struct { + ident uint64 + filter int16 + flags uint16 + fflags uint32 + data int64 + udata *byte +} diff --git a/hack/go1_7_2/runtime/defs_openbsd_arm.go b/hack/go1_7_2/runtime/defs_openbsd_arm.go new file mode 100644 index 0000000..22382fa --- /dev/null +++ b/hack/go1_7_2/runtime/defs_openbsd_arm.go @@ -0,0 +1,158 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_openbsd.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x6 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type tforkt struct { + tf_tcb unsafe.Pointer + tf_tid *int32 + tf_stack uintptr +} + +type sigaltstackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type sigcontext struct { + __sc_unused int32 + sc_mask int32 + + sc_spsr uint32 + sc_r0 uint32 + sc_r1 uint32 + sc_r2 uint32 + sc_r3 uint32 + sc_r4 uint32 + sc_r5 uint32 + sc_r6 uint32 + sc_r7 uint32 + sc_r8 uint32 + sc_r9 uint32 + sc_r10 uint32 + sc_r11 uint32 + sc_r12 uint32 + sc_usr_sp uint32 + sc_usr_lr uint32 + sc_svc_lr uint32 + sc_pc uint32 +} + +type siginfo struct { + si_signo int32 + si_code int32 + si_errno int32 + _data [116]byte +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type timespec struct { + tv_sec int64 + tv_nsec int32 +} + +type timeval struct { + tv_sec int64 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type keventt struct { + ident uint32 + filter int16 + flags uint16 + fflags uint32 + data int64 + udata *byte +} diff --git a/hack/go1_7_2/runtime/defs_plan9_386.go b/hack/go1_7_2/runtime/defs_plan9_386.go new file mode 100644 index 0000000..320a00e --- /dev/null +++ b/hack/go1_7_2/runtime/defs_plan9_386.go @@ -0,0 +1,29 @@ +package runtime + +const _PAGESIZE = 0x1000 + +type ureg struct { + di uint32 + si uint32 + bp uint32 + nsp uint32 + bx uint32 + dx uint32 + cx uint32 + ax uint32 + gs uint32 + fs uint32 + es uint32 + ds uint32 + trap uint32 + ecode uint32 + pc uint32 + cs uint32 + flags uint32 + sp uint32 + ss uint32 +} + +type sigctxt struct { + u *ureg +} diff --git a/hack/go1_7_2/runtime/defs_plan9_amd64.go b/hack/go1_7_2/runtime/defs_plan9_amd64.go new file mode 100644 index 0000000..7cb955c --- /dev/null +++ b/hack/go1_7_2/runtime/defs_plan9_amd64.go @@ -0,0 +1,38 @@ +package runtime + +const _PAGESIZE = 0x1000 + +type ureg struct { + ax uint64 + bx uint64 + cx uint64 + dx uint64 + si uint64 + di uint64 + bp uint64 + r8 uint64 + r9 uint64 + r10 uint64 + r11 uint64 + r12 uint64 + r13 uint64 + r14 uint64 + r15 uint64 + + ds uint16 + es uint16 + fs uint16 + gs uint16 + + _type uint64 + error uint64 + ip uint64 + cs uint64 + flags uint64 + sp uint64 + ss uint64 +} + +type sigctxt struct { + u *ureg +} diff --git a/hack/go1_7_2/runtime/defs_plan9_arm.go b/hack/go1_7_2/runtime/defs_plan9_arm.go new file mode 100644 index 0000000..08d2643 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_plan9_arm.go @@ -0,0 +1,32 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const _PAGESIZE = 0x1000 + +type ureg struct { + r0 uint32 + r1 uint32 + r2 uint32 + r3 uint32 + r4 uint32 + r5 uint32 + r6 uint32 + r7 uint32 + r8 uint32 + r9 uint32 + r10 uint32 + r11 uint32 + r12 uint32 + sp uint32 + link uint32 + trap uint32 + psr uint32 + pc uint32 +} + +type sigctxt struct { + u *ureg +} diff --git a/hack/go1_7_2/runtime/defs_windows_386.go b/hack/go1_7_2/runtime/defs_windows_386.go new file mode 100644 index 0000000..abec2d8 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_windows_386.go @@ -0,0 +1,109 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_windows.go + +package runtime + +const ( + _PROT_NONE = 0 + _PROT_READ = 1 + _PROT_WRITE = 2 + _PROT_EXEC = 4 + + _MAP_ANON = 1 + _MAP_PRIVATE = 2 + + _DUPLICATE_SAME_ACCESS = 0x2 + _THREAD_PRIORITY_HIGHEST = 0x2 + + _SIGINT = 0x2 + _CTRL_C_EVENT = 0x0 + _CTRL_BREAK_EVENT = 0x1 + + _CONTEXT_CONTROL = 0x10001 + _CONTEXT_FULL = 0x10007 + + _EXCEPTION_ACCESS_VIOLATION = 0xc0000005 + _EXCEPTION_BREAKPOINT = 0x80000003 + _EXCEPTION_FLT_DENORMAL_OPERAND = 0xc000008d + _EXCEPTION_FLT_DIVIDE_BY_ZERO = 0xc000008e + _EXCEPTION_FLT_INEXACT_RESULT = 0xc000008f + _EXCEPTION_FLT_OVERFLOW = 0xc0000091 + _EXCEPTION_FLT_UNDERFLOW = 0xc0000093 + _EXCEPTION_INT_DIVIDE_BY_ZERO = 0xc0000094 + _EXCEPTION_INT_OVERFLOW = 0xc0000095 + + _INFINITE = 0xffffffff + _WAIT_TIMEOUT = 0x102 + + _EXCEPTION_CONTINUE_EXECUTION = -0x1 + _EXCEPTION_CONTINUE_SEARCH = 0x0 +) + +type systeminfo struct { + anon0 [4]byte + dwpagesize uint32 + lpminimumapplicationaddress *byte + lpmaximumapplicationaddress *byte + dwactiveprocessormask uint32 + dwnumberofprocessors uint32 + dwprocessortype uint32 + dwallocationgranularity uint32 + wprocessorlevel uint16 + wprocessorrevision uint16 +} + +type exceptionrecord struct { + exceptioncode uint32 + exceptionflags uint32 + exceptionrecord *exceptionrecord + exceptionaddress *byte + numberparameters uint32 + exceptioninformation [15]uint32 +} + +type floatingsavearea struct { + controlword uint32 + statusword uint32 + tagword uint32 + erroroffset uint32 + errorselector uint32 + dataoffset uint32 + dataselector uint32 + registerarea [80]uint8 + cr0npxstate uint32 +} + +type context struct { + contextflags uint32 + dr0 uint32 + dr1 uint32 + dr2 uint32 + dr3 uint32 + dr6 uint32 + dr7 uint32 + floatsave floatingsavearea + seggs uint32 + segfs uint32 + seges uint32 + segds uint32 + edi uint32 + esi uint32 + ebx uint32 + edx uint32 + ecx uint32 + eax uint32 + ebp uint32 + eip uint32 + segcs uint32 + eflags uint32 + esp uint32 + segss uint32 + extendedregisters [512]uint8 +} + +type overlapped struct { + internal uint32 + internalhigh uint32 + anon0 [8]byte + hevent *byte +} diff --git a/hack/go1_7_2/runtime/defs_windows_amd64.go b/hack/go1_7_2/runtime/defs_windows_amd64.go new file mode 100644 index 0000000..81b1359 --- /dev/null +++ b/hack/go1_7_2/runtime/defs_windows_amd64.go @@ -0,0 +1,124 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_windows.go + +package runtime + +const ( + _PROT_NONE = 0 + _PROT_READ = 1 + _PROT_WRITE = 2 + _PROT_EXEC = 4 + + _MAP_ANON = 1 + _MAP_PRIVATE = 2 + + _DUPLICATE_SAME_ACCESS = 0x2 + _THREAD_PRIORITY_HIGHEST = 0x2 + + _SIGINT = 0x2 + _CTRL_C_EVENT = 0x0 + _CTRL_BREAK_EVENT = 0x1 + + _CONTEXT_CONTROL = 0x100001 + _CONTEXT_FULL = 0x10000b + + _EXCEPTION_ACCESS_VIOLATION = 0xc0000005 + _EXCEPTION_BREAKPOINT = 0x80000003 + _EXCEPTION_FLT_DENORMAL_OPERAND = 0xc000008d + _EXCEPTION_FLT_DIVIDE_BY_ZERO = 0xc000008e + _EXCEPTION_FLT_INEXACT_RESULT = 0xc000008f + _EXCEPTION_FLT_OVERFLOW = 0xc0000091 + _EXCEPTION_FLT_UNDERFLOW = 0xc0000093 + _EXCEPTION_INT_DIVIDE_BY_ZERO = 0xc0000094 + _EXCEPTION_INT_OVERFLOW = 0xc0000095 + + _INFINITE = 0xffffffff + _WAIT_TIMEOUT = 0x102 + + _EXCEPTION_CONTINUE_EXECUTION = -0x1 + _EXCEPTION_CONTINUE_SEARCH = 0x0 +) + +type systeminfo struct { + anon0 [4]byte + dwpagesize uint32 + lpminimumapplicationaddress *byte + lpmaximumapplicationaddress *byte + dwactiveprocessormask uint64 + dwnumberofprocessors uint32 + dwprocessortype uint32 + dwallocationgranularity uint32 + wprocessorlevel uint16 + wprocessorrevision uint16 +} + +type exceptionrecord struct { + exceptioncode uint32 + exceptionflags uint32 + exceptionrecord *exceptionrecord + exceptionaddress *byte + numberparameters uint32 + pad_cgo_0 [4]byte + exceptioninformation [15]uint64 +} + +type m128a struct { + low uint64 + high int64 +} + +type context struct { + p1home uint64 + p2home uint64 + p3home uint64 + p4home uint64 + p5home uint64 + p6home uint64 + contextflags uint32 + mxcsr uint32 + segcs uint16 + segds uint16 + seges uint16 + segfs uint16 + seggs uint16 + segss uint16 + eflags uint32 + dr0 uint64 + dr1 uint64 + dr2 uint64 + dr3 uint64 + dr6 uint64 + dr7 uint64 + rax uint64 + rcx uint64 + rdx uint64 + rbx uint64 + rsp uint64 + rbp uint64 + rsi uint64 + rdi uint64 + r8 uint64 + r9 uint64 + r10 uint64 + r11 uint64 + r12 uint64 + r13 uint64 + r14 uint64 + r15 uint64 + rip uint64 + anon0 [512]byte + vectorregister [26]m128a + vectorcontrol uint64 + debugcontrol uint64 + lastbranchtorip uint64 + lastbranchfromrip uint64 + lastexceptiontorip uint64 + lastexceptionfromrip uint64 +} + +type overlapped struct { + internal uint64 + internalhigh uint64 + anon0 [8]byte + hevent *byte +} diff --git a/hack/go1_7_2/runtime/error.go b/hack/go1_7_2/runtime/error.go new file mode 100644 index 0000000..fbc6a69 --- /dev/null +++ b/hack/go1_7_2/runtime/error.go @@ -0,0 +1,32 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +// The Error interface identifies a run time error. +type Error interface { + error + + RuntimeError() +} + +// A TypeAssertionError explains a failed type assertion. +type TypeAssertionError struct { + interfaceString string + concreteString string + assertedString string + missingMethod string +} + +// An errorString represents a runtime error described by a single string. +type errorString string + +// plainError represents a runtime error described a string without +// the prefix "runtime error: " after invoking errorString.Error(). +// See Issue #14965. +type plainError string + +type stringer interface { + String() string +} diff --git a/hack/go1_7_2/runtime/extern.go b/hack/go1_7_2/runtime/extern.go new file mode 100644 index 0000000..9ab198c --- /dev/null +++ b/hack/go1_7_2/runtime/extern.go @@ -0,0 +1,170 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Package runtime contains operations that interact with Go's runtime system, +such as functions to control goroutines. It also includes the low-level type information +used by the reflect package; see reflect's documentation for the programmable +interface to the run-time type system. + +Environment Variables + +The following environment variables ($name or %name%, depending on the host +operating system) control the run-time behavior of Go programs. The meanings +and use may change from release to release. + +The GOGC variable sets the initial garbage collection target percentage. +A collection is triggered when the ratio of freshly allocated data to live data +remaining after the previous collection reaches this percentage. The default +is GOGC=100. Setting GOGC=off disables the garbage collector entirely. +The runtime/debug package's SetGCPercent function allows changing this +percentage at run time. See https://golang.org/pkg/runtime/debug/#SetGCPercent. + +The GODEBUG variable controls debugging variables within the runtime. +It is a comma-separated list of name=val pairs setting these named variables: + + allocfreetrace: setting allocfreetrace=1 causes every allocation to be + profiled and a stack trace printed on each object's allocation and free. + + cgocheck: setting cgocheck=0 disables all checks for packages + using cgo to incorrectly pass Go pointers to non-Go code. + Setting cgocheck=1 (the default) enables relatively cheap + checks that may miss some errors. Setting cgocheck=2 enables + expensive checks that should not miss any errors, but will + cause your program to run slower. + + efence: setting efence=1 causes the allocator to run in a mode + where each object is allocated on a unique page and addresses are + never recycled. + + gccheckmark: setting gccheckmark=1 enables verification of the + garbage collector's concurrent mark phase by performing a + second mark pass while the world is stopped. If the second + pass finds a reachable object that was not found by concurrent + mark, the garbage collector will panic. + + gcpacertrace: setting gcpacertrace=1 causes the garbage collector to + print information about the internal state of the concurrent pacer. + + gcshrinkstackoff: setting gcshrinkstackoff=1 disables moving goroutines + onto smaller stacks. In this mode, a goroutine's stack can only grow. + + gcstackbarrieroff: setting gcstackbarrieroff=1 disables the use of stack barriers + that allow the garbage collector to avoid repeating a stack scan during the + mark termination phase. + + gcstackbarrierall: setting gcstackbarrierall=1 installs stack barriers + in every stack frame, rather than in exponentially-spaced frames. + + gcstoptheworld: setting gcstoptheworld=1 disables concurrent garbage collection, + making every garbage collection a stop-the-world event. Setting gcstoptheworld=2 + also disables concurrent sweeping after the garbage collection finishes. + + gctrace: setting gctrace=1 causes the garbage collector to emit a single line to standard + error at each collection, summarizing the amount of memory collected and the + length of the pause. Setting gctrace=2 emits the same summary but also + repeats each collection. The format of this line is subject to change. + Currently, it is: + gc # @#s #%: #+#+# ms clock, #+#/#/#+# ms cpu, #->#-># MB, # MB goal, # P + where the fields are as follows: + gc # the GC number, incremented at each GC + @#s time in seconds since program start + #% percentage of time spent in GC since program start + #+...+# wall-clock/CPU times for the phases of the GC + #->#-># MB heap size at GC start, at GC end, and live heap + # MB goal goal heap size + # P number of processors used + The phases are stop-the-world (STW) sweep termination, concurrent + mark and scan, and STW mark termination. The CPU times + for mark/scan are broken down in to assist time (GC performed in + line with allocation), background GC time, and idle GC time. + If the line ends with "(forced)", this GC was forced by a + runtime.GC() call and all phases are STW. + + Setting gctrace to any value > 0 also causes the garbage collector + to emit a summary when memory is released back to the system. + This process of returning memory to the system is called scavenging. + The format of this summary is subject to change. + Currently it is: + scvg#: # MB released printed only if non-zero + scvg#: inuse: # idle: # sys: # released: # consumed: # (MB) + where the fields are as follows: + scvg# the scavenge cycle number, incremented at each scavenge + inuse: # MB used or partially used spans + idle: # MB spans pending scavenging + sys: # MB mapped from the system + released: # MB released to the system + consumed: # MB allocated from the system + + memprofilerate: setting memprofilerate=X will update the value of runtime.MemProfileRate. + When set to 0 memory profiling is disabled. Refer to the description of + MemProfileRate for the default value. + + invalidptr: defaults to invalidptr=1, causing the garbage collector and stack + copier to crash the program if an invalid pointer value (for example, 1) + is found in a pointer-typed location. Setting invalidptr=0 disables this check. + This should only be used as a temporary workaround to diagnose buggy code. + The real fix is to not store integers in pointer-typed locations. + + sbrk: setting sbrk=1 replaces the memory allocator and garbage collector + with a trivial allocator that obtains memory from the operating system and + never reclaims any memory. + + scavenge: scavenge=1 enables debugging mode of heap scavenger. + + scheddetail: setting schedtrace=X and scheddetail=1 causes the scheduler to emit + detailed multiline info every X milliseconds, describing state of the scheduler, + processors, threads and goroutines. + + schedtrace: setting schedtrace=X causes the scheduler to emit a single line to standard + error every X milliseconds, summarizing the scheduler state. + +The net and net/http packages also refer to debugging variables in GODEBUG. +See the documentation for those packages for details. + +The GOMAXPROCS variable limits the number of operating system threads that +can execute user-level Go code simultaneously. There is no limit to the number of threads +that can be blocked in system calls on behalf of Go code; those do not count against +the GOMAXPROCS limit. This package's GOMAXPROCS function queries and changes +the limit. + +The GOTRACEBACK variable controls the amount of output generated when a Go +program fails due to an unrecovered panic or an unexpected runtime condition. +By default, a failure prints a stack trace for the current goroutine, +eliding functions internal to the run-time system, and then exits with exit code 2. +The failure prints stack traces for all goroutines if there is no current goroutine +or the failure is internal to the run-time. +GOTRACEBACK=none omits the goroutine stack traces entirely. +GOTRACEBACK=single (the default) behaves as described above. +GOTRACEBACK=all adds stack traces for all user-created goroutines. +GOTRACEBACK=system is like ``all'' but adds stack frames for run-time functions +and shows goroutines created internally by the run-time. +GOTRACEBACK=crash is like ``system'' but crashes in an operating system-specific +manner instead of exiting. For example, on Unix systems, the crash raises +SIGABRT to trigger a core dump. +For historical reasons, the GOTRACEBACK settings 0, 1, and 2 are synonyms for +none, all, and system, respectively. +The runtime/debug package's SetTraceback function allows increasing the +amount of output at run time, but it cannot reduce the amount below that +specified by the environment variable. +See https://golang.org/pkg/runtime/debug/#SetTraceback. + +The GOARCH, GOOS, GOPATH, and GOROOT environment variables complete +the set of Go environment variables. They influence the building of Go programs +(see https://golang.org/cmd/go and https://golang.org/pkg/go/build). +GOARCH, GOOS, and GOROOT are recorded at compile time and made available by +constants or functions in this package, but they do not influence the execution +of the run-time system. +*/ +package runtime + +import "github.com/huandu/goroutine/hack/go1_7_2/runtime/internal/sys" + +// GOOS is the running program's operating system target: +// one of darwin, freebsd, linux, and so on. +const GOOS string = sys.GOOS + +// GOARCH is the running program's architecture target: +// 386, amd64, arm, or s390x. +const GOARCH string = sys.GOARCH diff --git a/hack/go1_7_2/runtime/fastlog2table.go b/hack/go1_7_2/runtime/fastlog2table.go new file mode 100644 index 0000000..1ccb0e4 --- /dev/null +++ b/hack/go1_7_2/runtime/fastlog2table.go @@ -0,0 +1,7 @@ +// AUTO-GENERATED by mkfastlog2table.go +// Run go generate from src/runtime to update. +// See mkfastlog2table.go for comments. + +package runtime + +const fastlogNumBits = 5 diff --git a/hack/go1_7_2/runtime/hackedtypes.go b/hack/go1_7_2/runtime/hackedtypes.go new file mode 100644 index 0000000..3aef945 --- /dev/null +++ b/hack/go1_7_2/runtime/hackedtypes.go @@ -0,0 +1,13 @@ +// Copyright 2016 Huan Du. All rights reserved. +// Use of this source code is governed by a MIT +// license that can be found in the LICENSE file. + +package runtime + +// Goroutine is the internal type represents a goroutine. +type Goroutine g + +// Get goid. +func (g *Goroutine) Goid() int64 { + return g.goid +} diff --git a/hack/go1_7_2/runtime/hash32.go b/hack/go1_7_2/runtime/hash32.go new file mode 100644 index 0000000..f0f9436 --- /dev/null +++ b/hack/go1_7_2/runtime/hash32.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Hashing algorithm inspired by +// xxhash: https://code.google.com/p/xxhash/ +// cityhash: https://code.google.com/p/cityhash/ + +// +build 386 arm + +package runtime + +const ( + m1 = 3168982561 + m2 = 3339683297 + m3 = 832293441 + m4 = 2336365089 +) diff --git a/hack/go1_7_2/runtime/hash64.go b/hack/go1_7_2/runtime/hash64.go new file mode 100644 index 0000000..d5b2049 --- /dev/null +++ b/hack/go1_7_2/runtime/hash64.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Hashing algorithm inspired by +// xxhash: https://code.google.com/p/xxhash/ +// cityhash: https://code.google.com/p/cityhash/ + +// +build amd64 amd64p32 arm64 mips64 mips64le ppc64 ppc64le s390x + +package runtime + +const ( + m1 = 16877499708836156737 + m2 = 2820277070424839065 + m3 = 9497967016996688599 + m4 = 15839092249703872147 +) diff --git a/hack/go1_7_2/runtime/hashmap.go b/hack/go1_7_2/runtime/hashmap.go new file mode 100644 index 0000000..61b27a1 --- /dev/null +++ b/hack/go1_7_2/runtime/hashmap.go @@ -0,0 +1,78 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_2/runtime/internal/sys" + "unsafe" +) + +const ( + bucketCntBits = 3 + bucketCnt = 1 << bucketCntBits + + loadFactor = 6.5 + + maxKeySize = 128 + maxValueSize = 128 + + dataOffset = unsafe.Offsetof(struct { + b bmap + v int64 + }{}.v) + + empty = 0 + evacuatedEmpty = 1 + evacuatedX = 2 + evacuatedY = 3 + minTopHash = 4 + + iterator = 1 + oldIterator = 2 + hashWriting = 4 + + noCheck = 1<<(8*sys.PtrSize) - 1 +) + +// A header for a Go map. +type hmap struct { + count int + flags uint8 + B uint8 + hash0 uint32 + + buckets unsafe.Pointer + oldbuckets unsafe.Pointer + nevacuate uintptr + + overflow *[2]*[]*bmap +} + +// A bucket for a Go map. +type bmap struct { + tophash [bucketCnt]uint8 +} + +// A hash iteration structure. +// If you modify hiter, also change cmd/internal/gc/reflect.go to indicate +// the layout of this structure. +type hiter struct { + key unsafe.Pointer + value unsafe.Pointer + t *maptype + h *hmap + buckets unsafe.Pointer + bptr *bmap + overflow [2]*[]*bmap + startBucket uintptr + offset uint8 + wrapped bool + B uint8 + i uint8 + bucket uintptr + checkBucket uintptr +} + +const maxZero = 1024 diff --git a/hack/go1_7_2/runtime/heapdump.go b/hack/go1_7_2/runtime/heapdump.go new file mode 100644 index 0000000..48d8272 --- /dev/null +++ b/hack/go1_7_2/runtime/heapdump.go @@ -0,0 +1,65 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Implementation of runtime/debug.WriteHeapDump. Writes all +// objects in the heap plus additional info (roots, threads, +// finalizers, etc.) to a file. + +// The format of the dumped file is described at +// https://golang.org/s/go15heapdump. + +package runtime + +const ( + fieldKindEol = 0 + fieldKindPtr = 1 + fieldKindIface = 2 + fieldKindEface = 3 + tagEOF = 0 + tagObject = 1 + tagOtherRoot = 2 + tagType = 3 + tagGoroutine = 4 + tagStackFrame = 5 + tagParams = 6 + tagFinalizer = 7 + tagItab = 8 + tagOSThread = 9 + tagMemStats = 10 + tagQueuedFinalizer = 11 + tagData = 12 + tagBSS = 13 + tagDefer = 14 + tagPanic = 15 + tagMemProf = 16 + tagAllocSample = 17 +) + +// buffer of pending write data +const ( + bufSize = 4096 +) + +// Cache of types that have been serialized already. +// We use a type's hash field to pick a bucket. +// Inside a bucket, we keep a list of types that +// have been serialized so far, most recently used first. +// Note: when a bucket overflows we may end up +// serializing a type more than once. That's ok. +const ( + typeCacheBuckets = 256 + typeCacheAssoc = 4 +) + +type typeCacheBucket struct { + t [typeCacheAssoc]*_type +} + +type childInfo struct { + argoff uintptr + arglen uintptr + args bitvector + sp *uint8 + depth uintptr +} diff --git a/hack/go1_7_2/runtime/iface.go b/hack/go1_7_2/runtime/iface.go new file mode 100644 index 0000000..ce4c87f --- /dev/null +++ b/hack/go1_7_2/runtime/iface.go @@ -0,0 +1,9 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + hashSize = 1009 +) diff --git a/hack/go1_7_2/runtime/internal/sys/arch.go b/hack/go1_7_2/runtime/internal/sys/arch.go new file mode 100644 index 0000000..c175704 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/arch.go @@ -0,0 +1,17 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +type ArchFamilyType int + +const ( + AMD64 ArchFamilyType = iota + ARM + ARM64 + I386 + MIPS64 + PPC64 + S390X +) diff --git a/hack/go1_7_2/runtime/internal/sys/arch_386.go b/hack/go1_7_2/runtime/internal/sys/arch_386.go new file mode 100644 index 0000000..55cdcba --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/arch_386.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = I386 + BigEndian = 0 + CacheLineSize = 64 + PhysPageSize = GoosNacl*65536 + (1-GoosNacl)*4096 + PCQuantum = 1 + Int64Align = 4 + HugePageSize = 1 << 21 + MinFrameSize = 0 +) + +type Uintreg uint32 diff --git a/hack/go1_7_2/runtime/internal/sys/arch_amd64.go b/hack/go1_7_2/runtime/internal/sys/arch_amd64.go new file mode 100644 index 0000000..1bbdb99 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/arch_amd64.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = AMD64 + BigEndian = 0 + CacheLineSize = 64 + PhysPageSize = 4096 + PCQuantum = 1 + Int64Align = 8 + HugePageSize = 1 << 21 + MinFrameSize = 0 +) + +type Uintreg uint64 diff --git a/hack/go1_7_2/runtime/internal/sys/arch_amd64p32.go b/hack/go1_7_2/runtime/internal/sys/arch_amd64p32.go new file mode 100644 index 0000000..b7011a4 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/arch_amd64p32.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = AMD64 + BigEndian = 0 + CacheLineSize = 64 + PhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl) + PCQuantum = 1 + Int64Align = 8 + HugePageSize = 1 << 21 + MinFrameSize = 0 +) + +type Uintreg uint64 diff --git a/hack/go1_7_2/runtime/internal/sys/arch_arm.go b/hack/go1_7_2/runtime/internal/sys/arch_arm.go new file mode 100644 index 0000000..f90f52d --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/arch_arm.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = ARM + BigEndian = 0 + CacheLineSize = 32 + PhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl) + PCQuantum = 4 + Int64Align = 4 + HugePageSize = 0 + MinFrameSize = 4 +) + +type Uintreg uint32 diff --git a/hack/go1_7_2/runtime/internal/sys/arch_arm64.go b/hack/go1_7_2/runtime/internal/sys/arch_arm64.go new file mode 100644 index 0000000..aaaa4b0 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/arch_arm64.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = ARM64 + BigEndian = 0 + CacheLineSize = 32 + PhysPageSize = 65536 + PCQuantum = 4 + Int64Align = 8 + HugePageSize = 0 + MinFrameSize = 8 +) + +type Uintreg uint64 diff --git a/hack/go1_7_2/runtime/internal/sys/arch_mips64.go b/hack/go1_7_2/runtime/internal/sys/arch_mips64.go new file mode 100644 index 0000000..d567259 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/arch_mips64.go @@ -0,0 +1,18 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = MIPS64 + BigEndian = 1 + CacheLineSize = 32 + PhysPageSize = 16384 + PCQuantum = 4 + Int64Align = 8 + HugePageSize = 0 + MinFrameSize = 8 +) + +type Uintreg uint64 diff --git a/hack/go1_7_2/runtime/internal/sys/arch_mips64le.go b/hack/go1_7_2/runtime/internal/sys/arch_mips64le.go new file mode 100644 index 0000000..f8cdf2b --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/arch_mips64le.go @@ -0,0 +1,18 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = MIPS64 + BigEndian = 0 + CacheLineSize = 32 + PhysPageSize = 16384 + PCQuantum = 4 + Int64Align = 8 + HugePageSize = 0 + MinFrameSize = 8 +) + +type Uintreg uint64 diff --git a/hack/go1_7_2/runtime/internal/sys/arch_ppc64.go b/hack/go1_7_2/runtime/internal/sys/arch_ppc64.go new file mode 100644 index 0000000..cdec63f --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/arch_ppc64.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = PPC64 + BigEndian = 1 + CacheLineSize = 64 + PhysPageSize = 65536 + PCQuantum = 4 + Int64Align = 8 + HugePageSize = 0 + MinFrameSize = 32 +) + +type Uintreg uint64 diff --git a/hack/go1_7_2/runtime/internal/sys/arch_ppc64le.go b/hack/go1_7_2/runtime/internal/sys/arch_ppc64le.go new file mode 100644 index 0000000..4fd68f9 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/arch_ppc64le.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = PPC64 + BigEndian = 0 + CacheLineSize = 64 + PhysPageSize = 65536 + PCQuantum = 4 + Int64Align = 8 + HugePageSize = 0 + MinFrameSize = 32 +) + +type Uintreg uint64 diff --git a/hack/go1_7_2/runtime/internal/sys/arch_s390x.go b/hack/go1_7_2/runtime/internal/sys/arch_s390x.go new file mode 100644 index 0000000..ca1cb86 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/arch_s390x.go @@ -0,0 +1,18 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = S390X + BigEndian = 1 + CacheLineSize = 256 + PhysPageSize = 4096 + PCQuantum = 2 + Int64Align = 8 + HugePageSize = 0 + MinFrameSize = 8 +) + +type Uintreg uint64 diff --git a/hack/go1_7_2/runtime/internal/sys/hackedbuildruntime.go b/hack/go1_7_2/runtime/internal/sys/hackedbuildruntime.go new file mode 100644 index 0000000..01dccae --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/hackedbuildruntime.go @@ -0,0 +1,8 @@ +// Copyright 2016 Huan Du. All rights reserved. +// Use of this source code is governed by a MIT +// license that can be found in the LICENSE file. + +package sys + +const TheVersion = `go1.7.2` +const StackGuardMultiplier = 1 diff --git a/hack/go1_7_2/runtime/internal/sys/intrinsics.go b/hack/go1_7_2/runtime/internal/sys/intrinsics.go new file mode 100644 index 0000000..e65becb --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/intrinsics.go @@ -0,0 +1,15 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !386 + +package sys + +const deBruijn64 = 0x0218a392cd3d5dbf + +const deBruijn32 = 0x04653adf + +const deBruijn16 = 0x09af + +const deBruijn8 = 0x17 diff --git a/hack/go1_7_2/runtime/internal/sys/stubs.go b/hack/go1_7_2/runtime/internal/sys/stubs.go new file mode 100644 index 0000000..9c24896 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/stubs.go @@ -0,0 +1,9 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const PtrSize = 4 << (^uintptr(0) >> 63) +const RegSize = 4 << (^Uintreg(0) >> 63) +const SpAlign = 1*(1-GoarchArm64) + 16*GoarchArm64 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoarch_386.go b/hack/go1_7_2/runtime/internal/sys/zgoarch_386.go new file mode 100644 index 0000000..3bcf83b --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoarch_386.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `386` + +const Goarch386 = 1 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoarch_amd64.go b/hack/go1_7_2/runtime/internal/sys/zgoarch_amd64.go new file mode 100644 index 0000000..699f191 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoarch_amd64.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `amd64` + +const Goarch386 = 0 +const GoarchAmd64 = 1 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoarch_amd64p32.go b/hack/go1_7_2/runtime/internal/sys/zgoarch_amd64p32.go new file mode 100644 index 0000000..cc2d658 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoarch_amd64p32.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `amd64p32` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 1 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoarch_arm.go b/hack/go1_7_2/runtime/internal/sys/zgoarch_arm.go new file mode 100644 index 0000000..a5fd789 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoarch_arm.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `arm` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 1 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoarch_arm64.go b/hack/go1_7_2/runtime/internal/sys/zgoarch_arm64.go new file mode 100644 index 0000000..084d2c7 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoarch_arm64.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `arm64` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 1 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoarch_mips64.go b/hack/go1_7_2/runtime/internal/sys/zgoarch_mips64.go new file mode 100644 index 0000000..2ad62bd --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoarch_mips64.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `mips64` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 1 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoarch_mips64le.go b/hack/go1_7_2/runtime/internal/sys/zgoarch_mips64le.go new file mode 100644 index 0000000..047c8b4 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoarch_mips64le.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `mips64le` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 1 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoarch_ppc64.go b/hack/go1_7_2/runtime/internal/sys/zgoarch_ppc64.go new file mode 100644 index 0000000..748b5b5 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoarch_ppc64.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `ppc64` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 1 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoarch_ppc64le.go b/hack/go1_7_2/runtime/internal/sys/zgoarch_ppc64le.go new file mode 100644 index 0000000..d3dcba4 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoarch_ppc64le.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `ppc64le` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 1 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoarch_s390x.go b/hack/go1_7_2/runtime/internal/sys/zgoarch_s390x.go new file mode 100644 index 0000000..1ead5d5 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoarch_s390x.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `s390x` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 1 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoos_android.go b/hack/go1_7_2/runtime/internal/sys/zgoos_android.go new file mode 100644 index 0000000..6503b15 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoos_android.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `android` + +const GoosAndroid = 1 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoos_darwin.go b/hack/go1_7_2/runtime/internal/sys/zgoos_darwin.go new file mode 100644 index 0000000..6a28598 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoos_darwin.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `darwin` + +const GoosAndroid = 0 +const GoosDarwin = 1 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoos_dragonfly.go b/hack/go1_7_2/runtime/internal/sys/zgoos_dragonfly.go new file mode 100644 index 0000000..886ac26 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoos_dragonfly.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `dragonfly` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 1 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoos_freebsd.go b/hack/go1_7_2/runtime/internal/sys/zgoos_freebsd.go new file mode 100644 index 0000000..0bf2403 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoos_freebsd.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `freebsd` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 1 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoos_linux.go b/hack/go1_7_2/runtime/internal/sys/zgoos_linux.go new file mode 100644 index 0000000..c8664db --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoos_linux.go @@ -0,0 +1,19 @@ +// generated by gengoos.go using 'go generate' + +// +build !android + +package sys + +const GOOS = `linux` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 1 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoos_nacl.go b/hack/go1_7_2/runtime/internal/sys/zgoos_nacl.go new file mode 100644 index 0000000..0541226 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoos_nacl.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `nacl` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 1 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoos_netbsd.go b/hack/go1_7_2/runtime/internal/sys/zgoos_netbsd.go new file mode 100644 index 0000000..5c509a1 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoos_netbsd.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `netbsd` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 1 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoos_openbsd.go b/hack/go1_7_2/runtime/internal/sys/zgoos_openbsd.go new file mode 100644 index 0000000..dc43157 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoos_openbsd.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `openbsd` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 1 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoos_plan9.go b/hack/go1_7_2/runtime/internal/sys/zgoos_plan9.go new file mode 100644 index 0000000..4b0934f --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoos_plan9.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `plan9` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 1 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoos_solaris.go b/hack/go1_7_2/runtime/internal/sys/zgoos_solaris.go new file mode 100644 index 0000000..42511a3 --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoos_solaris.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `solaris` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 1 +const GoosWindows = 0 diff --git a/hack/go1_7_2/runtime/internal/sys/zgoos_windows.go b/hack/go1_7_2/runtime/internal/sys/zgoos_windows.go new file mode 100644 index 0000000..d77f62c --- /dev/null +++ b/hack/go1_7_2/runtime/internal/sys/zgoos_windows.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `windows` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 1 diff --git a/hack/go1_7_2/runtime/lfstack_64bit.go b/hack/go1_7_2/runtime/lfstack_64bit.go new file mode 100644 index 0000000..9bb9eeb --- /dev/null +++ b/hack/go1_7_2/runtime/lfstack_64bit.go @@ -0,0 +1,13 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build amd64 arm64 mips64 mips64le ppc64 ppc64le s390x + +package runtime + +const ( + addrBits = 48 + + cntBits = 64 - addrBits + 3 +) diff --git a/hack/go1_7_2/runtime/lock_futex.go b/hack/go1_7_2/runtime/lock_futex.go new file mode 100644 index 0000000..4ef26b0 --- /dev/null +++ b/hack/go1_7_2/runtime/lock_futex.go @@ -0,0 +1,17 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build dragonfly freebsd linux + +package runtime + +const ( + mutex_unlocked = 0 + mutex_locked = 1 + mutex_sleeping = 2 + + active_spin = 4 + active_spin_cnt = 30 + passive_spin = 1 +) diff --git a/hack/go1_7_2/runtime/lock_sema.go b/hack/go1_7_2/runtime/lock_sema.go new file mode 100644 index 0000000..3b62d55 --- /dev/null +++ b/hack/go1_7_2/runtime/lock_sema.go @@ -0,0 +1,28 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build darwin nacl netbsd openbsd plan9 solaris windows + +package runtime + +// This implementation depends on OS-specific implementations of +// +// func semacreate(mp *m) +// Create a semaphore for mp, if it does not already have one. +// +// func semasleep(ns int64) int32 +// If ns < 0, acquire m's semaphore and return 0. +// If ns >= 0, try to acquire m's semaphore for at most ns nanoseconds. +// Return 0 if the semaphore was acquired, -1 if interrupted or timed out. +// +// func semawakeup(mp *m) +// Wake up mp, which is or will soon be sleeping on its semaphore. +// +const ( + locked uintptr = 1 + + active_spin = 4 + active_spin_cnt = 30 + passive_spin = 1 +) diff --git a/hack/go1_7_2/runtime/malloc.go b/hack/go1_7_2/runtime/malloc.go new file mode 100644 index 0000000..789e5af --- /dev/null +++ b/hack/go1_7_2/runtime/malloc.go @@ -0,0 +1,142 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Memory allocator, based on tcmalloc. +// http://goog-perftools.sourceforge.net/doc/tcmalloc.html + +// The main allocator works in runs of pages. +// Small allocation sizes (up to and including 32 kB) are +// rounded to one of about 100 size classes, each of which +// has its own free list of objects of exactly that size. +// Any free page of memory can be split into a set of objects +// of one size class, which are then managed using free list +// allocators. +// +// The allocator's data structures are: +// +// FixAlloc: a free-list allocator for fixed-size objects, +// used to manage storage used by the allocator. +// MHeap: the malloc heap, managed at page (4096-byte) granularity. +// MSpan: a run of pages managed by the MHeap. +// MCentral: a shared free list for a given size class. +// MCache: a per-thread (in Go, per-P) cache for small objects. +// MStats: allocation statistics. +// +// Allocating a small object proceeds up a hierarchy of caches: +// +// 1. Round the size up to one of the small size classes +// and look in the corresponding MCache free list. +// If the list is not empty, allocate an object from it. +// This can all be done without acquiring a lock. +// +// 2. If the MCache free list is empty, replenish it by +// taking a bunch of objects from the MCentral free list. +// Moving a bunch amortizes the cost of acquiring the MCentral lock. +// +// 3. If the MCentral free list is empty, replenish it by +// allocating a run of pages from the MHeap and then +// chopping that memory into objects of the given size. +// Allocating many objects amortizes the cost of locking +// the heap. +// +// 4. If the MHeap is empty or has no page runs large enough, +// allocate a new group of pages (at least 1MB) from the +// operating system. Allocating a large run of pages +// amortizes the cost of talking to the operating system. +// +// Freeing a small object proceeds up the same hierarchy: +// +// 1. Look up the size class for the object and add it to +// the MCache free list. +// +// 2. If the MCache free list is too long or the MCache has +// too much memory, return some to the MCentral free lists. +// +// 3. If all the objects in a given span have returned to +// the MCentral list, return that span to the page heap. +// +// 4. If the heap has too much memory, return some to the +// operating system. +// +// TODO(rsc): Step 4 is not implemented. +// +// Allocating and freeing a large object uses the page heap +// directly, bypassing the MCache and MCentral free lists. +// +// The small objects on the MCache and MCentral free lists +// may or may not be zeroed. They are zeroed if and only if +// the second word of the object is zero. A span in the +// page heap is zeroed unless s->needzero is set. When a span +// is allocated to break into small objects, it is zeroed if needed +// and s->needzero is set. There are two main benefits to delaying the +// zeroing this way: +// +// 1. stack frames allocated from the small object lists +// or the page heap can avoid zeroing altogether. +// 2. the cost of zeroing when reusing a small object is +// charged to the mutator, not the garbage collector. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_2/runtime/internal/sys" + "unsafe" +) + +const ( + debugMalloc = false + + maxTinySize = _TinySize + tinySizeClass = _TinySizeClass + maxSmallSize = _MaxSmallSize + + pageShift = _PageShift + pageSize = _PageSize + pageMask = _PageMask + + maxObjsPerSpan = pageSize / 8 + + mSpanInUse = _MSpanInUse + + concurrentSweep = _ConcurrentSweep +) + +const ( + _PageShift = 13 + _PageSize = 1 << _PageShift + _PageMask = _PageSize - 1 +) + +const ( + _64bit = 1 << (^uintptr(0) >> 63) / 2 + + _NumSizeClasses = 67 + + _MaxSmallSize = 32 << 10 + + _TinySize = 16 + _TinySizeClass = 2 + + _FixAllocChunk = 16 << 10 + _MaxMHeapList = 1 << (20 - _PageShift) + _HeapAllocChunk = 1 << 20 + + _StackCacheSize = 32 * 1024 + + _NumStackOrders = 4 - sys.PtrSize/4*sys.GoosWindows - 1*sys.GoosPlan9 + + _MHeapMap_TotalBits = (_64bit*sys.GoosWindows)*35 + (_64bit*(1-sys.GoosWindows)*(1-sys.GoosDarwin*sys.GoarchArm64))*39 + sys.GoosDarwin*sys.GoarchArm64*31 + (1-_64bit)*32 + _MHeapMap_Bits = _MHeapMap_TotalBits - _PageShift + + _MaxMem = uintptr(1<<_MHeapMap_TotalBits - 1) + + _MaxGcproc = 32 +) + +const _MaxArena32 = 1<<32 - 1 + +type persistentAlloc struct { + base unsafe.Pointer + off uintptr +} diff --git a/hack/go1_7_2/runtime/mbitmap.go b/hack/go1_7_2/runtime/mbitmap.go new file mode 100644 index 0000000..3648c43 --- /dev/null +++ b/hack/go1_7_2/runtime/mbitmap.go @@ -0,0 +1,110 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Garbage collector: type and heap bitmaps. +// +// Stack, data, and bss bitmaps +// +// Stack frames and global variables in the data and bss sections are described +// by 1-bit bitmaps in which 0 means uninteresting and 1 means live pointer +// to be visited during GC. The bits in each byte are consumed starting with +// the low bit: 1<<0, 1<<1, and so on. +// +// Heap bitmap +// +// The allocated heap comes from a subset of the memory in the range [start, used), +// where start == mheap_.arena_start and used == mheap_.arena_used. +// The heap bitmap comprises 2 bits for each pointer-sized word in that range, +// stored in bytes indexed backward in memory from start. +// That is, the byte at address start-1 holds the 2-bit entries for the four words +// start through start+3*ptrSize, the byte at start-2 holds the entries for +// start+4*ptrSize through start+7*ptrSize, and so on. +// +// In each 2-bit entry, the lower bit holds the same information as in the 1-bit +// bitmaps: 0 means uninteresting and 1 means live pointer to be visited during GC. +// The meaning of the high bit depends on the position of the word being described +// in its allocated object. In all words *except* the second word, the +// high bit indicates that the object is still being described. In +// these words, if a bit pair with a high bit 0 is encountered, the +// low bit can also be assumed to be 0, and the object description is +// over. This 00 is called the ``dead'' encoding: it signals that the +// rest of the words in the object are uninteresting to the garbage +// collector. +// +// In the second word, the high bit is the GC ``checkmarked'' bit (see below). +// +// The 2-bit entries are split when written into the byte, so that the top half +// of the byte contains 4 high bits and the bottom half contains 4 low (pointer) +// bits. +// This form allows a copy from the 1-bit to the 4-bit form to keep the +// pointer bits contiguous, instead of having to space them out. +// +// The code makes use of the fact that the zero value for a heap bitmap +// has no live pointer bit set and is (depending on position), not used, +// not checkmarked, and is the dead encoding. +// These properties must be preserved when modifying the encoding. +// +// Checkmarks +// +// In a concurrent garbage collector, one worries about failing to mark +// a live object due to mutations without write barriers or bugs in the +// collector implementation. As a sanity check, the GC has a 'checkmark' +// mode that retraverses the object graph with the world stopped, to make +// sure that everything that should be marked is marked. +// In checkmark mode, in the heap bitmap, the high bit of the 2-bit entry +// for the second word of the object holds the checkmark bit. +// When not in checkmark mode, this bit is set to 1. +// +// The smallest possible allocation is 8 bytes. On a 32-bit machine, that +// means every allocated object has two words, so there is room for the +// checkmark bit. On a 64-bit machine, however, the 8-byte allocation is +// just one word, so the second bit pair is not available for encoding the +// checkmark. However, because non-pointer allocations are combined +// into larger 16-byte (maxTinySize) allocations, a plain 8-byte allocation +// must be a pointer, so the type bit in the first word is not actually needed. +// It is still used in general, except in checkmark the type bit is repurposed +// as the checkmark bit and then reinitialized (to 1) as the type bit when +// finished. +// + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_2/runtime/internal/sys" +) + +const ( + bitPointer = 1 << 0 + bitMarked = 1 << 4 + + heapBitsShift = 1 + heapBitmapScale = sys.PtrSize * (8 / 2) + + bitMarkedAll = bitMarked | bitMarked<nonempty) +// and those that are completely allocated (c->empty). + +package runtime + +// Central list of free objects of a given size. +type mcentral struct { + lock mutex + sizeclass int32 + nonempty mSpanList + empty mSpanList +} diff --git a/hack/go1_7_2/runtime/mem_bsd.go b/hack/go1_7_2/runtime/mem_bsd.go new file mode 100644 index 0000000..866387a --- /dev/null +++ b/hack/go1_7_2/runtime/mem_bsd.go @@ -0,0 +1,9 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build dragonfly freebsd nacl netbsd openbsd solaris + +package runtime + +const _ENOMEM = 12 diff --git a/hack/go1_7_2/runtime/mem_darwin.go b/hack/go1_7_2/runtime/mem_darwin.go new file mode 100644 index 0000000..3f513c7 --- /dev/null +++ b/hack/go1_7_2/runtime/mem_darwin.go @@ -0,0 +1,9 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _ENOMEM = 12 +) diff --git a/hack/go1_7_2/runtime/mem_linux.go b/hack/go1_7_2/runtime/mem_linux.go new file mode 100644 index 0000000..12fc226 --- /dev/null +++ b/hack/go1_7_2/runtime/mem_linux.go @@ -0,0 +1,10 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _EACCES = 13 + _EINVAL = 22 +) diff --git a/hack/go1_7_2/runtime/mem_plan9.go b/hack/go1_7_2/runtime/mem_plan9.go new file mode 100644 index 0000000..cc782e0 --- /dev/null +++ b/hack/go1_7_2/runtime/mem_plan9.go @@ -0,0 +1,14 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const memDebug = false + +type memHdr struct { + next memHdrPtr + size uintptr +} + +type memHdrPtr uintptr diff --git a/hack/go1_7_2/runtime/mem_windows.go b/hack/go1_7_2/runtime/mem_windows.go new file mode 100644 index 0000000..62d3461 --- /dev/null +++ b/hack/go1_7_2/runtime/mem_windows.go @@ -0,0 +1,15 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _MEM_COMMIT = 0x1000 + _MEM_RESERVE = 0x2000 + _MEM_DECOMMIT = 0x4000 + _MEM_RELEASE = 0x8000 + + _PAGE_READWRITE = 0x0004 + _PAGE_NOACCESS = 0x0001 +) diff --git a/hack/go1_7_2/runtime/mfinal.go b/hack/go1_7_2/runtime/mfinal.go new file mode 100644 index 0000000..eac5851 --- /dev/null +++ b/hack/go1_7_2/runtime/mfinal.go @@ -0,0 +1,29 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Garbage collector: finalizers and block profiling. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_2/runtime/internal/sys" + "unsafe" +) + +type finblock struct { + alllink *finblock + next *finblock + cnt int32 + _ int32 + fin [(_FinBlockSize - 2*sys.PtrSize - 2*4) / unsafe.Sizeof(finalizer{})]finalizer +} + +// NOTE: Layout known to queuefinalizer. +type finalizer struct { + fn *funcval + arg unsafe.Pointer + nret uintptr + fint *_type + ot *ptrtype +} diff --git a/hack/go1_7_2/runtime/mfixalloc.go b/hack/go1_7_2/runtime/mfixalloc.go new file mode 100644 index 0000000..211a124 --- /dev/null +++ b/hack/go1_7_2/runtime/mfixalloc.go @@ -0,0 +1,39 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Fixed-size object allocator. Returned memory is not zeroed. +// +// See malloc.go for overview. + +package runtime + +import "unsafe" + +// FixAlloc is a simple free-list allocator for fixed size objects. +// Malloc uses a FixAlloc wrapped around sysAlloc to manages its +// MCache and MSpan objects. +// +// Memory returned by FixAlloc_Alloc is not zeroed. +// The caller is responsible for locking around FixAlloc calls. +// Callers can keep state in the object but the first word is +// smashed by freeing and reallocating. +type fixalloc struct { + size uintptr + first func(arg, p unsafe.Pointer) + arg unsafe.Pointer + list *mlink + chunk unsafe.Pointer + nchunk uint32 + inuse uintptr + stat *uint64 +} + +// A generic linked list of blocks. (Typically the block is bigger than sizeof(MLink).) +// Since assignments to mlink.next will result in a write barrier being performed +// this cannot be used by some of the internal GC structures. For example when +// the sweeper is placing an unmarked object on the free list it does not want the +// write barrier to be called since that could result in the object being reachable. +type mlink struct { + next *mlink +} diff --git a/hack/go1_7_2/runtime/mgc.go b/hack/go1_7_2/runtime/mgc.go new file mode 100644 index 0000000..d345859 --- /dev/null +++ b/hack/go1_7_2/runtime/mgc.go @@ -0,0 +1,227 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// TODO(rsc): The code having to do with the heap bitmap needs very serious cleanup. +// It has gotten completely out of control. + +// Garbage collector (GC). +// +// The GC runs concurrently with mutator threads, is type accurate (aka precise), allows multiple +// GC thread to run in parallel. It is a concurrent mark and sweep that uses a write barrier. It is +// non-generational and non-compacting. Allocation is done using size segregated per P allocation +// areas to minimize fragmentation while eliminating locks in the common case. +// +// The algorithm decomposes into several steps. +// This is a high level description of the algorithm being used. For an overview of GC a good +// place to start is Richard Jones' gchandbook.org. +// +// The algorithm's intellectual heritage includes Dijkstra's on-the-fly algorithm, see +// Edsger W. Dijkstra, Leslie Lamport, A. J. Martin, C. S. Scholten, and E. F. M. Steffens. 1978. +// On-the-fly garbage collection: an exercise in cooperation. Commun. ACM 21, 11 (November 1978), +// 966-975. +// For journal quality proofs that these steps are complete, correct, and terminate see +// Hudson, R., and Moss, J.E.B. Copying Garbage Collection without stopping the world. +// Concurrency and Computation: Practice and Experience 15(3-5), 2003. +// +// TODO(austin): The rest of this comment is woefully out of date and +// needs to be rewritten. There is no distinct scan phase any more and +// we allocate black during GC. +// +// 0. Set phase = GCscan from GCoff. +// 1. Wait for all P's to acknowledge phase change. +// At this point all goroutines have passed through a GC safepoint and +// know we are in the GCscan phase. +// 2. GC scans all goroutine stacks, mark and enqueues all encountered pointers +// (marking avoids most duplicate enqueuing but races may produce benign duplication). +// Preempted goroutines are scanned before P schedules next goroutine. +// 3. Set phase = GCmark. +// 4. Wait for all P's to acknowledge phase change. +// 5. Now write barrier marks and enqueues black, grey, or white to white pointers. +// Malloc still allocates white (non-marked) objects. +// 6. Meanwhile GC transitively walks the heap marking reachable objects. +// 7. When GC finishes marking heap, it preempts P's one-by-one and +// retakes partial wbufs (filled by write barrier or during a stack scan of the goroutine +// currently scheduled on the P). +// 8. Once the GC has exhausted all available marking work it sets phase = marktermination. +// 9. Wait for all P's to acknowledge phase change. +// 10. Malloc now allocates black objects, so number of unmarked reachable objects +// monotonically decreases. +// 11. GC preempts P's one-by-one taking partial wbufs and marks all unmarked yet +// reachable objects. +// 12. When GC completes a full cycle over P's and discovers no new grey +// objects, (which means all reachable objects are marked) set phase = GCoff. +// 13. Wait for all P's to acknowledge phase change. +// 14. Now malloc allocates white (but sweeps spans before use). +// Write barrier becomes nop. +// 15. GC does background sweeping, see description below. +// 16. When sufficient allocation has taken place replay the sequence starting at 0 above, +// see discussion of GC rate below. + +// Changing phases. +// Phases are changed by setting the gcphase to the next phase and possibly calling ackgcphase. +// All phase action must be benign in the presence of a change. +// Starting with GCoff +// GCoff to GCscan +// GSscan scans stacks and globals greying them and never marks an object black. +// Once all the P's are aware of the new phase they will scan gs on preemption. +// This means that the scanning of preempted gs can't start until all the Ps +// have acknowledged. +// When a stack is scanned, this phase also installs stack barriers to +// track how much of the stack has been active. +// This transition enables write barriers because stack barriers +// assume that writes to higher frames will be tracked by write +// barriers. Technically this only needs write barriers for writes +// to stack slots, but we enable write barriers in general. +// GCscan to GCmark +// In GCmark, work buffers are drained until there are no more +// pointers to scan. +// No scanning of objects (making them black) can happen until all +// Ps have enabled the write barrier, but that already happened in +// the transition to GCscan. +// GCmark to GCmarktermination +// The only change here is that we start allocating black so the Ps must acknowledge +// the change before we begin the termination algorithm +// GCmarktermination to GSsweep +// Object currently on the freelist must be marked black for this to work. +// Are things on the free lists black or white? How does the sweep phase work? + +// Concurrent sweep. +// +// The sweep phase proceeds concurrently with normal program execution. +// The heap is swept span-by-span both lazily (when a goroutine needs another span) +// and concurrently in a background goroutine (this helps programs that are not CPU bound). +// At the end of STW mark termination all spans are marked as "needs sweeping". +// +// The background sweeper goroutine simply sweeps spans one-by-one. +// +// To avoid requesting more OS memory while there are unswept spans, when a +// goroutine needs another span, it first attempts to reclaim that much memory +// by sweeping. When a goroutine needs to allocate a new small-object span, it +// sweeps small-object spans for the same object size until it frees at least +// one object. When a goroutine needs to allocate large-object span from heap, +// it sweeps spans until it frees at least that many pages into heap. There is +// one case where this may not suffice: if a goroutine sweeps and frees two +// nonadjacent one-page spans to the heap, it will allocate a new two-page +// span, but there can still be other one-page unswept spans which could be +// combined into a two-page span. +// +// It's critical to ensure that no operations proceed on unswept spans (that would corrupt +// mark bits in GC bitmap). During GC all mcaches are flushed into the central cache, +// so they are empty. When a goroutine grabs a new span into mcache, it sweeps it. +// When a goroutine explicitly frees an object or sets a finalizer, it ensures that +// the span is swept (either by sweeping it, or by waiting for the concurrent sweep to finish). +// The finalizer goroutine is kicked off only when all spans are swept. +// When the next GC starts, it sweeps all not-yet-swept spans (if any). + +// GC rate. +// Next GC is after we've allocated an extra amount of memory proportional to +// the amount already in use. The proportion is controlled by GOGC environment variable +// (100 by default). If GOGC=100 and we're using 4M, we'll GC again when we get to 8M +// (this mark is tracked in next_gc variable). This keeps the GC cost in linear +// proportion to the allocation cost. Adjusting GOGC just changes the linear constant +// (and also the amount of extra memory used). + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_2/runtime/internal/sys" +) + +const ( + _DebugGC = 0 + _ConcurrentSweep = true + _FinBlockSize = 4 * 1024 + + sweepMinHeapDistance = 1024 * 1024 +) + +// defaultHeapMinimum is the value of heapminimum for GOGC==100. +const defaultHeapMinimum = 4 << 20 + +const ( + _GCoff = iota + _GCmark + _GCmarktermination +) + +// gcMarkWorkerMode represents the mode that a concurrent mark worker +// should operate in. +// +// Concurrent marking happens through four different mechanisms. One +// is mutator assists, which happen in response to allocations and are +// not scheduled. The other three are variations in the per-P mark +// workers and are distinguished by gcMarkWorkerMode. +type gcMarkWorkerMode int + +const ( + gcMarkWorkerDedicatedMode gcMarkWorkerMode = iota + + gcMarkWorkerFractionalMode + + gcMarkWorkerIdleMode +) + +type gcControllerState struct { + scanWork int64 + + bgScanCredit int64 + + assistTime int64 + + dedicatedMarkTime int64 + + fractionalMarkTime int64 + + idleMarkTime int64 + + markStartTime int64 + + heapGoal uint64 + + dedicatedMarkWorkersNeeded int64 + + assistWorkPerByte float64 + + assistBytesPerWork float64 + + fractionalUtilizationGoal float64 + + triggerRatio float64 + + _ [sys.CacheLineSize]byte + + fractionalMarkWorkersNeeded int64 + + _ [sys.CacheLineSize]byte +} + +// gcGoalUtilization is the goal CPU utilization for background +// marking as a fraction of GOMAXPROCS. +const gcGoalUtilization = 0.25 + +// gcCreditSlack is the amount of scan work credit that can can +// accumulate locally before updating gcController.scanWork and, +// optionally, gcController.bgScanCredit. Lower values give a more +// accurate assist ratio and make it more likely that assists will +// successfully steal background credit. Higher values reduce memory +// contention. +const gcCreditSlack = 2000 + +// gcAssistTimeSlack is the nanoseconds of mutator assist time that +// can accumulate on a P before updating gcController.assistTime. +const gcAssistTimeSlack = 5000 + +// gcOverAssistWork determines how many extra units of scan work a GC +// assist does when an assist happens. This amortizes the cost of an +// assist by pre-paying for this many bytes of future allocations. +const gcOverAssistWork = 64 << 10 + +// gcMode indicates how concurrent a GC cycle should be. +type gcMode int + +const ( + gcBackgroundMode gcMode = iota + gcForceMode + gcForceBlockMode +) diff --git a/hack/go1_7_2/runtime/mgcmark.go b/hack/go1_7_2/runtime/mgcmark.go new file mode 100644 index 0000000..882dd96 --- /dev/null +++ b/hack/go1_7_2/runtime/mgcmark.go @@ -0,0 +1,28 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Garbage collector: marking and scanning + +package runtime + +const ( + fixedRootFinalizers = iota + fixedRootFlushCaches + fixedRootFreeGStacks + fixedRootCount + + rootBlockBytes = 256 << 10 + + rootBlockSpans = 8 * 1024 +) + +type gcDrainFlags int + +const ( + gcDrainUntilPreempt gcDrainFlags = 1 << iota + gcDrainNoBlock + gcDrainFlushBgCredit + + gcDrainBlock gcDrainFlags = 0 +) diff --git a/hack/go1_7_2/runtime/mgcsweep.go b/hack/go1_7_2/runtime/mgcsweep.go new file mode 100644 index 0000000..a047137 --- /dev/null +++ b/hack/go1_7_2/runtime/mgcsweep.go @@ -0,0 +1,20 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Garbage collector: sweeping + +package runtime + +// State of background sweep. +type sweepdata struct { + lock mutex + g *g + parked bool + started bool + + spanidx uint32 + + nbgsweep uint32 + npausesweep uint32 +} diff --git a/hack/go1_7_2/runtime/mgcwork.go b/hack/go1_7_2/runtime/mgcwork.go new file mode 100644 index 0000000..577efdd --- /dev/null +++ b/hack/go1_7_2/runtime/mgcwork.go @@ -0,0 +1,54 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_2/runtime/internal/sys" + "unsafe" +) + +const ( + _WorkbufSize = 2048 +) + +// A wbufptr holds a workbuf*, but protects it from write barriers. +// workbufs never live on the heap, so write barriers are unnecessary. +// Write barriers on workbuf pointers may also be dangerous in the GC. +type wbufptr uintptr + +// A gcWork provides the interface to produce and consume work for the +// garbage collector. +// +// A gcWork can be used on the stack as follows: +// +// (preemption must be disabled) +// gcw := &getg().m.p.ptr().gcw +// .. call gcw.put() to produce and gcw.get() to consume .. +// if gcBlackenPromptly { +// gcw.dispose() +// } +// +// It's important that any use of gcWork during the mark phase prevent +// the garbage collector from transitioning to mark termination since +// gcWork may locally hold GC work buffers. This can be done by +// disabling preemption (systemstack or acquirem). +type gcWork struct { + wbuf1, wbuf2 wbufptr + + bytesMarked uint64 + + scanWork int64 +} + +type workbufhdr struct { + node lfnode + nobj int +} + +type workbuf struct { + workbufhdr + + obj [(_WorkbufSize - unsafe.Sizeof(workbufhdr{})) / sys.PtrSize]uintptr +} diff --git a/hack/go1_7_2/runtime/mheap.go b/hack/go1_7_2/runtime/mheap.go new file mode 100644 index 0000000..0d39c8b --- /dev/null +++ b/hack/go1_7_2/runtime/mheap.go @@ -0,0 +1,170 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Page heap. +// +// See malloc.go for overview. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_2/runtime/internal/sys" + "unsafe" +) + +// minPhysPageSize is a lower-bound on the physical page size. The +// true physical page size may be larger than this. In contrast, +// sys.PhysPageSize is an upper-bound on the physical page size. +const minPhysPageSize = 4096 + +// Main malloc heap. +// The heap itself is the "free[]" and "large" arrays, +// but all the other global data is here too. +type mheap struct { + lock mutex + free [_MaxMHeapList]mSpanList + freelarge mSpanList + busy [_MaxMHeapList]mSpanList + busylarge mSpanList + allspans **mspan + gcspans **mspan + nspan uint32 + sweepgen uint32 + sweepdone uint32 + + spans **mspan + spans_mapped uintptr + + pagesInUse uint64 + spanBytesAlloc uint64 + pagesSwept uint64 + sweepPagesPerByte float64 + + largefree uint64 + nlargefree uint64 + nsmallfree [_NumSizeClasses]uint64 + + bitmap uintptr + bitmap_mapped uintptr + arena_start uintptr + arena_used uintptr + arena_end uintptr + arena_reserved bool + + central [_NumSizeClasses]struct { + mcentral mcentral + pad [sys.CacheLineSize]byte + } + + spanalloc fixalloc + cachealloc fixalloc + specialfinalizeralloc fixalloc + specialprofilealloc fixalloc + speciallock mutex +} + +// An MSpan representing actual memory has state _MSpanInUse, +// _MSpanStack, or _MSpanFree. Transitions between these states are +// constrained as follows: +// +// * A span may transition from free to in-use or stack during any GC +// phase. +// +// * During sweeping (gcphase == _GCoff), a span may transition from +// in-use to free (as a result of sweeping) or stack to free (as a +// result of stacks being freed). +// +// * During GC (gcphase != _GCoff), a span *must not* transition from +// stack or in-use to free. Because concurrent GC may read a pointer +// and then look up its span, the span state must be monotonic. +const ( + _MSpanInUse = iota + _MSpanStack + _MSpanFree + _MSpanDead +) + +// mSpanList heads a linked list of spans. +// +// Linked list structure is based on BSD's "tail queue" data structure. +type mSpanList struct { + first *mspan + last **mspan +} + +type mspan struct { + next *mspan + prev **mspan + list *mSpanList + + startAddr uintptr + npages uintptr + stackfreelist gclinkptr + + freeindex uintptr + + nelems uintptr + + allocCache uint64 + + allocBits *uint8 + gcmarkBits *uint8 + + sweepgen uint32 + divMul uint32 + allocCount uint16 + sizeclass uint8 + incache bool + state uint8 + needzero uint8 + divShift uint8 + divShift2 uint8 + elemsize uintptr + unusedsince int64 + npreleased uintptr + limit uintptr + speciallock mutex + specials *special + baseMask uintptr +} + +const ( + _KindSpecialFinalizer = 1 + _KindSpecialProfile = 2 +) + +type special struct { + next *special + offset uint16 + kind byte +} + +// The described object has a finalizer set for it. +type specialfinalizer struct { + special special + fn *funcval + nret uintptr + fint *_type + ot *ptrtype +} + +// The described object is being heap profiled. +type specialprofile struct { + special special + b *bucket +} + +const gcBitsChunkBytes = uintptr(64 << 10) +const gcBitsHeaderBytes = unsafe.Sizeof(gcBitsHeader{}) + +type gcBitsHeader struct { + free uintptr + next uintptr +} + +type gcBits struct { + free uintptr + next *gcBits + bits [gcBitsChunkBytes - gcBitsHeaderBytes]uint8 +} diff --git a/hack/go1_7_2/runtime/mprof.go b/hack/go1_7_2/runtime/mprof.go new file mode 100644 index 0000000..5ed72c0 --- /dev/null +++ b/hack/go1_7_2/runtime/mprof.go @@ -0,0 +1,83 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Malloc profiling. +// Patterned after tcmalloc's algorithms; shorter code. + +package runtime + +const ( + memProfile bucketType = 1 + iota + blockProfile + + buckHashSize = 179999 + + maxStack = 32 +) + +type bucketType int + +// A bucket holds per-call-stack profiling information. +// The representation is a bit sleazy, inherited from C. +// This struct defines the bucket header. It is followed in +// memory by the stack words and then the actual record +// data, either a memRecord or a blockRecord. +// +// Per-call-stack profiling information. +// Lookup by hashing call stack into a linked-list hash table. +type bucket struct { + next *bucket + allnext *bucket + typ bucketType + hash uintptr + size uintptr + nstk uintptr +} + +// A memRecord is the bucket data for a bucket of type memProfile, +// part of the memory profile. +type memRecord struct { + allocs uintptr + frees uintptr + alloc_bytes uintptr + free_bytes uintptr + + prev_allocs uintptr + prev_frees uintptr + prev_alloc_bytes uintptr + prev_free_bytes uintptr + + recent_allocs uintptr + recent_frees uintptr + recent_alloc_bytes uintptr + recent_free_bytes uintptr +} + +// A blockRecord is the bucket data for a bucket of type blockProfile, +// part of the blocking profile. +type blockRecord struct { + count int64 + cycles int64 +} + +// A StackRecord describes a single execution stack. +type StackRecord struct { + Stack0 [32]uintptr +} + +// A MemProfileRecord describes the live objects allocated +// by a particular call sequence (stack trace). +type MemProfileRecord struct { + AllocBytes, FreeBytes int64 + AllocObjects, FreeObjects int64 + Stack0 [32]uintptr +} + +// BlockProfileRecord describes blocking events originated +// at a particular call sequence (stack trace). +type BlockProfileRecord struct { + Count int64 + Cycles int64 + StackRecord +} diff --git a/hack/go1_7_2/runtime/msan.go b/hack/go1_7_2/runtime/msan.go new file mode 100644 index 0000000..4e84b2d --- /dev/null +++ b/hack/go1_7_2/runtime/msan.go @@ -0,0 +1,10 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build msan + +package runtime + +// Private interface for the runtime. +const msanenabled = true diff --git a/hack/go1_7_2/runtime/msan0.go b/hack/go1_7_2/runtime/msan0.go new file mode 100644 index 0000000..8f1516d --- /dev/null +++ b/hack/go1_7_2/runtime/msan0.go @@ -0,0 +1,11 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !msan + +// Dummy MSan support API, used when not built with -msan. + +package runtime + +const msanenabled = false diff --git a/hack/go1_7_2/runtime/msize.go b/hack/go1_7_2/runtime/msize.go new file mode 100644 index 0000000..80765e0 --- /dev/null +++ b/hack/go1_7_2/runtime/msize.go @@ -0,0 +1,59 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Malloc small size classes. +// +// See malloc.go for overview. +// +// The size classes are chosen so that rounding an allocation +// request up to the next size class wastes at most 12.5% (1.125x). +// +// Each size class has its own page count that gets allocated +// and chopped up when new objects of the size class are needed. +// That page count is chosen so that chopping up the run of +// pages into objects of the given size wastes at most 12.5% (1.125x) +// of the memory. It is not necessary that the cutoff here be +// the same as above. +// +// The two sources of waste multiply, so the worst possible case +// for the above constraints would be that allocations of some +// size might have a 26.6% (1.266x) overhead. +// In practice, only one of the wastes comes into play for a +// given size (sizes < 512 waste mainly on the round-up, +// sizes > 512 waste mainly on the page chopping). +// +// TODO(rsc): Compute max waste for any given size. + +package runtime + +// divMagic holds magic constants to implement division +// by a particular constant as a shift, multiply, and shift. +// That is, given +// m = computeMagic(d) +// then +// n/d == ((n>>m.shift) * m.mul) >> m.shift2 +// +// The magic computation picks m such that +// d = d₁*d₂ +// d₂= 2^m.shift +// m.mul = ⌈2^m.shift2 / d₁⌉ +// +// The magic computation here is tailored for malloc block sizes +// and does not handle arbitrary d correctly. Malloc block sizes d are +// always even, so the first shift implements the factors of 2 in d +// and then the mul and second shift implement the odd factor +// that remains. Because the first shift divides n by at least 2 (actually 8) +// before the multiply gets involved, the huge corner cases that +// require additional adjustment are impossible, so the usual +// fixup is not needed. +// +// For more details see Hacker's Delight, Chapter 10, and +// http://ridiculousfish.com/blog/posts/labor-of-division-episode-i.html +// http://ridiculousfish.com/blog/posts/labor-of-division-episode-iii.html +type divMagic struct { + shift uint8 + mul uint32 + shift2 uint8 + baseMask uintptr +} diff --git a/hack/go1_7_2/runtime/mstats.go b/hack/go1_7_2/runtime/mstats.go new file mode 100644 index 0000000..8b92974 --- /dev/null +++ b/hack/go1_7_2/runtime/mstats.go @@ -0,0 +1,104 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Memory statistics + +package runtime + +// Statistics. +// If you edit this structure, also edit type MemStats below. +type mstats struct { + alloc uint64 + total_alloc uint64 + sys uint64 + nlookup uint64 + nmalloc uint64 + nfree uint64 + + heap_alloc uint64 + heap_sys uint64 + heap_idle uint64 + heap_inuse uint64 + heap_released uint64 + heap_objects uint64 + + stacks_inuse uint64 + stacks_sys uint64 + mspan_inuse uint64 + mspan_sys uint64 + mcache_inuse uint64 + mcache_sys uint64 + buckhash_sys uint64 + gc_sys uint64 + other_sys uint64 + + next_gc uint64 + last_gc uint64 + pause_total_ns uint64 + pause_ns [256]uint64 + pause_end [256]uint64 + numgc uint32 + gc_cpu_fraction float64 + enablegc bool + debuggc bool + + by_size [_NumSizeClasses]struct { + size uint32 + nmalloc uint64 + nfree uint64 + } + + tinyallocs uint64 + + heap_live uint64 + + heap_scan uint64 + + heap_marked uint64 + + heap_reachable uint64 +} + +// A MemStats records statistics about the memory allocator. +type MemStats struct { + Alloc uint64 + TotalAlloc uint64 + Sys uint64 + Lookups uint64 + Mallocs uint64 + Frees uint64 + + HeapAlloc uint64 + HeapSys uint64 + HeapIdle uint64 + HeapInuse uint64 + HeapReleased uint64 + HeapObjects uint64 + + StackInuse uint64 + StackSys uint64 + MSpanInuse uint64 + MSpanSys uint64 + MCacheInuse uint64 + MCacheSys uint64 + BuckHashSys uint64 + GCSys uint64 + OtherSys uint64 + + NextGC uint64 + LastGC uint64 + PauseTotalNs uint64 + PauseNs [256]uint64 + PauseEnd [256]uint64 + NumGC uint32 + GCCPUFraction float64 + EnableGC bool + DebugGC bool + + BySize [61]struct { + Size uint32 + Mallocs uint64 + Frees uint64 + } +} diff --git a/hack/go1_7_2/runtime/mstkbar.go b/hack/go1_7_2/runtime/mstkbar.go new file mode 100644 index 0000000..425ce60 --- /dev/null +++ b/hack/go1_7_2/runtime/mstkbar.go @@ -0,0 +1,128 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Garbage collector: stack barriers +// +// Stack barriers enable the garbage collector to determine how much +// of a gorountine stack has changed between when a stack is scanned +// during the concurrent scan phase and when it is re-scanned during +// the stop-the-world mark termination phase. Mark termination only +// needs to re-scan the changed part, so for deep stacks this can +// significantly reduce GC pause time compared to the alternative of +// re-scanning whole stacks. The deeper the stacks, the more stack +// barriers help. +// +// When stacks are scanned during the concurrent scan phase, the stack +// scan installs stack barriers by selecting stack frames and +// overwriting the saved return PCs (or link registers) of these +// frames with the PC of a "stack barrier trampoline". Later, when a +// selected frame returns, it "returns" to this trampoline instead of +// returning to its actual caller. The trampoline records that the +// stack has unwound past this frame and jumps to the original return +// PC recorded when the stack barrier was installed. Mark termination +// re-scans only as far as the first frame that hasn't hit a stack +// barrier and then removes and un-hit stack barriers. +// +// This scheme is very lightweight. No special code is required in the +// mutator to record stack unwinding and the trampoline is only a few +// assembly instructions. +// +// Book-keeping +// ------------ +// +// The primary cost of stack barriers is book-keeping: the runtime has +// to record the locations of all stack barriers and the original +// return PCs in order to return to the correct caller when a stack +// barrier is hit and so it can remove un-hit stack barriers. In order +// to minimize this cost, the Go runtime places stack barriers in +// exponentially-spaced frames, starting 1K past the current frame. +// The book-keeping structure hence grows logarithmically with the +// size of the stack and mark termination re-scans at most twice as +// much stack as necessary. +// +// The runtime reserves space for this book-keeping structure at the +// top of the stack allocation itself (just above the outermost +// frame). This is necessary because the regular memory allocator can +// itself grow the stack, and hence can't be used when allocating +// stack-related structures. +// +// For debugging, the runtime also supports installing stack barriers +// at every frame. However, this requires significantly more +// book-keeping space. +// +// Correctness +// ----------- +// +// The runtime and the compiler cooperate to ensure that all objects +// reachable from the stack as of mark termination are marked. +// Anything unchanged since the concurrent scan phase will be marked +// because it is marked by the concurrent scan. After the concurrent +// scan, there are three possible classes of stack modifications that +// must be tracked: +// +// 1) Mutator writes below the lowest un-hit stack barrier. This +// includes all writes performed by an executing function to its own +// stack frame. This part of the stack will be re-scanned by mark +// termination, which will mark any objects made reachable from +// modifications to this part of the stack. +// +// 2) Mutator writes above the lowest un-hit stack barrier. It's +// possible for a mutator to modify the stack above the lowest un-hit +// stack barrier if a higher frame has passed down a pointer to a +// stack variable in its frame. This is called an "up-pointer". The +// compiler ensures that writes through up-pointers have an +// accompanying write barrier (it simply doesn't distinguish between +// writes through up-pointers and writes through heap pointers). This +// write barrier marks any object made reachable from modifications to +// this part of the stack. +// +// 3) Runtime writes to the stack. Various runtime operations such as +// sends to unbuffered channels can write to arbitrary parts of the +// stack, including above the lowest un-hit stack barrier. We solve +// this in two ways. In many cases, the runtime can perform an +// explicit write barrier operation like in case 2. However, in the +// case of bulk memory move (typedmemmove), the runtime doesn't +// necessary have ready access to a pointer bitmap for the memory +// being copied, so it simply unwinds any stack barriers below the +// destination. +// +// Gotchas +// ------- +// +// Anything that inspects or manipulates the stack potentially needs +// to understand stack barriers. The most obvious case is that +// gentraceback needs to use the original return PC when it encounters +// the stack barrier trampoline. Anything that unwinds the stack such +// as panic/recover must unwind stack barriers in tandem with +// unwinding the stack. +// +// Stack barriers require that any goroutine whose stack has been +// scanned must execute write barriers. Go solves this by simply +// enabling write barriers globally during the concurrent scan phase. +// However, traditionally, write barriers are not enabled during this +// phase. +// +// Synchronization +// --------------- +// +// For the most part, accessing and modifying stack barriers is +// synchronized around GC safe points. Installing stack barriers +// forces the G to a safe point, while all other operations that +// modify stack barriers run on the G and prevent it from reaching a +// safe point. +// +// Subtlety arises when a G may be tracebacked when *not* at a safe +// point. This happens during sigprof. For this, each G has a "stack +// barrier lock" (see gcLockStackBarriers, gcUnlockStackBarriers). +// Operations that manipulate stack barriers acquire this lock, while +// sigprof tries to acquire it and simply skips the traceback if it +// can't acquire it. There is one exception for performance and +// complexity reasons: hitting a stack barrier manipulates the stack +// barrier list without acquiring the stack barrier lock. For this, +// gentraceback performs a special fix up if the traceback starts in +// the stack barrier function. + +package runtime + +const debugStackBarrier = false diff --git a/hack/go1_7_2/runtime/netpoll.go b/hack/go1_7_2/runtime/netpoll.go new file mode 100644 index 0000000..fb5fa21 --- /dev/null +++ b/hack/go1_7_2/runtime/netpoll.go @@ -0,0 +1,48 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows + +package runtime + +// pollDesc contains 2 binary semaphores, rg and wg, to park reader and writer +// goroutines respectively. The semaphore can be in the following states: +// pdReady - io readiness notification is pending; +// a goroutine consumes the notification by changing the state to nil. +// pdWait - a goroutine prepares to park on the semaphore, but not yet parked; +// the goroutine commits to park by changing the state to G pointer, +// or, alternatively, concurrent io notification changes the state to READY, +// or, alternatively, concurrent timeout/close changes the state to nil. +// G pointer - the goroutine is blocked on the semaphore; +// io notification or timeout/close changes the state to READY or nil respectively +// and unparks the goroutine. +// nil - nothing of the above. +const ( + pdReady uintptr = 1 + pdWait uintptr = 2 +) + +const pollBlockSize = 4 * 1024 + +// Network poller descriptor. +type pollDesc struct { + link *pollDesc + + lock mutex + fd uintptr + closing bool + seq uintptr + rg uintptr + rt timer + rd int64 + wg uintptr + wt timer + wd int64 + user uint32 +} + +type pollCache struct { + lock mutex + first *pollDesc +} diff --git a/hack/go1_7_2/runtime/netpoll_windows.go b/hack/go1_7_2/runtime/netpoll_windows.go new file mode 100644 index 0000000..321d6d7 --- /dev/null +++ b/hack/go1_7_2/runtime/netpoll_windows.go @@ -0,0 +1,26 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const _DWORD_MAX = 0xffffffff + +const _INVALID_HANDLE_VALUE = ^uintptr(0) + +// net_op must be the same as beginning of net.operation. Keep these in sync. +type net_op struct { + o overlapped + + pd *pollDesc + mode int32 + errno int32 + qty uint32 +} + +type overlappedEntry struct { + key uintptr + op *net_op + internal uintptr + qty uint32 +} diff --git a/hack/go1_7_2/runtime/os2_freebsd.go b/hack/go1_7_2/runtime/os2_freebsd.go new file mode 100644 index 0000000..84ab715 --- /dev/null +++ b/hack/go1_7_2/runtime/os2_freebsd.go @@ -0,0 +1,15 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _SS_DISABLE = 4 + _NSIG = 33 + _SI_USER = 0x10001 + _RLIMIT_AS = 10 + _SIG_BLOCK = 1 + _SIG_UNBLOCK = 2 + _SIG_SETMASK = 3 +) diff --git a/hack/go1_7_2/runtime/os2_nacl.go b/hack/go1_7_2/runtime/os2_nacl.go new file mode 100644 index 0000000..48d8fea --- /dev/null +++ b/hack/go1_7_2/runtime/os2_nacl.go @@ -0,0 +1,149 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _NSIG = 32 + _SI_USER = 1 + + _EPERM = 1 + _ENOENT = 2 + _ESRCH = 3 + _EINTR = 4 + _EIO = 5 + _ENXIO = 6 + _E2BIG = 7 + _ENOEXEC = 8 + _EBADF = 9 + _ECHILD = 10 + _EAGAIN = 11 + + _EACCES = 13 + _EFAULT = 14 + _EBUSY = 16 + _EEXIST = 17 + _EXDEV = 18 + _ENODEV = 19 + _ENOTDIR = 20 + _EISDIR = 21 + _EINVAL = 22 + _ENFILE = 23 + _EMFILE = 24 + _ENOTTY = 25 + _EFBIG = 27 + _ENOSPC = 28 + _ESPIPE = 29 + _EROFS = 30 + _EMLINK = 31 + _EPIPE = 32 + _ENAMETOOLONG = 36 + _ENOSYS = 38 + _EDQUOT = 122 + _EDOM = 33 + _ERANGE = 34 + _EDEADLK = 35 + _ENOLCK = 37 + _ENOTEMPTY = 39 + _ELOOP = 40 + _ENOMSG = 42 + _EIDRM = 43 + _ECHRNG = 44 + _EL2NSYNC = 45 + _EL3HLT = 46 + _EL3RST = 47 + _ELNRNG = 48 + _EUNATCH = 49 + _ENOCSI = 50 + _EL2HLT = 51 + _EBADE = 52 + _EBADR = 53 + _EXFULL = 54 + _ENOANO = 55 + _EBADRQC = 56 + _EBADSLT = 57 + _EDEADLOCK = _EDEADLK + _EBFONT = 59 + _ENOSTR = 60 + _ENODATA = 61 + _ETIME = 62 + _ENOSR = 63 + _ENONET = 64 + _ENOPKG = 65 + _EREMOTE = 66 + _ENOLINK = 67 + _EADV = 68 + _ESRMNT = 69 + _ECOMM = 70 + _EPROTO = 71 + _EMULTIHOP = 72 + _EDOTDOT = 73 + _EBADMSG = 74 + _EOVERFLOW = 75 + _ENOTUNIQ = 76 + _EBADFD = 77 + _EREMCHG = 78 + _ELIBACC = 79 + _ELIBBAD = 80 + _ELIBSCN = 81 + _ELIBMAX = 82 + _ELIBEXEC = 83 + _EILSEQ = 84 + _EUSERS = 87 + _ENOTSOCK = 88 + _EDESTADDRREQ = 89 + _EMSGSIZE = 90 + _EPROTOTYPE = 91 + _ENOPROTOOPT = 92 + _EPROTONOSUPPORT = 93 + _ESOCKTNOSUPPORT = 94 + _EOPNOTSUPP = 95 + _EPFNOSUPPORT = 96 + _EAFNOSUPPORT = 97 + _EADDRINUSE = 98 + _EADDRNOTAVAIL = 99 + _ENETDOWN = 100 + _ENETUNREACH = 101 + _ENETRESET = 102 + _ECONNABORTED = 103 + _ECONNRESET = 104 + _ENOBUFS = 105 + _EISCONN = 106 + _ENOTCONN = 107 + _ESHUTDOWN = 108 + _ETOOMANYREFS = 109 + _ETIMEDOUT = 110 + _ECONNREFUSED = 111 + _EHOSTDOWN = 112 + _EHOSTUNREACH = 113 + _EALREADY = 114 + _EINPROGRESS = 115 + _ESTALE = 116 + _ENOTSUP = _EOPNOTSUPP + _ENOMEDIUM = 123 + _ECANCELED = 125 + _ELBIN = 2048 + _EFTYPE = 2049 + _ENMFILE = 2050 + _EPROCLIM = 2051 + _ENOSHARE = 2052 + _ECASECLASH = 2053 + _EWOULDBLOCK = _EAGAIN + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_SHARED = 0x1 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + _MAP_ANON = 0x20 + + _MADV_FREE = 0 + _SIGFPE = 8 + _FPE_INTDIV = 0 +) + +type siginfo struct{} diff --git a/hack/go1_7_2/runtime/os2_openbsd.go b/hack/go1_7_2/runtime/os2_openbsd.go new file mode 100644 index 0000000..8656a91 --- /dev/null +++ b/hack/go1_7_2/runtime/os2_openbsd.go @@ -0,0 +1,14 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _SS_DISABLE = 4 + _SIG_BLOCK = 1 + _SIG_UNBLOCK = 2 + _SIG_SETMASK = 3 + _NSIG = 33 + _SI_USER = 0 +) diff --git a/hack/go1_7_2/runtime/os2_plan9.go b/hack/go1_7_2/runtime/os2_plan9.go new file mode 100644 index 0000000..5c4c05b --- /dev/null +++ b/hack/go1_7_2/runtime/os2_plan9.go @@ -0,0 +1,72 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Plan 9-specific system calls + +package runtime + +// open +const ( + _OREAD = 0 + _OWRITE = 1 + _ORDWR = 2 + _OEXEC = 3 + _OTRUNC = 16 + _OCEXEC = 32 + _ORCLOSE = 64 + _OEXCL = 0x1000 +) + +// rfork +const ( + _RFNAMEG = 1 << 0 + _RFENVG = 1 << 1 + _RFFDG = 1 << 2 + _RFNOTEG = 1 << 3 + _RFPROC = 1 << 4 + _RFMEM = 1 << 5 + _RFNOWAIT = 1 << 6 + _RFCNAMEG = 1 << 10 + _RFCENVG = 1 << 11 + _RFCFDG = 1 << 12 + _RFREND = 1 << 13 + _RFNOMNT = 1 << 14 +) + +// notify +const ( + _NCONT = 0 + _NDFLT = 1 +) + +type uinptr _Plink + +type tos struct { + prof struct { + pp *_Plink + next *_Plink + last *_Plink + first *_Plink + pid uint32 + what uint32 + } + cyclefreq uint64 + kcycles int64 + pcycles int64 + pid uint32 + clock uint32 +} + +const ( + _NSIG = 14 + _ERRMAX = 128 + + _SIGRFAULT = 2 + _SIGWFAULT = 3 + _SIGINTDIV = 4 + _SIGFLOAT = 5 + _SIGTRAP = 6 + _SIGPROF = 0 + _SIGQUIT = 0 +) diff --git a/hack/go1_7_2/runtime/os2_solaris.go b/hack/go1_7_2/runtime/os2_solaris.go new file mode 100644 index 0000000..385f515 --- /dev/null +++ b/hack/go1_7_2/runtime/os2_solaris.go @@ -0,0 +1,14 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _SS_DISABLE = 2 + _SIG_UNBLOCK = 2 + _SIG_SETMASK = 3 + _NSIG = 73 + _SI_USER = 0 + _RLIMIT_AS = 10 +) diff --git a/hack/go1_7_2/runtime/os_darwin.go b/hack/go1_7_2/runtime/os_darwin.go new file mode 100644 index 0000000..7c1b14e --- /dev/null +++ b/hack/go1_7_2/runtime/os_darwin.go @@ -0,0 +1,65 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type mOS struct { + machport uint32 + waitsema uint32 +} + +const _DebugMach = false + +// Mach RPC (MIG) +const ( + _MinMachMsg = 48 + _MachReply = 100 +) + +type codemsg struct { + h machheader + ndr machndr + code int32 +} + +const ( + tmach_semcreate = 3418 + rmach_semcreate = tmach_semcreate + _MachReply + + tmach_semdestroy = 3419 + rmach_semdestroy = tmach_semdestroy + _MachReply + + _KERN_ABORTED = 14 + _KERN_OPERATION_TIMED_OUT = 49 +) + +type tmach_semcreatemsg struct { + h machheader + ndr machndr + policy int32 + value int32 +} + +type rmach_semcreatemsg struct { + h machheader + body machbody + semaphore machport +} + +type tmach_semdestroymsg struct { + h machheader + body machbody + semaphore machport +} + +const ( + _NSIG = 32 + _SI_USER = 0 + _SIG_BLOCK = 1 + _SIG_UNBLOCK = 2 + _SIG_SETMASK = 3 + _SS_DISABLE = 4 +) + +type sigset uint32 diff --git a/hack/go1_7_2/runtime/os_dragonfly.go b/hack/go1_7_2/runtime/os_dragonfly.go new file mode 100644 index 0000000..597b932 --- /dev/null +++ b/hack/go1_7_2/runtime/os_dragonfly.go @@ -0,0 +1,31 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _NSIG = 33 + _SI_USER = 0 + _SS_DISABLE = 4 + _RLIMIT_AS = 10 + _SIG_BLOCK = 1 + _SIG_UNBLOCK = 2 + _SIG_SETMASK = 3 +) + +type mOS struct{} + +const stackSystem = 0 + +// From DragonFly's +const ( + _CTL_HW = 6 + _HW_NCPU = 3 +) + +type sigactiont struct { + sa_sigaction uintptr + sa_flags int32 + sa_mask sigset +} diff --git a/hack/go1_7_2/runtime/os_freebsd.go b/hack/go1_7_2/runtime/os_freebsd.go new file mode 100644 index 0000000..d7ffe22 --- /dev/null +++ b/hack/go1_7_2/runtime/os_freebsd.go @@ -0,0 +1,19 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type mOS struct{} + +// From FreeBSD's +const ( + _CTL_HW = 6 + _HW_NCPU = 3 +) + +type sigactiont struct { + sa_handler uintptr + sa_flags int32 + sa_mask sigset +} diff --git a/hack/go1_7_2/runtime/os_linux.go b/hack/go1_7_2/runtime/os_linux.go new file mode 100644 index 0000000..c890908 --- /dev/null +++ b/hack/go1_7_2/runtime/os_linux.go @@ -0,0 +1,46 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type mOS struct{} + +const ( + _FUTEX_WAIT = 0 + _FUTEX_WAKE = 1 +) + +// Clone, the Linux rfork. +const ( + _CLONE_VM = 0x100 + _CLONE_FS = 0x200 + _CLONE_FILES = 0x400 + _CLONE_SIGHAND = 0x800 + _CLONE_PTRACE = 0x2000 + _CLONE_VFORK = 0x4000 + _CLONE_PARENT = 0x8000 + _CLONE_THREAD = 0x10000 + _CLONE_NEWNS = 0x20000 + _CLONE_SYSVSEM = 0x40000 + _CLONE_SETTLS = 0x80000 + _CLONE_PARENT_SETTID = 0x100000 + _CLONE_CHILD_CLEARTID = 0x200000 + _CLONE_UNTRACED = 0x800000 + _CLONE_CHILD_SETTID = 0x1000000 + _CLONE_STOPPED = 0x2000000 + _CLONE_NEWUTS = 0x4000000 + _CLONE_NEWIPC = 0x8000000 + + cloneFlags = _CLONE_VM | + _CLONE_FS | + _CLONE_FILES | + _CLONE_SIGHAND | + _CLONE_THREAD +) + +const ( + _AT_NULL = 0 + _AT_PAGESZ = 6 + _AT_RANDOM = 25 +) diff --git a/hack/go1_7_2/runtime/os_linux_arm.go b/hack/go1_7_2/runtime/os_linux_arm.go new file mode 100644 index 0000000..db8e075 --- /dev/null +++ b/hack/go1_7_2/runtime/os_linux_arm.go @@ -0,0 +1,13 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _AT_PLATFORM = 15 + _AT_HWCAP = 16 + + _HWCAP_VFP = 1 << 6 + _HWCAP_VFPv3 = 1 << 13 +) diff --git a/hack/go1_7_2/runtime/os_linux_generic.go b/hack/go1_7_2/runtime/os_linux_generic.go new file mode 100644 index 0000000..f1a2dd5 --- /dev/null +++ b/hack/go1_7_2/runtime/os_linux_generic.go @@ -0,0 +1,30 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !mips64 +// +build !mips64le +// +build !s390x +// +build linux + +package runtime + +const ( + _SS_DISABLE = 2 + _NSIG = 65 + _SI_USER = 0 + _SIG_BLOCK = 0 + _SIG_UNBLOCK = 1 + _SIG_SETMASK = 2 + _RLIMIT_AS = 9 +) + +// It's hard to tease out exactly how big a Sigset is, but +// rt_sigprocmask crashes if we get it wrong, so if binaries +// are running, this is right. +type sigset [2]uint32 + +type rlimit struct { + rlim_cur uintptr + rlim_max uintptr +} diff --git a/hack/go1_7_2/runtime/os_linux_mips64x.go b/hack/go1_7_2/runtime/os_linux_mips64x.go new file mode 100644 index 0000000..9a6a92a --- /dev/null +++ b/hack/go1_7_2/runtime/os_linux_mips64x.go @@ -0,0 +1,25 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux +// +build mips64 mips64le + +package runtime + +const ( + _SS_DISABLE = 2 + _NSIG = 65 + _SI_USER = 0 + _SIG_BLOCK = 1 + _SIG_UNBLOCK = 2 + _SIG_SETMASK = 3 + _RLIMIT_AS = 6 +) + +type sigset [2]uint64 + +type rlimit struct { + rlim_cur uintptr + rlim_max uintptr +} diff --git a/hack/go1_7_2/runtime/os_linux_s390x.go b/hack/go1_7_2/runtime/os_linux_s390x.go new file mode 100644 index 0000000..d03b499 --- /dev/null +++ b/hack/go1_7_2/runtime/os_linux_s390x.go @@ -0,0 +1,22 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _SS_DISABLE = 2 + _NSIG = 65 + _SI_USER = 0 + _SIG_BLOCK = 0 + _SIG_UNBLOCK = 1 + _SIG_SETMASK = 2 + _RLIMIT_AS = 9 +) + +type sigset uint64 + +type rlimit struct { + rlim_cur uintptr + rlim_max uintptr +} diff --git a/hack/go1_7_2/runtime/os_nacl.go b/hack/go1_7_2/runtime/os_nacl.go new file mode 100644 index 0000000..92d7ecd --- /dev/null +++ b/hack/go1_7_2/runtime/os_nacl.go @@ -0,0 +1,13 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type mOS struct { + waitsema int32 + waitsemacount int32 + waitsemalock int32 +} + +type sigset struct{} diff --git a/hack/go1_7_2/runtime/os_netbsd.go b/hack/go1_7_2/runtime/os_netbsd.go new file mode 100644 index 0000000..5319426 --- /dev/null +++ b/hack/go1_7_2/runtime/os_netbsd.go @@ -0,0 +1,45 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _SS_DISABLE = 4 + _SIG_BLOCK = 1 + _SIG_UNBLOCK = 2 + _SIG_SETMASK = 3 + _NSIG = 33 + _SI_USER = 0 + + _UC_SIGMASK = 0x01 + _UC_CPU = 0x04 + + _EAGAIN = 35 +) + +type mOS struct { + waitsemacount uint32 +} + +const ( + _ESRCH = 3 + _ETIMEDOUT = 60 + + _CLOCK_REALTIME = 0 + _CLOCK_VIRTUAL = 1 + _CLOCK_PROF = 2 + _CLOCK_MONOTONIC = 3 +) + +// From NetBSD's +const ( + _CTL_HW = 6 + _HW_NCPU = 3 +) + +type sigactiont struct { + sa_sigaction uintptr + sa_mask sigset + sa_flags int32 +} diff --git a/hack/go1_7_2/runtime/os_openbsd.go b/hack/go1_7_2/runtime/os_openbsd.go new file mode 100644 index 0000000..574ecaa --- /dev/null +++ b/hack/go1_7_2/runtime/os_openbsd.go @@ -0,0 +1,40 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type mOS struct { + waitsemacount uint32 +} + +const ( + _ESRCH = 3 + _EAGAIN = 35 + _EWOULDBLOCK = _EAGAIN + _ENOTSUP = 91 + + _CLOCK_REALTIME = 0 + _CLOCK_VIRTUAL = 1 + _CLOCK_PROF = 2 + _CLOCK_MONOTONIC = 3 +) + +type sigset uint32 + +const ( + sigset_none = sigset(0) + sigset_all = ^sigset(0) +) + +// From OpenBSD's +const ( + _CTL_HW = 6 + _HW_NCPU = 3 +) + +type sigactiont struct { + sa_sigaction uintptr + sa_mask uint32 + sa_flags int32 +} diff --git a/hack/go1_7_2/runtime/os_plan9.go b/hack/go1_7_2/runtime/os_plan9.go new file mode 100644 index 0000000..fa62b1a --- /dev/null +++ b/hack/go1_7_2/runtime/os_plan9.go @@ -0,0 +1,15 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type mOS struct { + waitsemacount uint32 + notesig *int8 + errstr *byte +} + +type _Plink uintptr + +type sigset struct{} diff --git a/hack/go1_7_2/runtime/os_solaris.go b/hack/go1_7_2/runtime/os_solaris.go new file mode 100644 index 0000000..fe98cc2 --- /dev/null +++ b/hack/go1_7_2/runtime/os_solaris.go @@ -0,0 +1,24 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type mts struct { + tv_sec int64 + tv_nsec int64 +} + +type mscratch struct { + v [6]uintptr +} + +type mOS struct { + waitsema uintptr + perrno *int32 + + ts mts + scratch mscratch +} + +type libcFunc uintptr diff --git a/hack/go1_7_2/runtime/os_windows.go b/hack/go1_7_2/runtime/os_windows.go new file mode 100644 index 0000000..81d1bd9 --- /dev/null +++ b/hack/go1_7_2/runtime/os_windows.go @@ -0,0 +1,39 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +// TODO(brainman): should not need those +const ( + _NSIG = 65 +) + +type stdFunction unsafe.Pointer + +type mOS struct { + waitsema uintptr +} + +type sigset struct{} + +const ( + currentProcess = ^uintptr(0) + currentThread = ^uintptr(1) +) + +// Described in http://www.dcl.hpi.uni-potsdam.de/research/WRK/2007/08/getting-os-information-the-kuser_shared_data-structure/ +type _KSYSTEM_TIME struct { + LowPart uint32 + High1Time int32 + High2Time int32 +} + +const ( + _INTERRUPT_TIME = 0x7ffe0008 + _SYSTEM_TIME = 0x7ffe0014 +) diff --git a/hack/go1_7_2/runtime/panic.go b/hack/go1_7_2/runtime/panic.go new file mode 100644 index 0000000..80ff011 --- /dev/null +++ b/hack/go1_7_2/runtime/panic.go @@ -0,0 +1,15 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +const ( + deferHeaderSize = unsafe.Sizeof(_defer{}) + minDeferAlloc = (deferHeaderSize + 15) &^ 15 + minDeferArgs = minDeferAlloc - deferHeaderSize +) diff --git a/hack/go1_7_2/runtime/print.go b/hack/go1_7_2/runtime/print.go new file mode 100644 index 0000000..d02cf26 --- /dev/null +++ b/hack/go1_7_2/runtime/print.go @@ -0,0 +1,9 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +// The compiler knows that a print of a value of this type +// should use printhex instead of printuint (decimal). +type hex uint64 diff --git a/hack/go1_7_2/runtime/proc.go b/hack/go1_7_2/runtime/proc.go new file mode 100644 index 0000000..488f8b9 --- /dev/null +++ b/hack/go1_7_2/runtime/proc.go @@ -0,0 +1,54 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +const ( + _GoidCacheBatch = 16 +) + +// freezeStopWait is a large value that freezetheworld sets +// sched.stopwait to in order to request that all Gs permanently stop. +const freezeStopWait = 0x7fffffff + +type cgothreadstart struct { + g guintptr + tls *uint64 + fn unsafe.Pointer +} + +// forcePreemptNS is the time slice given to a G before it is +// preempted. +const forcePreemptNS = 10 * 1000 * 1000 + +// To shake out latent assumptions about scheduling order, +// we introduce some randomness into scheduling decisions +// when running with the race detector. +// The need for this was made obvious by changing the +// (deterministic) scheduling order in Go 1.5 and breaking +// many poorly-written tests. +// With the randomness here, as long as the tests pass +// consistently with -race, they shouldn't have latent scheduling +// assumptions. +const randomizeScheduler = raceenabled + +// randomOrder/randomEnum are helper types for randomized work stealing. +// They allow to enumerate all Ps in different pseudo-random orders without repetitions. +// The algorithm is based on the fact that if we have X such that X and GOMAXPROCS +// are coprime, then a sequences of (i + X) % GOMAXPROCS gives the required enumeration. +type randomOrder struct { + count uint32 + coprimes []uint32 +} + +type randomEnum struct { + i uint32 + count uint32 + pos uint32 + inc uint32 +} diff --git a/hack/go1_7_2/runtime/race.go b/hack/go1_7_2/runtime/race.go new file mode 100644 index 0000000..2aeefc0 --- /dev/null +++ b/hack/go1_7_2/runtime/race.go @@ -0,0 +1,38 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build race + +// Public race detection API, present iff build with -race. + +package runtime + +// private interface for the runtime +const raceenabled = true + +type symbolizeCodeContext struct { + pc uintptr + fn *byte + file *byte + line uintptr + off uintptr + res uintptr +} + +const ( + raceGetProcCmd = iota + raceSymbolizeCodeCmd + raceSymbolizeDataCmd +) + +type symbolizeDataContext struct { + addr uintptr + heap uintptr + start uintptr + size uintptr + name *byte + file *byte + line uintptr + res uintptr +} diff --git a/hack/go1_7_2/runtime/race0.go b/hack/go1_7_2/runtime/race0.go new file mode 100644 index 0000000..29bafea --- /dev/null +++ b/hack/go1_7_2/runtime/race0.go @@ -0,0 +1,11 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !race + +// Dummy race detection API, used when not built with -race. + +package runtime + +const raceenabled = false diff --git a/hack/go1_7_2/runtime/rune.go b/hack/go1_7_2/runtime/rune.go new file mode 100644 index 0000000..3fe4ed4 --- /dev/null +++ b/hack/go1_7_2/runtime/rune.go @@ -0,0 +1,55 @@ +/* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Portions Copyright 2009 The Go Authors. All rights reserved. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY + * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ + +/* + * This code is copied, with slight editing due to type differences, + * from a subset of ../lib9/utf/rune.c [which no longer exists] + */ + +package runtime + +const ( + bit1 = 7 + bitx = 6 + bit2 = 5 + bit3 = 4 + bit4 = 3 + bit5 = 2 + + t1 = ((1 << (bit1 + 1)) - 1) ^ 0xFF + tx = ((1 << (bitx + 1)) - 1) ^ 0xFF + t2 = ((1 << (bit2 + 1)) - 1) ^ 0xFF + t3 = ((1 << (bit3 + 1)) - 1) ^ 0xFF + t4 = ((1 << (bit4 + 1)) - 1) ^ 0xFF + t5 = ((1 << (bit5 + 1)) - 1) ^ 0xFF + + rune1 = (1 << (bit1 + 0*bitx)) - 1 + rune2 = (1 << (bit2 + 1*bitx)) - 1 + rune3 = (1 << (bit3 + 2*bitx)) - 1 + rune4 = (1 << (bit4 + 3*bitx)) - 1 + + maskx = (1 << bitx) - 1 + testx = maskx ^ 0xFF + + runeerror = 0xFFFD + runeself = 0x80 + + surrogateMin = 0xD800 + surrogateMax = 0xDFFF + + bad = runeerror + + runemax = 0x10FFFF +) diff --git a/hack/go1_7_2/runtime/runtime1.go b/hack/go1_7_2/runtime/runtime1.go new file mode 100644 index 0000000..b15fa9f --- /dev/null +++ b/hack/go1_7_2/runtime/runtime1.go @@ -0,0 +1,21 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +// Keep a cached value to make gotraceback fast, +// since we call it on every call to gentraceback. +// The cached value is a uint32 in which the low bits +// are the "crash" and "all" settings and the remaining +// bits are the traceback value (0 off, 1 on, 2 include system). +const ( + tracebackCrash = 1 << iota + tracebackAll + tracebackShift = iota +) + +type dbgVar struct { + name string + value *int32 +} diff --git a/hack/go1_7_2/runtime/runtime2.go b/hack/go1_7_2/runtime/runtime2.go new file mode 100644 index 0000000..29a1150 --- /dev/null +++ b/hack/go1_7_2/runtime/runtime2.go @@ -0,0 +1,516 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_2/runtime/internal/sys" + "unsafe" +) + +// defined constants +const ( + _Gidle = iota + + _Grunnable + + _Grunning + + _Gsyscall + + _Gwaiting + + _Gmoribund_unused + + _Gdead + + _Genqueue_unused + + _Gcopystack + + _Gscan = 0x1000 + _Gscanrunnable = _Gscan + _Grunnable + _Gscanrunning = _Gscan + _Grunning + _Gscansyscall = _Gscan + _Gsyscall + _Gscanwaiting = _Gscan + _Gwaiting +) + +const ( + _Pidle = iota + _Prunning + _Psyscall + _Pgcstop + _Pdead +) + +// Mutual exclusion locks. In the uncontended case, +// as fast as spin locks (just a few user-level instructions), +// but on the contention path they sleep in the kernel. +// A zeroed Mutex is unlocked (no need to initialize each lock). +type mutex struct { + key uintptr +} + +// sleep and wakeup on one-time events. +// before any calls to notesleep or notewakeup, +// must call noteclear to initialize the Note. +// then, exactly one thread can call notesleep +// and exactly one thread can call notewakeup (once). +// once notewakeup has been called, the notesleep +// will return. future notesleep will return immediately. +// subsequent noteclear must be called only after +// previous notesleep has returned, e.g. it's disallowed +// to call noteclear straight after notewakeup. +// +// notetsleep is like notesleep but wakes up after +// a given number of nanoseconds even if the event +// has not yet happened. if a goroutine uses notetsleep to +// wake up early, it must wait to call noteclear until it +// can be sure that no other goroutine is calling +// notewakeup. +// +// notesleep/notetsleep are generally called on g0, +// notetsleepg is similar to notetsleep but is called on user g. +type note struct { + key uintptr +} + +type funcval struct { + fn uintptr +} + +type iface struct { + tab *itab + data unsafe.Pointer +} + +type eface struct { + _type *_type + data unsafe.Pointer +} + +// A guintptr holds a goroutine pointer, but typed as a uintptr +// to bypass write barriers. It is used in the Gobuf goroutine state +// and in scheduling lists that are manipulated without a P. +// +// The Gobuf.g goroutine pointer is almost always updated by assembly code. +// In one of the few places it is updated by Go code - func save - it must be +// treated as a uintptr to avoid a write barrier being emitted at a bad time. +// Instead of figuring out how to emit the write barriers missing in the +// assembly manipulation, we change the type of the field to uintptr, +// so that it does not require write barriers at all. +// +// Goroutine structs are published in the allg list and never freed. +// That will keep the goroutine structs from being collected. +// There is never a time that Gobuf.g's contain the only references +// to a goroutine: the publishing of the goroutine in allg comes first. +// Goroutine pointers are also kept in non-GC-visible places like TLS, +// so I can't see them ever moving. If we did want to start moving data +// in the GC, we'd need to allocate the goroutine structs from an +// alternate arena. Using guintptr doesn't make that problem any worse. +type guintptr uintptr + +type puintptr uintptr + +type muintptr uintptr + +type gobuf struct { + sp uintptr + pc uintptr + g guintptr + ctxt unsafe.Pointer + ret sys.Uintreg + lr uintptr + bp uintptr +} + +// sudog represents a g in a wait list, such as for sending/receiving +// on a channel. +// +// sudog is necessary because the g ↔ synchronization object relation +// is many-to-many. A g can be on many wait lists, so there may be +// many sudogs for one g; and many gs may be waiting on the same +// synchronization object, so there may be many sudogs for one object. +// +// sudogs are allocated from a special pool. Use acquireSudog and +// releaseSudog to allocate and free them. +type sudog struct { + g *g + selectdone *uint32 + next *sudog + prev *sudog + elem unsafe.Pointer + + releasetime int64 + ticket uint32 + waitlink *sudog + c *hchan +} + +type gcstats struct { + nhandoff uint64 + nhandoffcnt uint64 + nprocyield uint64 + nosyield uint64 + nsleep uint64 +} + +type libcall struct { + fn uintptr + n uintptr + args uintptr + r1 uintptr + r2 uintptr + err uintptr +} + +// describes how to handle callback +type wincallbackcontext struct { + gobody unsafe.Pointer + argsize uintptr + restorestack uintptr + cleanstack bool +} + +// Stack describes a Go execution stack. +// The bounds of the stack are exactly [lo, hi), +// with no implicit data structures on either side. +type stack struct { + lo uintptr + hi uintptr +} + +// stkbar records the state of a G's stack barrier. +type stkbar struct { + savedLRPtr uintptr + savedLRVal uintptr +} + +type g struct { + stack stack + stackguard0 uintptr + stackguard1 uintptr + + _panic *_panic + _defer *_defer + m *m + stackAlloc uintptr + sched gobuf + syscallsp uintptr + syscallpc uintptr + stkbar []stkbar + stkbarPos uintptr + stktopsp uintptr + param unsafe.Pointer + atomicstatus uint32 + stackLock uint32 + goid int64 + waitsince int64 + waitreason string + schedlink guintptr + preempt bool + paniconfault bool + preemptscan bool + gcscandone bool + gcscanvalid bool + throwsplit bool + raceignore int8 + sysblocktraced bool + sysexitticks int64 + traceseq uint64 + tracelastp puintptr + lockedm *m + sig uint32 + writebuf []byte + sigcode0 uintptr + sigcode1 uintptr + sigpc uintptr + gopc uintptr + startpc uintptr + racectx uintptr + waiting *sudog + cgoCtxt []uintptr + + gcRescan int32 + + gcAssistBytes int64 +} + +type m struct { + g0 *g + morebuf gobuf + divmod uint32 + + procid uint64 + gsignal *g + sigmask sigset + tls [6]uintptr + mstartfn func() + curg *g + caughtsig guintptr + p puintptr + nextp puintptr + id int32 + mallocing int32 + throwing int32 + preemptoff string + locks int32 + softfloat int32 + dying int32 + profilehz int32 + helpgc int32 + spinning bool + blocked bool + inwb bool + newSigstack bool + printlock int8 + fastrand uint32 + ncgocall uint64 + ncgo int32 + cgoCallersUse uint32 + cgoCallers *cgoCallers + park note + alllink *m + schedlink muintptr + mcache *mcache + lockedg *g + createstack [32]uintptr + freglo [16]uint32 + freghi [16]uint32 + fflag uint32 + locked uint32 + nextwaitm uintptr + gcstats gcstats + needextram bool + traceback uint8 + waitunlockf unsafe.Pointer + waitlock unsafe.Pointer + waittraceev byte + waittraceskip int + startingtrace bool + syscalltick uint32 + thread uintptr + + libcall libcall + libcallpc uintptr + libcallsp uintptr + libcallg guintptr + syscall libcall + + mOS +} + +type p struct { + lock mutex + + id int32 + status uint32 + link puintptr + schedtick uint32 + syscalltick uint32 + m muintptr + mcache *mcache + racectx uintptr + + deferpool [5][]*_defer + deferpoolbuf [5][32]*_defer + + goidcache uint64 + goidcacheend uint64 + + runqhead uint32 + runqtail uint32 + runq [256]guintptr + + runnext guintptr + + gfree *g + gfreecnt int32 + + sudogcache []*sudog + sudogbuf [128]*sudog + + tracebuf traceBufPtr + + palloc persistentAlloc + + gcAssistTime int64 + gcBgMarkWorker guintptr + gcMarkWorkerMode gcMarkWorkerMode + + gcw gcWork + + runSafePointFn uint32 + + pad [64]byte +} + +const ( + _MaxGomaxprocs = 1 << 8 +) + +type schedt struct { + goidgen uint64 + lastpoll uint64 + + lock mutex + + midle muintptr + nmidle int32 + nmidlelocked int32 + mcount int32 + maxmcount int32 + + ngsys uint32 + + pidle puintptr + npidle uint32 + nmspinning uint32 + + runqhead guintptr + runqtail guintptr + runqsize int32 + + gflock mutex + gfreeStack *g + gfreeNoStack *g + ngfree int32 + + sudoglock mutex + sudogcache *sudog + + deferlock mutex + deferpool [5]*_defer + + gcwaiting uint32 + stopwait int32 + stopnote note + sysmonwait uint32 + sysmonnote note + + safePointFn func(*p) + safePointWait int32 + safePointNote note + + profilehz int32 + + procresizetime int64 + totaltime int64 +} + +// The m.locked word holds two pieces of state counting active calls to LockOSThread/lockOSThread. +// The low bit (LockExternal) is a boolean reporting whether any LockOSThread call is active. +// External locks are not recursive; a second lock is silently ignored. +// The upper bits of m.locked record the nesting depth of calls to lockOSThread +// (counting up by LockInternal), popped by unlockOSThread (counting down by LockInternal). +// Internal locks can be recursive. For instance, a lock for cgo can occur while the main +// goroutine is holding the lock during the initialization phase. +const ( + _LockExternal = 1 + _LockInternal = 2 +) + +type sigtabtt struct { + flags int32 + name *int8 +} + +const ( + _SigNotify = 1 << iota + _SigKill + _SigThrow + _SigPanic + _SigDefault + _SigHandling + _SigGoExit + _SigSetStack + _SigUnblock +) + +// Layout of in-memory per-function information prepared by linker +// See https://golang.org/s/go12symtab. +// Keep in sync with linker +// and with package debug/gosym and with symtab.go in package runtime. +type _func struct { + entry uintptr + nameoff int32 + + args int32 + _ int32 + + pcsp int32 + pcfile int32 + pcln int32 + npcdata int32 + nfuncdata int32 +} + +// layout of Itab known to compilers +// allocated in non-garbage-collected memory +// Needs to be in sync with +// ../cmd/compile/internal/gc/reflect.go:/^func.dumptypestructs. +type itab struct { + inter *interfacetype + _type *_type + link *itab + bad int32 + unused int32 + fun [1]uintptr +} + +// Lock-free stack node. +// // Also known to export_test.go. +type lfnode struct { + next uint64 + pushcnt uintptr +} + +type forcegcstate struct { + lock mutex + g *g + idle uint32 +} + +// deferred subroutine calls +type _defer struct { + siz int32 + started bool + sp uintptr + pc uintptr + fn *funcval + _panic *_panic + link *_defer +} + +// panics +type _panic struct { + argp unsafe.Pointer + arg interface{} + link *_panic + recovered bool + aborted bool +} + +// stack traces +type stkframe struct { + fn *_func + pc uintptr + continpc uintptr + lr uintptr + sp uintptr + fp uintptr + varp uintptr + argp uintptr + arglen uintptr + argmap *bitvector +} + +const ( + _TraceRuntimeFrames = 1 << iota + _TraceTrap + _TraceJumpStack +) + +// The maximum number of frames we print for a traceback +const _TracebackMaxFrames = 100 diff --git a/hack/go1_7_2/runtime/select.go b/hack/go1_7_2/runtime/select.go new file mode 100644 index 0000000..276a9f2 --- /dev/null +++ b/hack/go1_7_2/runtime/select.go @@ -0,0 +1,60 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +const ( + debugSelect = false + + caseRecv = iota + caseSend + caseDefault +) + +// Select statement header. +// Known to compiler. +// Changes here must also be made in src/cmd/internal/gc/select.go's selecttype. +type hselect struct { + tcase uint16 + ncase uint16 + pollorder *uint16 + lockorder *uint16 + scase [1]scase +} + +// Select case descriptor. +// Known to compiler. +// Changes here must also be made in src/cmd/internal/gc/select.go's selecttype. +type scase struct { + elem unsafe.Pointer + c *hchan + pc uintptr + kind uint16 + so uint16 + receivedp *bool + releasetime int64 +} + +// A runtimeSelect is a single case passed to rselect. +// This must match ../reflect/value.go:/runtimeSelect +type runtimeSelect struct { + dir selectDir + typ unsafe.Pointer + ch *hchan + val unsafe.Pointer +} + +// These values must match ../reflect/value.go:/SelectDir. +type selectDir int + +const ( + _ selectDir = iota + selectSend + selectRecv + selectDefault +) diff --git a/hack/go1_7_2/runtime/sema.go b/hack/go1_7_2/runtime/sema.go new file mode 100644 index 0000000..80ccc17 --- /dev/null +++ b/hack/go1_7_2/runtime/sema.go @@ -0,0 +1,43 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Semaphore implementation exposed to Go. +// Intended use is provide a sleep and wakeup +// primitive that can be used in the contended case +// of other synchronization primitives. +// Thus it targets the same goal as Linux's futex, +// but it has much simpler semantics. +// +// That is, don't think of these as semaphores. +// Think of them as a way to implement sleep and wakeup +// such that every sleep is paired with a single wakeup, +// even if, due to races, the wakeup happens before the sleep. +// +// See Mullender and Cox, ``Semaphores in Plan 9,'' +// http://swtch.com/semaphore.pdf + +package runtime + +type semaRoot struct { + lock mutex + head *sudog + tail *sudog + nwait uint32 +} + +// Prime to not correlate with any user patterns. +const semTabSize = 251 + +// notifyList is a ticket-based notification list used to implement sync.Cond. +// +// It must be kept in sync with the sync package. +type notifyList struct { + wait uint32 + + notify uint32 + + lock mutex + head *sudog + tail *sudog +} diff --git a/hack/go1_7_2/runtime/signal1_unix.go b/hack/go1_7_2/runtime/signal1_unix.go new file mode 100644 index 0000000..39442ed --- /dev/null +++ b/hack/go1_7_2/runtime/signal1_unix.go @@ -0,0 +1,17 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build darwin dragonfly freebsd linux netbsd openbsd solaris + +package runtime + +const ( + _SIG_DFL uintptr = 0 + _SIG_IGN uintptr = 1 +) + +// sigmask represents a general signal mask compatible with the GOOS +// specific sigset types: the signal numbered x is represented by bit x-1 +// to match the representation expected by sigprocmask. +type sigmask [(_NSIG + 31) / 32]uint32 diff --git a/hack/go1_7_2/runtime/signal_darwin.go b/hack/go1_7_2/runtime/signal_darwin.go new file mode 100644 index 0000000..76e1ad2 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_darwin.go @@ -0,0 +1,10 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_2/runtime/signal_darwin_386.go b/hack/go1_7_2/runtime/signal_darwin_386.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_darwin_386.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_darwin_amd64.go b/hack/go1_7_2/runtime/signal_darwin_amd64.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_darwin_amd64.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_darwin_arm.go b/hack/go1_7_2/runtime/signal_darwin_arm.go new file mode 100644 index 0000000..95b671d --- /dev/null +++ b/hack/go1_7_2/runtime/signal_darwin_arm.go @@ -0,0 +1,12 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_darwin_arm64.go b/hack/go1_7_2/runtime/signal_darwin_arm64.go new file mode 100644 index 0000000..afe8be5 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_darwin_arm64.go @@ -0,0 +1,12 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_dragonfly.go b/hack/go1_7_2/runtime/signal_dragonfly.go new file mode 100644 index 0000000..76e1ad2 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_dragonfly.go @@ -0,0 +1,10 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_2/runtime/signal_dragonfly_amd64.go b/hack/go1_7_2/runtime/signal_dragonfly_amd64.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_dragonfly_amd64.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_freebsd.go b/hack/go1_7_2/runtime/signal_freebsd.go new file mode 100644 index 0000000..76e1ad2 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_freebsd.go @@ -0,0 +1,10 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_2/runtime/signal_freebsd_386.go b/hack/go1_7_2/runtime/signal_freebsd_386.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_freebsd_386.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_freebsd_amd64.go b/hack/go1_7_2/runtime/signal_freebsd_amd64.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_freebsd_amd64.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_freebsd_arm.go b/hack/go1_7_2/runtime/signal_freebsd_arm.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_freebsd_arm.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_linux_386.go b/hack/go1_7_2/runtime/signal_linux_386.go new file mode 100644 index 0000000..d74a0f2 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_linux_386.go @@ -0,0 +1,14 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_linux_amd64.go b/hack/go1_7_2/runtime/signal_linux_amd64.go new file mode 100644 index 0000000..d74a0f2 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_linux_amd64.go @@ -0,0 +1,14 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_linux_arm.go b/hack/go1_7_2/runtime/signal_linux_arm.go new file mode 100644 index 0000000..d74a0f2 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_linux_arm.go @@ -0,0 +1,14 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_linux_arm64.go b/hack/go1_7_2/runtime/signal_linux_arm64.go new file mode 100644 index 0000000..86c38d6 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_linux_arm64.go @@ -0,0 +1,14 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_linux_mips64x.go b/hack/go1_7_2/runtime/signal_linux_mips64x.go new file mode 100644 index 0000000..4a3adc1 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_linux_mips64x.go @@ -0,0 +1,17 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux +// +build mips64 mips64le + +package runtime + +import ( + "unsafe" +) + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_linux_ppc64x.go b/hack/go1_7_2/runtime/signal_linux_ppc64x.go new file mode 100644 index 0000000..f608902 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_linux_ppc64x.go @@ -0,0 +1,17 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux +// +build ppc64 ppc64le + +package runtime + +import ( + "unsafe" +) + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_linux_s390x.go b/hack/go1_7_2/runtime/signal_linux_s390x.go new file mode 100644 index 0000000..f356222 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_linux_s390x.go @@ -0,0 +1,14 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_nacl.go b/hack/go1_7_2/runtime/signal_nacl.go new file mode 100644 index 0000000..76e1ad2 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_nacl.go @@ -0,0 +1,10 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_2/runtime/signal_nacl_386.go b/hack/go1_7_2/runtime/signal_nacl_386.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_nacl_386.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_nacl_amd64p32.go b/hack/go1_7_2/runtime/signal_nacl_amd64p32.go new file mode 100644 index 0000000..95b671d --- /dev/null +++ b/hack/go1_7_2/runtime/signal_nacl_amd64p32.go @@ -0,0 +1,12 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_nacl_arm.go b/hack/go1_7_2/runtime/signal_nacl_arm.go new file mode 100644 index 0000000..95b671d --- /dev/null +++ b/hack/go1_7_2/runtime/signal_nacl_arm.go @@ -0,0 +1,12 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_netbsd.go b/hack/go1_7_2/runtime/signal_netbsd.go new file mode 100644 index 0000000..76e1ad2 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_netbsd.go @@ -0,0 +1,10 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_2/runtime/signal_netbsd_386.go b/hack/go1_7_2/runtime/signal_netbsd_386.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_netbsd_386.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_netbsd_amd64.go b/hack/go1_7_2/runtime/signal_netbsd_amd64.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_netbsd_amd64.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_netbsd_arm.go b/hack/go1_7_2/runtime/signal_netbsd_arm.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_netbsd_arm.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_openbsd.go b/hack/go1_7_2/runtime/signal_openbsd.go new file mode 100644 index 0000000..76e1ad2 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_openbsd.go @@ -0,0 +1,10 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_2/runtime/signal_openbsd_386.go b/hack/go1_7_2/runtime/signal_openbsd_386.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_openbsd_386.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_openbsd_amd64.go b/hack/go1_7_2/runtime/signal_openbsd_amd64.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_openbsd_amd64.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_openbsd_arm.go b/hack/go1_7_2/runtime/signal_openbsd_arm.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_2/runtime/signal_openbsd_arm.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/signal_plan9.go b/hack/go1_7_2/runtime/signal_plan9.go new file mode 100644 index 0000000..8cec35e --- /dev/null +++ b/hack/go1_7_2/runtime/signal_plan9.go @@ -0,0 +1,10 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int + name string +} diff --git a/hack/go1_7_2/runtime/signal_solaris.go b/hack/go1_7_2/runtime/signal_solaris.go new file mode 100644 index 0000000..13e08ec --- /dev/null +++ b/hack/go1_7_2/runtime/signal_solaris.go @@ -0,0 +1,10 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_2/runtime/signal_solaris_amd64.go b/hack/go1_7_2/runtime/signal_solaris_amd64.go new file mode 100644 index 0000000..95b671d --- /dev/null +++ b/hack/go1_7_2/runtime/signal_solaris_amd64.go @@ -0,0 +1,12 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_2/runtime/sigqueue.go b/hack/go1_7_2/runtime/sigqueue.go new file mode 100644 index 0000000..65ee8eb --- /dev/null +++ b/hack/go1_7_2/runtime/sigqueue.go @@ -0,0 +1,35 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// This file implements runtime support for signal handling. +// +// Most synchronization primitives are not available from +// the signal handler (it cannot block, allocate memory, or use locks) +// so the handler communicates with a processing goroutine +// via struct sig, below. +// +// sigsend is called by the signal handler to queue a new signal. +// signal_recv is called by the Go program to receive a newly queued signal. +// Synchronization between sigsend and signal_recv is based on the sig.state +// variable. It can be in 3 states: sigIdle, sigReceiving and sigSending. +// sigReceiving means that signal_recv is blocked on sig.Note and there are no +// new pending signals. +// sigSending means that sig.mask *may* contain new pending signals, +// signal_recv can't be blocked in this state. +// sigIdle means that there are no new pending signals and signal_recv is not blocked. +// Transitions between states are done atomically with CAS. +// When signal_recv is unblocked, it resets sig.Note and rechecks sig.mask. +// If several sigsends and signal_recv execute concurrently, it can lead to +// unnecessary rechecks of sig.mask, but it cannot lead to missed signals +// nor deadlocks. + +// +build !plan9 + +package runtime + +const ( + sigIdle = iota + sigReceiving + sigSending +) diff --git a/hack/go1_7_2/runtime/sigqueue_plan9.go b/hack/go1_7_2/runtime/sigqueue_plan9.go new file mode 100644 index 0000000..22fcfc9 --- /dev/null +++ b/hack/go1_7_2/runtime/sigqueue_plan9.go @@ -0,0 +1,22 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// This file implements runtime support for signal handling. + +package runtime + +const qsize = 64 + +type noteData struct { + s [_ERRMAX]byte + n int +} + +type noteQueue struct { + lock mutex + data [qsize]noteData + ri int + wi int + full bool +} diff --git a/hack/go1_7_2/runtime/sigtab_linux_generic.go b/hack/go1_7_2/runtime/sigtab_linux_generic.go new file mode 100644 index 0000000..92b4739 --- /dev/null +++ b/hack/go1_7_2/runtime/sigtab_linux_generic.go @@ -0,0 +1,14 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !mips64 +// +build !mips64le +// +build linux + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_2/runtime/sigtab_linux_mips64x.go b/hack/go1_7_2/runtime/sigtab_linux_mips64x.go new file mode 100644 index 0000000..4f491fb --- /dev/null +++ b/hack/go1_7_2/runtime/sigtab_linux_mips64x.go @@ -0,0 +1,13 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build mips64 mips64le +// +build linux + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_2/runtime/slice.go b/hack/go1_7_2/runtime/slice.go new file mode 100644 index 0000000..21caa12 --- /dev/null +++ b/hack/go1_7_2/runtime/slice.go @@ -0,0 +1,15 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +type slice struct { + array unsafe.Pointer + len int + cap int +} diff --git a/hack/go1_7_2/runtime/softfloat64.go b/hack/go1_7_2/runtime/softfloat64.go new file mode 100644 index 0000000..a5a459c --- /dev/null +++ b/hack/go1_7_2/runtime/softfloat64.go @@ -0,0 +1,27 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Software IEEE754 64-bit floating point. +// Only referred to (and thus linked in) by arm port +// and by tests in this directory. + +package runtime + +const ( + mantbits64 uint = 52 + expbits64 uint = 11 + bias64 = -1<<(expbits64-1) + 1 + + nan64 uint64 = (1<> 1) + _FixedStack3 = _FixedStack2 | (_FixedStack2 >> 2) + _FixedStack4 = _FixedStack3 | (_FixedStack3 >> 4) + _FixedStack5 = _FixedStack4 | (_FixedStack4 >> 8) + _FixedStack6 = _FixedStack5 | (_FixedStack5 >> 16) + _FixedStack = _FixedStack6 + 1 + + _StackBig = 4096 + + _StackGuard = 720*sys.StackGuardMultiplier + _StackSystem + + _StackSmall = 128 + + _StackLimit = _StackGuard - _StackSystem - _StackSmall +) + +// Goroutine preemption request. +// Stored into g->stackguard0 to cause split stack check failure. +// Must be greater than any real sp. +// 0xfffffade in hex. +const ( + _StackPreempt = uintptrMask & -1314 + _StackFork = uintptrMask & -1234 +) + +const ( + stackDebug = 0 + stackFromSystem = 0 + stackFaultOnFree = 0 + stackPoisonCopy = 0 + + stackCache = 1 +) + +const ( + uintptrMask = 1<<(8*sys.PtrSize) - 1 + + stackPreempt = uintptrMask & -1314 + + stackFork = uintptrMask & -1234 +) + +type adjustinfo struct { + old stack + delta uintptr + cache pcvalueCache + + sghi uintptr +} + +// Information from the compiler about the layout of stack frames. +type bitvector struct { + n int32 + bytedata *uint8 +} + +type gobitvector struct { + n uintptr + bytedata []uint8 +} diff --git a/hack/go1_7_2/runtime/string.go b/hack/go1_7_2/runtime/string.go new file mode 100644 index 0000000..4c07b53 --- /dev/null +++ b/hack/go1_7_2/runtime/string.go @@ -0,0 +1,26 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +// The constant is known to the compiler. +// There is no fundamental theory behind this number. +const tmpStringBufSize = 32 + +type tmpBuf [tmpStringBufSize]byte + +type stringStruct struct { + str unsafe.Pointer + len int +} + +// Variant with *byte pointer type for DWARF debugging. +type stringStructDWARF struct { + str *byte + len int +} diff --git a/hack/go1_7_2/runtime/stubs.go b/hack/go1_7_2/runtime/stubs.go new file mode 100644 index 0000000..c661169 --- /dev/null +++ b/hack/go1_7_2/runtime/stubs.go @@ -0,0 +1,10 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type neverCallThisFunction struct{} + +// argp used in Defer structs when there is no argp. +const _NoArgs = ^uintptr(0) diff --git a/hack/go1_7_2/runtime/symtab.go b/hack/go1_7_2/runtime/symtab.go new file mode 100644 index 0000000..af1e670 --- /dev/null +++ b/hack/go1_7_2/runtime/symtab.go @@ -0,0 +1,124 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +// Frames may be used to get function/file/line information for a +// slice of PC values returned by Callers. +type Frames struct { + callers []uintptr + + wasPanic bool + + frames *[]Frame +} + +// Frame is the information returned by Frames for each call frame. +type Frame struct { + PC uintptr + + Func *Func + + Function string + File string + Line int + + Entry uintptr +} + +// A Func represents a Go function in the running binary. +type Func struct { + opaque struct{} +} + +// funcdata.h +const ( + _PCDATA_StackMapIndex = 0 + _FUNCDATA_ArgsPointerMaps = 0 + _FUNCDATA_LocalsPointerMaps = 1 + _ArgsSizeUnknown = -0x80000000 +) + +// moduledata records information about the layout of the executable +// image. It is written by the linker. Any changes here must be +// matched changes to the code in cmd/internal/ld/symtab.go:symtab. +// moduledata is stored in read-only memory; none of the pointers here +// are visible to the garbage collector. +type moduledata struct { + pclntable []byte + ftab []functab + filetab []uint32 + findfunctab uintptr + minpc, maxpc uintptr + + text, etext uintptr + noptrdata, enoptrdata uintptr + data, edata uintptr + bss, ebss uintptr + noptrbss, enoptrbss uintptr + end, gcdata, gcbss uintptr + types, etypes uintptr + + typelinks []int32 + itablinks []*itab + + modulename string + modulehashes []modulehash + + gcdatamask, gcbssmask bitvector + + typemap map[typeOff]*_type + + next *moduledata +} + +// For each shared library a module links against, the linker creates an entry in the +// moduledata.modulehashes slice containing the name of the module, the abi hash seen +// at link time and a pointer to the runtime abi hash. These are checked in +// moduledataverify1 below. +type modulehash struct { + modulename string + linktimehash string + runtimehash *string +} + +type functab struct { + entry uintptr + funcoff uintptr +} + +const minfunc = 16 +const pcbucketsize = 256 * minfunc + +// findfunctab is an array of these structures. +// Each bucket represents 4096 bytes of the text segment. +// Each subbucket represents 256 bytes of the text segment. +// To find a function given a pc, locate the bucket and subbucket for +// that pc. Add together the idx and subbucket value to obtain a +// function index. Then scan the functab array starting at that +// index to find the target function. +// This table uses 20 bytes for every 4096 bytes of code, or ~0.5% overhead. +type findfuncbucket struct { + idx uint32 + subbuckets [16]byte +} + +const debugPcln = false + +type pcvalueCache struct { + entries [16]pcvalueCacheEnt +} + +type pcvalueCacheEnt struct { + targetpc uintptr + off int32 + + val int32 +} + +type stackmap struct { + n int32 + nbit int32 + bytedata [1]byte +} diff --git a/hack/go1_7_2/runtime/syscall_windows.go b/hack/go1_7_2/runtime/syscall_windows.go new file mode 100644 index 0000000..6488ff0 --- /dev/null +++ b/hack/go1_7_2/runtime/syscall_windows.go @@ -0,0 +1,13 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type callbacks struct { + lock mutex + ctxt [cb_max]*wincallbackcontext + n int +} + +const _LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 diff --git a/hack/go1_7_2/runtime/time.go b/hack/go1_7_2/runtime/time.go new file mode 100644 index 0000000..6000489 --- /dev/null +++ b/hack/go1_7_2/runtime/time.go @@ -0,0 +1,21 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Time-related runtime and pieces of package time. + +package runtime + +// Package time knows the layout of this structure. +// If this struct changes, adjust ../time/sleep.go:/runtimeTimer. +// For GOOS=nacl, package syscall knows the layout of this structure. +// If this struct changes, adjust ../syscall/net_nacl.go:/runtimeTimer. +type timer struct { + i int + + when int64 + period int64 + f func(interface{}, uintptr) + arg interface{} + seq uintptr +} diff --git a/hack/go1_7_2/runtime/trace.go b/hack/go1_7_2/runtime/trace.go new file mode 100644 index 0000000..d9557a6 --- /dev/null +++ b/hack/go1_7_2/runtime/trace.go @@ -0,0 +1,144 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Go execution tracer. +// The tracer captures a wide range of execution events like goroutine +// creation/blocking/unblocking, syscall enter/exit/block, GC-related events, +// changes of heap size, processor start/stop, etc and writes them to a buffer +// in a compact form. A precise nanosecond-precision timestamp and a stack +// trace is captured for most events. +// See https://golang.org/s/go15trace for more info. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_2/runtime/internal/sys" + "unsafe" +) + +// Event types in the trace, args are given in square brackets. +const ( + traceEvNone = 0 + traceEvBatch = 1 + traceEvFrequency = 2 + traceEvStack = 3 + traceEvGomaxprocs = 4 + traceEvProcStart = 5 + traceEvProcStop = 6 + traceEvGCStart = 7 + traceEvGCDone = 8 + traceEvGCScanStart = 9 + traceEvGCScanDone = 10 + traceEvGCSweepStart = 11 + traceEvGCSweepDone = 12 + traceEvGoCreate = 13 + traceEvGoStart = 14 + traceEvGoEnd = 15 + traceEvGoStop = 16 + traceEvGoSched = 17 + traceEvGoPreempt = 18 + traceEvGoSleep = 19 + traceEvGoBlock = 20 + traceEvGoUnblock = 21 + traceEvGoBlockSend = 22 + traceEvGoBlockRecv = 23 + traceEvGoBlockSelect = 24 + traceEvGoBlockSync = 25 + traceEvGoBlockCond = 26 + traceEvGoBlockNet = 27 + traceEvGoSysCall = 28 + traceEvGoSysExit = 29 + traceEvGoSysBlock = 30 + traceEvGoWaiting = 31 + traceEvGoInSyscall = 32 + traceEvHeapAlloc = 33 + traceEvNextGC = 34 + traceEvTimerGoroutine = 35 + traceEvFutileWakeup = 36 + traceEvString = 37 + traceEvGoStartLocal = 38 + traceEvGoUnblockLocal = 39 + traceEvGoSysExitLocal = 40 + traceEvCount = 41 +) + +const ( + traceTickDiv = 16 + 48*(sys.Goarch386|sys.GoarchAmd64|sys.GoarchAmd64p32) + + traceStackSize = 128 + + traceGlobProc = -1 + + traceBytesPerNumber = 10 + + traceArgCountShift = 6 + + traceFutileWakeup byte = 128 +) + +// traceBufHeader is per-P tracing buffer. +type traceBufHeader struct { + link traceBufPtr + lastTicks uint64 + pos int + stk [traceStackSize]uintptr +} + +// traceBuf is per-P tracing buffer. +type traceBuf struct { + traceBufHeader + arr [64<<10 - unsafe.Sizeof(traceBufHeader{})]byte +} + +// traceBufPtr is a *traceBuf that is not traced by the garbage +// collector and doesn't have write barriers. traceBufs are not +// allocated from the GC'd heap, so this is safe, and are often +// manipulated in contexts where write barriers are not allowed, so +// this is necessary. +type traceBufPtr uintptr + +// traceStackTable maps stack traces (arrays of PC's) to unique uint32 ids. +// It is lock-free for reading. +type traceStackTable struct { + lock mutex + seq uint32 + mem traceAlloc + tab [1 << 13]traceStackPtr +} + +// traceStack is a single stack in traceStackTable. +type traceStack struct { + link traceStackPtr + hash uintptr + id uint32 + n int + stk [0]uintptr +} + +type traceStackPtr uintptr + +type traceFrame struct { + funcID uint64 + fileID uint64 + line uint64 +} + +// traceAlloc is a non-thread-safe region allocator. +// It holds a linked list of traceAllocBlock. +type traceAlloc struct { + head traceAllocBlockPtr + off uintptr +} + +// traceAllocBlock is a block in traceAlloc. +// +// traceAllocBlock is allocated from non-GC'd memory, so it must not +// contain heap pointers. Writes to pointers to traceAllocBlocks do +// not need write barriers. +type traceAllocBlock struct { + next traceAllocBlockPtr + data [64<<10 - sys.PtrSize]byte +} + +type traceAllocBlockPtr uintptr diff --git a/hack/go1_7_2/runtime/traceback.go b/hack/go1_7_2/runtime/traceback.go new file mode 100644 index 0000000..e2c6791 --- /dev/null +++ b/hack/go1_7_2/runtime/traceback.go @@ -0,0 +1,35 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_2/runtime/internal/sys" +) + +const usesLR = sys.MinFrameSize > 0 + +// cgoTracebackArg is the type passed to cgoTraceback. +type cgoTracebackArg struct { + context uintptr + sigContext uintptr + buf *uintptr + max uintptr +} + +// cgoContextArg is the type passed to the context function. +type cgoContextArg struct { + context uintptr +} + +// cgoSymbolizerArg is the type passed to cgoSymbolizer. +type cgoSymbolizerArg struct { + pc uintptr + file *byte + lineno uintptr + funcName *byte + entry uintptr + more uintptr + data uintptr +} diff --git a/hack/go1_7_2/runtime/type.go b/hack/go1_7_2/runtime/type.go new file mode 100644 index 0000000..491a011 --- /dev/null +++ b/hack/go1_7_2/runtime/type.go @@ -0,0 +1,131 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Runtime type representation. + +package runtime + +// tflag is documented in reflect/type.go. +// +// tflag values must be kept in sync with copies in: +// cmd/compile/internal/gc/reflect.go +// cmd/link/internal/ld/decodesym.go +// reflect/type.go +type tflag uint8 + +const ( + tflagUncommon tflag = 1 << 0 + tflagExtraStar tflag = 1 << 1 + tflagNamed tflag = 1 << 2 +) + +// Needs to be in sync with ../cmd/compile/internal/ld/decodesym.go:/^func.commonsize, +// ../cmd/compile/internal/gc/reflect.go:/^func.dcommontype and +// ../reflect/type.go:/^type.rtype. +type _type struct { + size uintptr + ptrdata uintptr + hash uint32 + tflag tflag + align uint8 + fieldalign uint8 + kind uint8 + alg *typeAlg + + gcdata *byte + str nameOff + ptrToThis typeOff +} + +type nameOff int32 +type typeOff int32 +type textOff int32 + +type method struct { + name nameOff + mtyp typeOff + ifn textOff + tfn textOff +} + +type uncommontype struct { + pkgpath nameOff + mcount uint16 + _ uint16 + moff uint32 + _ uint32 +} + +type imethod struct { + name nameOff + ityp typeOff +} + +type interfacetype struct { + typ _type + pkgpath name + mhdr []imethod +} + +type maptype struct { + typ _type + key *_type + elem *_type + bucket *_type + hmap *_type + keysize uint8 + indirectkey bool + valuesize uint8 + indirectvalue bool + bucketsize uint16 + reflexivekey bool + needkeyupdate bool +} + +type arraytype struct { + typ _type + elem *_type + slice *_type + len uintptr +} + +type chantype struct { + typ _type + elem *_type + dir uintptr +} + +type slicetype struct { + typ _type + elem *_type +} + +type functype struct { + typ _type + inCount uint16 + outCount uint16 +} + +type ptrtype struct { + typ _type + elem *_type +} + +type structfield struct { + name name + typ *_type + offset uintptr +} + +type structtype struct { + typ _type + pkgPath name + fields []structfield +} + +// name is an encoded type name with optional extra data. +// See reflect/type.go for details. +type name struct { + bytes *byte +} diff --git a/hack/go1_7_2/runtime/typekind.go b/hack/go1_7_2/runtime/typekind.go new file mode 100644 index 0000000..98aabf7 --- /dev/null +++ b/hack/go1_7_2/runtime/typekind.go @@ -0,0 +1,39 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + kindBool = 1 + iota + kindInt + kindInt8 + kindInt16 + kindInt32 + kindInt64 + kindUint + kindUint8 + kindUint16 + kindUint32 + kindUint64 + kindUintptr + kindFloat32 + kindFloat64 + kindComplex64 + kindComplex128 + kindArray + kindChan + kindFunc + kindInterface + kindMap + kindPtr + kindSlice + kindString + kindStruct + kindUnsafePointer + + kindDirectIface = 1 << 5 + kindGCProg = 1 << 6 + kindNoPointers = 1 << 7 + kindMask = (1 << 5) - 1 +) diff --git a/hack/go1_7_2/runtime/vdso_linux_amd64.go b/hack/go1_7_2/runtime/vdso_linux_amd64.go new file mode 100644 index 0000000..47a17ef --- /dev/null +++ b/hack/go1_7_2/runtime/vdso_linux_amd64.go @@ -0,0 +1,133 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _AT_SYSINFO_EHDR = 33 + + _PT_LOAD = 1 + _PT_DYNAMIC = 2 + + _DT_NULL = 0 + _DT_HASH = 4 + _DT_STRTAB = 5 + _DT_SYMTAB = 6 + _DT_VERSYM = 0x6ffffff0 + _DT_VERDEF = 0x6ffffffc + + _VER_FLG_BASE = 0x1 + + _SHN_UNDEF = 0 + + _SHT_DYNSYM = 11 + + _STT_FUNC = 2 + + _STB_GLOBAL = 1 + _STB_WEAK = 2 + + _EI_NIDENT = 16 +) + +type elf64Sym struct { + st_name uint32 + st_info byte + st_other byte + st_shndx uint16 + st_value uint64 + st_size uint64 +} + +type elf64Verdef struct { + vd_version uint16 + vd_flags uint16 + vd_ndx uint16 + vd_cnt uint16 + vd_hash uint32 + vd_aux uint32 + vd_next uint32 +} + +type elf64Ehdr struct { + e_ident [_EI_NIDENT]byte + e_type uint16 + e_machine uint16 + e_version uint32 + e_entry uint64 + e_phoff uint64 + e_shoff uint64 + e_flags uint32 + e_ehsize uint16 + e_phentsize uint16 + e_phnum uint16 + e_shentsize uint16 + e_shnum uint16 + e_shstrndx uint16 +} + +type elf64Phdr struct { + p_type uint32 + p_flags uint32 + p_offset uint64 + p_vaddr uint64 + p_paddr uint64 + p_filesz uint64 + p_memsz uint64 + p_align uint64 +} + +type elf64Shdr struct { + sh_name uint32 + sh_type uint32 + sh_flags uint64 + sh_addr uint64 + sh_offset uint64 + sh_size uint64 + sh_link uint32 + sh_info uint32 + sh_addralign uint64 + sh_entsize uint64 +} + +type elf64Dyn struct { + d_tag int64 + d_val uint64 +} + +type elf64Verdaux struct { + vda_name uint32 + vda_next uint32 +} + +type elf64Auxv struct { + a_type uint64 + a_val uint64 +} + +type symbol_key struct { + name string + sym_hash uint32 + ptr *uintptr +} + +type version_key struct { + version string + ver_hash uint32 +} + +type vdso_info struct { + valid bool + + load_addr uintptr + load_offset uintptr + + symtab *[1 << 32]elf64Sym + symstrings *[1 << 32]byte + chain []uint32 + bucket []uint32 + + versym *[1 << 32]uint16 + verdef *elf64Verdef +} diff --git a/hack/go1_7_2/runtime/vlrt.go b/hack/go1_7_2/runtime/vlrt.go new file mode 100644 index 0000000..adbf471 --- /dev/null +++ b/hack/go1_7_2/runtime/vlrt.go @@ -0,0 +1,33 @@ +// Inferno's libkern/vlrt-arm.c +// http://code.google.com/p/inferno-os/source/browse/libkern/vlrt-arm.c +// +// Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. +// Revisions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com). All rights reserved. +// Portions Copyright 2009 The Go Authors. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// +build arm 386 + +package runtime + +const ( + sign32 = 1 << (32 - 1) + sign64 = 1 << (64 - 1) +) diff --git a/hack/go1_7_2/runtime/write_err_android.go b/hack/go1_7_2/runtime/write_err_android.go new file mode 100644 index 0000000..50aaf92 --- /dev/null +++ b/hack/go1_7_2/runtime/write_err_android.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +// Prior to Android-L, logging was done through writes to /dev/log files implemented +// in kernel ring buffers. In Android-L, those /dev/log files are no longer +// accessible and logging is done through a centralized user-mode logger, logd. +// +// https://android.googlesource.com/platform/system/core/+/master/liblog/logd_write.c +type loggerType int32 + +const ( + unknown loggerType = iota + legacy + logd +) diff --git a/hack/go1_7_2/runtime/zcallback_windows.go b/hack/go1_7_2/runtime/zcallback_windows.go new file mode 100644 index 0000000..2138906 --- /dev/null +++ b/hack/go1_7_2/runtime/zcallback_windows.go @@ -0,0 +1,5 @@ +// generated by wincallback.go; run go generate + +package runtime + +const cb_max = 2000 diff --git a/hack/go1_7_3/runtime/alg.go b/hack/go1_7_3/runtime/alg.go new file mode 100644 index 0000000..e720308 --- /dev/null +++ b/hack/go1_7_3/runtime/alg.go @@ -0,0 +1,44 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_3/runtime/internal/sys" + "unsafe" +) + +const ( + c0 = uintptr((8-sys.PtrSize)/4*2860486313 + (sys.PtrSize-4)/4*33054211828000289) + c1 = uintptr((8-sys.PtrSize)/4*3267000013 + (sys.PtrSize-4)/4*23344194077549503) +) + +// type algorithms - known to compiler +const ( + alg_NOEQ = iota + alg_MEM0 + alg_MEM8 + alg_MEM16 + alg_MEM32 + alg_MEM64 + alg_MEM128 + alg_STRING + alg_INTER + alg_NILINTER + alg_FLOAT32 + alg_FLOAT64 + alg_CPLX64 + alg_CPLX128 + alg_max +) + +// typeAlg is also copied/used in reflect/type.go. +// keep them in sync. +type typeAlg struct { + hash func(unsafe.Pointer, uintptr) uintptr + + equal func(unsafe.Pointer, unsafe.Pointer) bool +} + +const hashRandomBytes = sys.PtrSize / 4 * 64 diff --git a/hack/go1_7_3/runtime/cgocall.go b/hack/go1_7_3/runtime/cgocall.go new file mode 100644 index 0000000..c58a56a --- /dev/null +++ b/hack/go1_7_3/runtime/cgocall.go @@ -0,0 +1,87 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Cgo call and callback support. +// +// To call into the C function f from Go, the cgo-generated code calls +// runtime.cgocall(_cgo_Cfunc_f, frame), where _cgo_Cfunc_f is a +// gcc-compiled function written by cgo. +// +// runtime.cgocall (below) locks g to m, calls entersyscall +// so as not to block other goroutines or the garbage collector, +// and then calls runtime.asmcgocall(_cgo_Cfunc_f, frame). +// +// runtime.asmcgocall (in asm_$GOARCH.s) switches to the m->g0 stack +// (assumed to be an operating system-allocated stack, so safe to run +// gcc-compiled code on) and calls _cgo_Cfunc_f(frame). +// +// _cgo_Cfunc_f invokes the actual C function f with arguments +// taken from the frame structure, records the results in the frame, +// and returns to runtime.asmcgocall. +// +// After it regains control, runtime.asmcgocall switches back to the +// original g (m->curg)'s stack and returns to runtime.cgocall. +// +// After it regains control, runtime.cgocall calls exitsyscall, which blocks +// until this m can run Go code without violating the $GOMAXPROCS limit, +// and then unlocks g from m. +// +// The above description skipped over the possibility of the gcc-compiled +// function f calling back into Go. If that happens, we continue down +// the rabbit hole during the execution of f. +// +// To make it possible for gcc-compiled C code to call a Go function p.GoF, +// cgo writes a gcc-compiled function named GoF (not p.GoF, since gcc doesn't +// know about packages). The gcc-compiled C function f calls GoF. +// +// GoF calls crosscall2(_cgoexp_GoF, frame, framesize). Crosscall2 +// (in cgo/gcc_$GOARCH.S, a gcc-compiled assembly file) is a two-argument +// adapter from the gcc function call ABI to the 6c function call ABI. +// It is called from gcc to call 6c functions. In this case it calls +// _cgoexp_GoF(frame, framesize), still running on m->g0's stack +// and outside the $GOMAXPROCS limit. Thus, this code cannot yet +// call arbitrary Go code directly and must be careful not to allocate +// memory or use up m->g0's stack. +// +// _cgoexp_GoF calls runtime.cgocallback(p.GoF, frame, framesize, ctxt). +// (The reason for having _cgoexp_GoF instead of writing a crosscall3 +// to make this call directly is that _cgoexp_GoF, because it is compiled +// with 6c instead of gcc, can refer to dotted names like +// runtime.cgocallback and p.GoF.) +// +// runtime.cgocallback (in asm_$GOARCH.s) switches from m->g0's +// stack to the original g (m->curg)'s stack, on which it calls +// runtime.cgocallbackg(p.GoF, frame, framesize). +// As part of the stack switch, runtime.cgocallback saves the current +// SP as m->g0->sched.sp, so that any use of m->g0's stack during the +// execution of the callback will be done below the existing stack frames. +// Before overwriting m->g0->sched.sp, it pushes the old value on the +// m->g0 stack, so that it can be restored later. +// +// runtime.cgocallbackg (below) is now running on a real goroutine +// stack (not an m->g0 stack). First it calls runtime.exitsyscall, which will +// block until the $GOMAXPROCS limit allows running this goroutine. +// Once exitsyscall has returned, it is safe to do things like call the memory +// allocator or invoke the Go callback function p.GoF. runtime.cgocallbackg +// first defers a function to unwind m->g0.sched.sp, so that if p.GoF +// panics, m->g0.sched.sp will be restored to its old value: the m->g0 stack +// and the m->curg stack will be unwound in lock step. +// Then it calls p.GoF. Finally it pops but does not execute the deferred +// function, calls runtime.entersyscall, and returns to runtime.cgocallback. +// +// After it regains control, runtime.cgocallback switches back to +// m->g0's stack (the pointer is still in m->g0.sched.sp), restores the old +// m->g0.sched.sp value from the stack, and returns to _cgoexp_GoF. +// +// _cgoexp_GoF immediately returns to crosscall2, which restores the +// callee-save registers for gcc and returns to GoF, which returns to f. + +package runtime + +// Addresses collected in a cgo backtrace when crashing. +// Length must match arg.Max in x_cgo_callers in runtime/cgo/gcc_traceback.c. +type cgoCallers [32]uintptr + +const cgoCheckPointerFail = "cgo argument has Go pointer to Go pointer" +const cgoResultFail = "cgo result has Go pointer" diff --git a/hack/go1_7_3/runtime/cgocheck.go b/hack/go1_7_3/runtime/cgocheck.go new file mode 100644 index 0000000..742035c --- /dev/null +++ b/hack/go1_7_3/runtime/cgocheck.go @@ -0,0 +1,10 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code to check that pointer writes follow the cgo rules. +// These functions are invoked via the write barrier when debug.cgocheck > 1. + +package runtime + +const cgoWriteBarrierFail = "Go pointer stored into non-Go memory" diff --git a/hack/go1_7_3/runtime/chan.go b/hack/go1_7_3/runtime/chan.go new file mode 100644 index 0000000..f116158 --- /dev/null +++ b/hack/go1_7_3/runtime/chan.go @@ -0,0 +1,35 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +const ( + maxAlign = 8 + hchanSize = unsafe.Sizeof(hchan{}) + uintptr(-int(unsafe.Sizeof(hchan{}))&(maxAlign-1)) + debugChan = false +) + +type hchan struct { + qcount uint + dataqsiz uint + buf unsafe.Pointer + elemsize uint16 + closed uint32 + elemtype *_type + sendx uint + recvx uint + recvq waitq + sendq waitq + + lock mutex +} + +type waitq struct { + first *sudog + last *sudog +} diff --git a/hack/go1_7_3/runtime/compiler.go b/hack/go1_7_3/runtime/compiler.go new file mode 100644 index 0000000..1ebc62d --- /dev/null +++ b/hack/go1_7_3/runtime/compiler.go @@ -0,0 +1,13 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +// Compiler is the name of the compiler toolchain that built the +// running binary. Known toolchains are: +// +// gc Also known as cmd/compile. +// gccgo The gccgo front end, part of the GCC compiler suite. +// +const Compiler = "gc" diff --git a/hack/go1_7_3/runtime/cpuprof.go b/hack/go1_7_3/runtime/cpuprof.go new file mode 100644 index 0000000..3aa254a --- /dev/null +++ b/hack/go1_7_3/runtime/cpuprof.go @@ -0,0 +1,86 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// CPU profiling. +// Based on algorithms and data structures used in +// http://code.google.com/p/google-perftools/. +// +// The main difference between this code and the google-perftools +// code is that this code is written to allow copying the profile data +// to an arbitrary io.Writer, while the google-perftools code always +// writes to an operating system file. +// +// The signal handler for the profiling clock tick adds a new stack trace +// to a hash table tracking counts for recent traces. Most clock ticks +// hit in the cache. In the event of a cache miss, an entry must be +// evicted from the hash table, copied to a log that will eventually be +// written as profile data. The google-perftools code flushed the +// log itself during the signal handler. This code cannot do that, because +// the io.Writer might block or need system calls or locks that are not +// safe to use from within the signal handler. Instead, we split the log +// into two halves and let the signal handler fill one half while a goroutine +// is writing out the other half. When the signal handler fills its half, it +// offers to swap with the goroutine. If the writer is not done with its half, +// we lose the stack trace for this clock tick (and record that loss). +// The goroutine interacts with the signal handler by calling getprofile() to +// get the next log piece to write, implicitly handing back the last log +// piece it obtained. +// +// The state of this dance between the signal handler and the goroutine +// is encoded in the Profile.handoff field. If handoff == 0, then the goroutine +// is not using either log half and is waiting (or will soon be waiting) for +// a new piece by calling notesleep(&p.wait). If the signal handler +// changes handoff from 0 to non-zero, it must call notewakeup(&p.wait) +// to wake the goroutine. The value indicates the number of entries in the +// log half being handed off. The goroutine leaves the non-zero value in +// place until it has finished processing the log half and then flips the number +// back to zero. Setting the high bit in handoff means that the profiling is over, +// and the goroutine is now in charge of flushing the data left in the hash table +// to the log and returning that data. +// +// The handoff field is manipulated using atomic operations. +// For the most part, the manipulation of handoff is orderly: if handoff == 0 +// then the signal handler owns it and can change it to non-zero. +// If handoff != 0 then the goroutine owns it and can change it to zero. +// If that were the end of the story then we would not need to manipulate +// handoff using atomic operations. The operations are needed, however, +// in order to let the log closer set the high bit to indicate "EOF" safely +// in the situation when normally the goroutine "owns" handoff. + +package runtime + +const ( + numBuckets = 1 << 10 + logSize = 1 << 17 + assoc = 4 + maxCPUProfStack = 64 +) + +type cpuprofEntry struct { + count uintptr + depth int + stack [maxCPUProfStack]uintptr +} + +type cpuProfile struct { + on bool + wait note + count uintptr + evicts uintptr + lost uintptr + + hash [numBuckets]struct { + entry [assoc]cpuprofEntry + } + + log [2][logSize / 2]uintptr + nlog int + toggle int32 + handoff uint32 + + wtoggle uint32 + wholding bool + flushing bool + eodSent bool +} diff --git a/hack/go1_7_3/runtime/defs1_netbsd_386.go b/hack/go1_7_3/runtime/defs1_netbsd_386.go new file mode 100644 index 0000000..9ce0fa6 --- /dev/null +++ b/hack/go1_7_3/runtime/defs1_netbsd_386.go @@ -0,0 +1,168 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_netbsd.go defs_netbsd_386.go + +package runtime + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x6 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0 + _EV_ERROR = 0x4000 + _EVFILT_READ = 0x0 + _EVFILT_WRITE = 0x1 +) + +type sigaltstackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type sigset struct { + __bits [4]uint32 +} + +type siginfo struct { + _signo int32 + _code int32 + _errno int32 + _reason [20]byte +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type timespec struct { + tv_sec int64 + tv_nsec int32 +} + +type timeval struct { + tv_sec int64 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type mcontextt struct { + __gregs [19]uint32 + __fpregs [644]byte + _mc_tlsbase int32 +} + +type ucontextt struct { + uc_flags uint32 + uc_link *ucontextt + uc_sigmask sigset + uc_stack stackt + uc_mcontext mcontextt + __uc_pad [4]int32 +} + +type keventt struct { + ident uint32 + filter uint32 + flags uint32 + fflags uint32 + data int64 + udata *byte +} + +const ( + _REG_GS = 0x0 + _REG_FS = 0x1 + _REG_ES = 0x2 + _REG_DS = 0x3 + _REG_EDI = 0x4 + _REG_ESI = 0x5 + _REG_EBP = 0x6 + _REG_ESP = 0x7 + _REG_EBX = 0x8 + _REG_EDX = 0x9 + _REG_ECX = 0xa + _REG_EAX = 0xb + _REG_TRAPNO = 0xc + _REG_ERR = 0xd + _REG_EIP = 0xe + _REG_CS = 0xf + _REG_EFL = 0x10 + _REG_UESP = 0x11 + _REG_SS = 0x12 +) diff --git a/hack/go1_7_3/runtime/defs1_netbsd_amd64.go b/hack/go1_7_3/runtime/defs1_netbsd_amd64.go new file mode 100644 index 0000000..7eeea83 --- /dev/null +++ b/hack/go1_7_3/runtime/defs1_netbsd_amd64.go @@ -0,0 +1,180 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_netbsd.go defs_netbsd_amd64.go + +package runtime + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x6 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0 + _EV_ERROR = 0x4000 + _EVFILT_READ = 0x0 + _EVFILT_WRITE = 0x1 +) + +type sigaltstackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type sigset struct { + __bits [4]uint32 +} + +type siginfo struct { + _signo int32 + _code int32 + _errno int32 + _pad int32 + _reason [24]byte +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int32 + pad_cgo_0 [4]byte +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type mcontextt struct { + __gregs [26]uint64 + _mc_tlsbase uint64 + __fpregs [512]int8 +} + +type ucontextt struct { + uc_flags uint32 + pad_cgo_0 [4]byte + uc_link *ucontextt + uc_sigmask sigset + uc_stack stackt + uc_mcontext mcontextt +} + +type keventt struct { + ident uint64 + filter uint32 + flags uint32 + fflags uint32 + pad_cgo_0 [4]byte + data int64 + udata *byte +} + +const ( + _REG_RDI = 0x0 + _REG_RSI = 0x1 + _REG_RDX = 0x2 + _REG_RCX = 0x3 + _REG_R8 = 0x4 + _REG_R9 = 0x5 + _REG_R10 = 0x6 + _REG_R11 = 0x7 + _REG_R12 = 0x8 + _REG_R13 = 0x9 + _REG_R14 = 0xa + _REG_R15 = 0xb + _REG_RBP = 0xc + _REG_RBX = 0xd + _REG_RAX = 0xe + _REG_GS = 0xf + _REG_FS = 0x10 + _REG_ES = 0x11 + _REG_DS = 0x12 + _REG_TRAPNO = 0x13 + _REG_ERR = 0x14 + _REG_RIP = 0x15 + _REG_CS = 0x16 + _REG_RFLAGS = 0x17 + _REG_RSP = 0x18 + _REG_SS = 0x19 +) diff --git a/hack/go1_7_3/runtime/defs1_netbsd_arm.go b/hack/go1_7_3/runtime/defs1_netbsd_arm.go new file mode 100644 index 0000000..543b080 --- /dev/null +++ b/hack/go1_7_3/runtime/defs1_netbsd_arm.go @@ -0,0 +1,168 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_netbsd.go defs_netbsd_arm.go + +package runtime + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x6 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0 + _EV_ERROR = 0x4000 + _EVFILT_READ = 0x0 + _EVFILT_WRITE = 0x1 +) + +type sigaltstackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type sigset struct { + __bits [4]uint32 +} + +type siginfo struct { + _signo int32 + _code int32 + _errno int32 + _reason uintptr + _reasonx [16]byte +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type timespec struct { + tv_sec int64 + tv_nsec int32 +} + +type timeval struct { + tv_sec int64 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type mcontextt struct { + __gregs [17]uint32 + __fpu [4 + 8*32 + 4]byte + + _mc_tlsbase uint32 +} + +type ucontextt struct { + uc_flags uint32 + uc_link *ucontextt + uc_sigmask sigset + uc_stack stackt + uc_mcontext mcontextt + __uc_pad [2]int32 +} + +type keventt struct { + ident uint32 + filter uint32 + flags uint32 + fflags uint32 + data int64 + udata *byte +} + +const ( + _REG_R0 = 0x0 + _REG_R1 = 0x1 + _REG_R2 = 0x2 + _REG_R3 = 0x3 + _REG_R4 = 0x4 + _REG_R5 = 0x5 + _REG_R6 = 0x6 + _REG_R7 = 0x7 + _REG_R8 = 0x8 + _REG_R9 = 0x9 + _REG_R10 = 0xa + _REG_R11 = 0xb + _REG_R12 = 0xc + _REG_R13 = 0xd + _REG_R14 = 0xe + _REG_R15 = 0xf + _REG_CPSR = 0x10 +) diff --git a/hack/go1_7_3/runtime/defs1_solaris_amd64.go b/hack/go1_7_3/runtime/defs1_solaris_amd64.go new file mode 100644 index 0000000..cd472a4 --- /dev/null +++ b/hack/go1_7_3/runtime/defs1_solaris_amd64.go @@ -0,0 +1,238 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_solaris.go defs_solaris_amd64.go + +package runtime + +const ( + _EINTR = 0x4 + _EBADF = 0x9 + _EFAULT = 0xe + _EAGAIN = 0xb + _ETIMEDOUT = 0x91 + _EWOULDBLOCK = 0xb + _EINPROGRESS = 0x96 + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x100 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x5 + + _SA_SIGINFO = 0x8 + _SA_RESTART = 0x4 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x15 + _SIGSTOP = 0x17 + _SIGTSTP = 0x18 + _SIGCONT = 0x19 + _SIGCHLD = 0x12 + _SIGTTIN = 0x1a + _SIGTTOU = 0x1b + _SIGIO = 0x16 + _SIGXCPU = 0x1e + _SIGXFSZ = 0x1f + _SIGVTALRM = 0x1c + _SIGPROF = 0x1d + _SIGWINCH = 0x14 + _SIGUSR1 = 0x10 + _SIGUSR2 = 0x11 + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + __SC_NPROCESSORS_ONLN = 0xf + + _PTHREAD_CREATE_DETACHED = 0x40 + + _FORK_NOSIGCHLD = 0x1 + _FORK_WAITPID = 0x2 + + _MAXHOSTNAMELEN = 0x100 + + _O_NONBLOCK = 0x80 + _FD_CLOEXEC = 0x1 + _F_GETFL = 0x3 + _F_SETFL = 0x4 + _F_SETFD = 0x2 + + _POLLIN = 0x1 + _POLLOUT = 0x4 + _POLLHUP = 0x10 + _POLLERR = 0x8 + + _PORT_SOURCE_FD = 0x4 +) + +type semt struct { + sem_count uint32 + sem_type uint16 + sem_magic uint16 + sem_pad1 [3]uint64 + sem_pad2 [2]uint64 +} + +type sigaltstackt struct { + ss_sp *byte + ss_size uint64 + ss_flags int32 + pad_cgo_0 [4]byte +} + +type sigset struct { + __sigbits [4]uint32 +} + +type stackt struct { + ss_sp *byte + ss_size uint64 + ss_flags int32 + pad_cgo_0 [4]byte +} + +type siginfo struct { + si_signo int32 + si_code int32 + si_errno int32 + si_pad int32 + __data [240]byte +} + +type sigactiont struct { + sa_flags int32 + pad_cgo_0 [4]byte + _funcptr [8]byte + sa_mask sigset +} + +type fpregset struct { + fp_reg_set [528]byte +} + +type mcontext struct { + gregs [28]int64 + fpregs fpregset +} + +type ucontext struct { + uc_flags uint64 + uc_link *ucontext + uc_sigmask sigset + uc_stack stackt + pad_cgo_0 [8]byte + uc_mcontext mcontext + uc_filler [5]int64 + pad_cgo_1 [8]byte +} + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type portevent struct { + portev_events int32 + portev_source uint16 + portev_pad uint16 + portev_object uint64 + portev_user *byte +} + +type pthread uint32 +type pthreadattr struct { + __pthread_attrp *byte +} + +type stat struct { + st_dev uint64 + st_ino uint64 + st_mode uint32 + st_nlink uint32 + st_uid uint32 + st_gid uint32 + st_rdev uint64 + st_size int64 + st_atim timespec + st_mtim timespec + st_ctim timespec + st_blksize int32 + pad_cgo_0 [4]byte + st_blocks int64 + st_fstype [16]int8 +} + +const ( + _REG_RDI = 0x8 + _REG_RSI = 0x9 + _REG_RDX = 0xc + _REG_RCX = 0xd + _REG_R8 = 0x7 + _REG_R9 = 0x6 + _REG_R10 = 0x5 + _REG_R11 = 0x4 + _REG_R12 = 0x3 + _REG_R13 = 0x2 + _REG_R14 = 0x1 + _REG_R15 = 0x0 + _REG_RBP = 0xa + _REG_RBX = 0xb + _REG_RAX = 0xe + _REG_GS = 0x17 + _REG_FS = 0x16 + _REG_ES = 0x18 + _REG_DS = 0x19 + _REG_TRAPNO = 0xf + _REG_ERR = 0x10 + _REG_RIP = 0x11 + _REG_CS = 0x12 + _REG_RFLAGS = 0x13 + _REG_RSP = 0x14 + _REG_SS = 0x15 +) diff --git a/hack/go1_7_3/runtime/defs_darwin_386.go b/hack/go1_7_3/runtime/defs_darwin_386.go new file mode 100644 index 0000000..4387a6d --- /dev/null +++ b/hack/go1_7_3/runtime/defs_darwin_386.go @@ -0,0 +1,384 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_darwin.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_FREE = 0x5 + + _MACH_MSG_TYPE_MOVE_RECEIVE = 0x10 + _MACH_MSG_TYPE_MOVE_SEND = 0x11 + _MACH_MSG_TYPE_MOVE_SEND_ONCE = 0x12 + _MACH_MSG_TYPE_COPY_SEND = 0x13 + _MACH_MSG_TYPE_MAKE_SEND = 0x14 + _MACH_MSG_TYPE_MAKE_SEND_ONCE = 0x15 + _MACH_MSG_TYPE_COPY_RECEIVE = 0x16 + + _MACH_MSG_PORT_DESCRIPTOR = 0x0 + _MACH_MSG_OOL_DESCRIPTOR = 0x1 + _MACH_MSG_OOL_PORTS_DESCRIPTOR = 0x2 + _MACH_MSG_OOL_VOLATILE_DESCRIPTOR = 0x3 + + _MACH_MSGH_BITS_COMPLEX = 0x80000000 + + _MACH_SEND_MSG = 0x1 + _MACH_RCV_MSG = 0x2 + _MACH_RCV_LARGE = 0x4 + + _MACH_SEND_TIMEOUT = 0x10 + _MACH_SEND_INTERRUPT = 0x40 + _MACH_SEND_ALWAYS = 0x10000 + _MACH_SEND_TRAILER = 0x20000 + _MACH_RCV_TIMEOUT = 0x100 + _MACH_RCV_NOTIFY = 0x200 + _MACH_RCV_INTERRUPT = 0x400 + _MACH_RCV_OVERWRITE = 0x1000 + + _NDR_PROTOCOL_2_0 = 0x0 + _NDR_INT_BIG_ENDIAN = 0x0 + _NDR_INT_LITTLE_ENDIAN = 0x1 + _NDR_FLOAT_IEEE = 0x0 + _NDR_CHAR_ASCII = 0x0 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + _SA_USERTRAMP = 0x100 + _SA_64REGSET = 0x200 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x7 + _FPE_INTOVF = 0x8 + _FPE_FLTDIV = 0x1 + _FPE_FLTOVF = 0x2 + _FPE_FLTUND = 0x3 + _FPE_FLTRES = 0x4 + _FPE_FLTINV = 0x5 + _FPE_FLTSUB = 0x6 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0x40 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type machbody struct { + msgh_descriptor_count uint32 +} + +type machheader struct { + msgh_bits uint32 + msgh_size uint32 + msgh_remote_port uint32 + msgh_local_port uint32 + msgh_reserved uint32 + msgh_id int32 +} + +type machndr struct { + mig_vers uint8 + if_vers uint8 + reserved1 uint8 + mig_encoding uint8 + int_rep uint8 + char_rep uint8 + float_rep uint8 + reserved2 uint8 +} + +type machport struct { + name uint32 + pad1 uint32 + pad2 uint16 + disposition uint8 + _type uint8 +} + +type stackt struct { + ss_sp *byte + ss_size uintptr + ss_flags int32 +} + +type sigactiont struct { + __sigaction_u [4]byte + sa_tramp unsafe.Pointer + sa_mask uint32 + sa_flags int32 +} + +type usigactiont struct { + __sigaction_u [4]byte + sa_mask uint32 + sa_flags int32 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr uint32 + si_value [4]byte + si_band int32 + __pad [7]uint32 +} + +type timeval struct { + tv_sec int32 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type timespec struct { + tv_sec int32 + tv_nsec int32 +} + +type fpcontrol struct { + pad_cgo_0 [2]byte +} + +type fpstatus struct { + pad_cgo_0 [2]byte +} + +type regmmst struct { + mmst_reg [10]int8 + mmst_rsrv [6]int8 +} + +type regxmm struct { + xmm_reg [16]int8 +} + +type regs64 struct { + rax uint64 + rbx uint64 + rcx uint64 + rdx uint64 + rdi uint64 + rsi uint64 + rbp uint64 + rsp uint64 + r8 uint64 + r9 uint64 + r10 uint64 + r11 uint64 + r12 uint64 + r13 uint64 + r14 uint64 + r15 uint64 + rip uint64 + rflags uint64 + cs uint64 + fs uint64 + gs uint64 +} + +type floatstate64 struct { + fpu_reserved [2]int32 + fpu_fcw fpcontrol + fpu_fsw fpstatus + fpu_ftw uint8 + fpu_rsrv1 uint8 + fpu_fop uint16 + fpu_ip uint32 + fpu_cs uint16 + fpu_rsrv2 uint16 + fpu_dp uint32 + fpu_ds uint16 + fpu_rsrv3 uint16 + fpu_mxcsr uint32 + fpu_mxcsrmask uint32 + fpu_stmm0 regmmst + fpu_stmm1 regmmst + fpu_stmm2 regmmst + fpu_stmm3 regmmst + fpu_stmm4 regmmst + fpu_stmm5 regmmst + fpu_stmm6 regmmst + fpu_stmm7 regmmst + fpu_xmm0 regxmm + fpu_xmm1 regxmm + fpu_xmm2 regxmm + fpu_xmm3 regxmm + fpu_xmm4 regxmm + fpu_xmm5 regxmm + fpu_xmm6 regxmm + fpu_xmm7 regxmm + fpu_xmm8 regxmm + fpu_xmm9 regxmm + fpu_xmm10 regxmm + fpu_xmm11 regxmm + fpu_xmm12 regxmm + fpu_xmm13 regxmm + fpu_xmm14 regxmm + fpu_xmm15 regxmm + fpu_rsrv4 [96]int8 + fpu_reserved1 int32 +} + +type exceptionstate64 struct { + trapno uint16 + cpu uint16 + err uint32 + faultvaddr uint64 +} + +type mcontext64 struct { + es exceptionstate64 + ss regs64 + fs floatstate64 +} + +type regs32 struct { + eax uint32 + ebx uint32 + ecx uint32 + edx uint32 + edi uint32 + esi uint32 + ebp uint32 + esp uint32 + ss uint32 + eflags uint32 + eip uint32 + cs uint32 + ds uint32 + es uint32 + fs uint32 + gs uint32 +} + +type floatstate32 struct { + fpu_reserved [2]int32 + fpu_fcw fpcontrol + fpu_fsw fpstatus + fpu_ftw uint8 + fpu_rsrv1 uint8 + fpu_fop uint16 + fpu_ip uint32 + fpu_cs uint16 + fpu_rsrv2 uint16 + fpu_dp uint32 + fpu_ds uint16 + fpu_rsrv3 uint16 + fpu_mxcsr uint32 + fpu_mxcsrmask uint32 + fpu_stmm0 regmmst + fpu_stmm1 regmmst + fpu_stmm2 regmmst + fpu_stmm3 regmmst + fpu_stmm4 regmmst + fpu_stmm5 regmmst + fpu_stmm6 regmmst + fpu_stmm7 regmmst + fpu_xmm0 regxmm + fpu_xmm1 regxmm + fpu_xmm2 regxmm + fpu_xmm3 regxmm + fpu_xmm4 regxmm + fpu_xmm5 regxmm + fpu_xmm6 regxmm + fpu_xmm7 regxmm + fpu_rsrv4 [224]int8 + fpu_reserved1 int32 +} + +type exceptionstate32 struct { + trapno uint16 + cpu uint16 + err uint32 + faultvaddr uint32 +} + +type mcontext32 struct { + es exceptionstate32 + ss regs32 + fs floatstate32 +} + +type ucontext struct { + uc_onstack int32 + uc_sigmask uint32 + uc_stack stackt + uc_link *ucontext + uc_mcsize uint32 + uc_mcontext *mcontext32 +} + +type keventt struct { + ident uint32 + filter int16 + flags uint16 + fflags uint32 + data int32 + udata *byte +} diff --git a/hack/go1_7_3/runtime/defs_darwin_amd64.go b/hack/go1_7_3/runtime/defs_darwin_amd64.go new file mode 100644 index 0000000..519a1ae --- /dev/null +++ b/hack/go1_7_3/runtime/defs_darwin_amd64.go @@ -0,0 +1,387 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_darwin.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_FREE = 0x5 + + _MACH_MSG_TYPE_MOVE_RECEIVE = 0x10 + _MACH_MSG_TYPE_MOVE_SEND = 0x11 + _MACH_MSG_TYPE_MOVE_SEND_ONCE = 0x12 + _MACH_MSG_TYPE_COPY_SEND = 0x13 + _MACH_MSG_TYPE_MAKE_SEND = 0x14 + _MACH_MSG_TYPE_MAKE_SEND_ONCE = 0x15 + _MACH_MSG_TYPE_COPY_RECEIVE = 0x16 + + _MACH_MSG_PORT_DESCRIPTOR = 0x0 + _MACH_MSG_OOL_DESCRIPTOR = 0x1 + _MACH_MSG_OOL_PORTS_DESCRIPTOR = 0x2 + _MACH_MSG_OOL_VOLATILE_DESCRIPTOR = 0x3 + + _MACH_MSGH_BITS_COMPLEX = 0x80000000 + + _MACH_SEND_MSG = 0x1 + _MACH_RCV_MSG = 0x2 + _MACH_RCV_LARGE = 0x4 + + _MACH_SEND_TIMEOUT = 0x10 + _MACH_SEND_INTERRUPT = 0x40 + _MACH_SEND_ALWAYS = 0x10000 + _MACH_SEND_TRAILER = 0x20000 + _MACH_RCV_TIMEOUT = 0x100 + _MACH_RCV_NOTIFY = 0x200 + _MACH_RCV_INTERRUPT = 0x400 + _MACH_RCV_OVERWRITE = 0x1000 + + _NDR_PROTOCOL_2_0 = 0x0 + _NDR_INT_BIG_ENDIAN = 0x0 + _NDR_INT_LITTLE_ENDIAN = 0x1 + _NDR_FLOAT_IEEE = 0x0 + _NDR_CHAR_ASCII = 0x0 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + _SA_USERTRAMP = 0x100 + _SA_64REGSET = 0x200 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x7 + _FPE_INTOVF = 0x8 + _FPE_FLTDIV = 0x1 + _FPE_FLTOVF = 0x2 + _FPE_FLTUND = 0x3 + _FPE_FLTRES = 0x4 + _FPE_FLTINV = 0x5 + _FPE_FLTSUB = 0x6 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0x40 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type machbody struct { + msgh_descriptor_count uint32 +} + +type machheader struct { + msgh_bits uint32 + msgh_size uint32 + msgh_remote_port uint32 + msgh_local_port uint32 + msgh_reserved uint32 + msgh_id int32 +} + +type machndr struct { + mig_vers uint8 + if_vers uint8 + reserved1 uint8 + mig_encoding uint8 + int_rep uint8 + char_rep uint8 + float_rep uint8 + reserved2 uint8 +} + +type machport struct { + name uint32 + pad1 uint32 + pad2 uint16 + disposition uint8 + _type uint8 +} + +type stackt struct { + ss_sp *byte + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type sigactiont struct { + __sigaction_u [8]byte + sa_tramp unsafe.Pointer + sa_mask uint32 + sa_flags int32 +} + +type usigactiont struct { + __sigaction_u [8]byte + sa_mask uint32 + sa_flags int32 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr uint64 + si_value [8]byte + si_band int64 + __pad [7]uint64 +} + +type timeval struct { + tv_sec int64 + tv_usec int32 + pad_cgo_0 [4]byte +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type fpcontrol struct { + pad_cgo_0 [2]byte +} + +type fpstatus struct { + pad_cgo_0 [2]byte +} + +type regmmst struct { + mmst_reg [10]int8 + mmst_rsrv [6]int8 +} + +type regxmm struct { + xmm_reg [16]int8 +} + +type regs64 struct { + rax uint64 + rbx uint64 + rcx uint64 + rdx uint64 + rdi uint64 + rsi uint64 + rbp uint64 + rsp uint64 + r8 uint64 + r9 uint64 + r10 uint64 + r11 uint64 + r12 uint64 + r13 uint64 + r14 uint64 + r15 uint64 + rip uint64 + rflags uint64 + cs uint64 + fs uint64 + gs uint64 +} + +type floatstate64 struct { + fpu_reserved [2]int32 + fpu_fcw fpcontrol + fpu_fsw fpstatus + fpu_ftw uint8 + fpu_rsrv1 uint8 + fpu_fop uint16 + fpu_ip uint32 + fpu_cs uint16 + fpu_rsrv2 uint16 + fpu_dp uint32 + fpu_ds uint16 + fpu_rsrv3 uint16 + fpu_mxcsr uint32 + fpu_mxcsrmask uint32 + fpu_stmm0 regmmst + fpu_stmm1 regmmst + fpu_stmm2 regmmst + fpu_stmm3 regmmst + fpu_stmm4 regmmst + fpu_stmm5 regmmst + fpu_stmm6 regmmst + fpu_stmm7 regmmst + fpu_xmm0 regxmm + fpu_xmm1 regxmm + fpu_xmm2 regxmm + fpu_xmm3 regxmm + fpu_xmm4 regxmm + fpu_xmm5 regxmm + fpu_xmm6 regxmm + fpu_xmm7 regxmm + fpu_xmm8 regxmm + fpu_xmm9 regxmm + fpu_xmm10 regxmm + fpu_xmm11 regxmm + fpu_xmm12 regxmm + fpu_xmm13 regxmm + fpu_xmm14 regxmm + fpu_xmm15 regxmm + fpu_rsrv4 [96]int8 + fpu_reserved1 int32 +} + +type exceptionstate64 struct { + trapno uint16 + cpu uint16 + err uint32 + faultvaddr uint64 +} + +type mcontext64 struct { + es exceptionstate64 + ss regs64 + fs floatstate64 + pad_cgo_0 [4]byte +} + +type regs32 struct { + eax uint32 + ebx uint32 + ecx uint32 + edx uint32 + edi uint32 + esi uint32 + ebp uint32 + esp uint32 + ss uint32 + eflags uint32 + eip uint32 + cs uint32 + ds uint32 + es uint32 + fs uint32 + gs uint32 +} + +type floatstate32 struct { + fpu_reserved [2]int32 + fpu_fcw fpcontrol + fpu_fsw fpstatus + fpu_ftw uint8 + fpu_rsrv1 uint8 + fpu_fop uint16 + fpu_ip uint32 + fpu_cs uint16 + fpu_rsrv2 uint16 + fpu_dp uint32 + fpu_ds uint16 + fpu_rsrv3 uint16 + fpu_mxcsr uint32 + fpu_mxcsrmask uint32 + fpu_stmm0 regmmst + fpu_stmm1 regmmst + fpu_stmm2 regmmst + fpu_stmm3 regmmst + fpu_stmm4 regmmst + fpu_stmm5 regmmst + fpu_stmm6 regmmst + fpu_stmm7 regmmst + fpu_xmm0 regxmm + fpu_xmm1 regxmm + fpu_xmm2 regxmm + fpu_xmm3 regxmm + fpu_xmm4 regxmm + fpu_xmm5 regxmm + fpu_xmm6 regxmm + fpu_xmm7 regxmm + fpu_rsrv4 [224]int8 + fpu_reserved1 int32 +} + +type exceptionstate32 struct { + trapno uint16 + cpu uint16 + err uint32 + faultvaddr uint32 +} + +type mcontext32 struct { + es exceptionstate32 + ss regs32 + fs floatstate32 +} + +type ucontext struct { + uc_onstack int32 + uc_sigmask uint32 + uc_stack stackt + uc_link *ucontext + uc_mcsize uint64 + uc_mcontext *mcontext64 +} + +type keventt struct { + ident uint64 + filter int16 + flags uint16 + fflags uint32 + data int64 + udata *byte +} diff --git a/hack/go1_7_3/runtime/defs_darwin_arm.go b/hack/go1_7_3/runtime/defs_darwin_arm.go new file mode 100644 index 0000000..2c9f638 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_darwin_arm.go @@ -0,0 +1,247 @@ +// Note: cgo can't handle some Darwin/ARM structures, so this file can't +// be auto generated by cgo yet. +// Created based on output of `cgo -cdefs defs_darwin.go` and Darwin/ARM +// specific header (mainly mcontext and ucontext related stuff) + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_FREE = 0x5 + + _MACH_MSG_TYPE_MOVE_RECEIVE = 0x10 + _MACH_MSG_TYPE_MOVE_SEND = 0x11 + _MACH_MSG_TYPE_MOVE_SEND_ONCE = 0x12 + _MACH_MSG_TYPE_COPY_SEND = 0x13 + _MACH_MSG_TYPE_MAKE_SEND = 0x14 + _MACH_MSG_TYPE_MAKE_SEND_ONCE = 0x15 + _MACH_MSG_TYPE_COPY_RECEIVE = 0x16 + + _MACH_MSG_PORT_DESCRIPTOR = 0x0 + _MACH_MSG_OOL_DESCRIPTOR = 0x1 + _MACH_MSG_OOL_PORTS_DESCRIPTOR = 0x2 + _MACH_MSG_OOL_VOLATILE_DESCRIPTOR = 0x3 + + _MACH_MSGH_BITS_COMPLEX = 0x80000000 + + _MACH_SEND_MSG = 0x1 + _MACH_RCV_MSG = 0x2 + _MACH_RCV_LARGE = 0x4 + + _MACH_SEND_TIMEOUT = 0x10 + _MACH_SEND_INTERRUPT = 0x40 + _MACH_SEND_ALWAYS = 0x10000 + _MACH_SEND_TRAILER = 0x20000 + _MACH_RCV_TIMEOUT = 0x100 + _MACH_RCV_NOTIFY = 0x200 + _MACH_RCV_INTERRUPT = 0x400 + _MACH_RCV_OVERWRITE = 0x1000 + + _NDR_PROTOCOL_2_0 = 0x0 + _NDR_INT_BIG_ENDIAN = 0x0 + _NDR_INT_LITTLE_ENDIAN = 0x1 + _NDR_FLOAT_IEEE = 0x0 + _NDR_CHAR_ASCII = 0x0 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + _SA_USERTRAMP = 0x100 + _SA_64REGSET = 0x200 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x7 + _FPE_INTOVF = 0x8 + _FPE_FLTDIV = 0x1 + _FPE_FLTOVF = 0x2 + _FPE_FLTUND = 0x3 + _FPE_FLTRES = 0x4 + _FPE_FLTINV = 0x5 + _FPE_FLTSUB = 0x6 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0x40 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type machbody struct { + msgh_descriptor_count uint32 +} + +type machheader struct { + msgh_bits uint32 + msgh_size uint32 + msgh_remote_port uint32 + msgh_local_port uint32 + msgh_reserved uint32 + msgh_id int32 +} + +type machndr struct { + mig_vers uint8 + if_vers uint8 + reserved1 uint8 + mig_encoding uint8 + int_rep uint8 + char_rep uint8 + float_rep uint8 + reserved2 uint8 +} + +type machport struct { + name uint32 + pad1 uint32 + pad2 uint16 + disposition uint8 + _type uint8 +} + +type stackt struct { + ss_sp *byte + ss_size uintptr + ss_flags int32 +} + +type sigactiont struct { + __sigaction_u [4]byte + sa_tramp unsafe.Pointer + sa_mask uint32 + sa_flags int32 +} + +type usigactiont struct { + __sigaction_u [4]byte + sa_mask uint32 + sa_flags int32 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr uint32 + si_value [4]byte + si_band int32 + __pad [7]uint32 +} + +type timeval struct { + tv_sec int32 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type timespec struct { + tv_sec int32 + tv_nsec int32 +} + +type floatstate32 struct { + r [32]uint32 + fpscr uint32 +} + +type regs32 struct { + r [13]uint32 + sp uint32 + lr uint32 + pc uint32 + cpsr uint32 +} + +type exceptionstate32 struct { + trapno uint32 + err uint32 + faultvaddr uint32 +} + +type mcontext32 struct { + es exceptionstate32 + ss regs32 + fs floatstate32 +} + +type ucontext struct { + uc_onstack int32 + uc_sigmask uint32 + uc_stack stackt + uc_link *ucontext + uc_mcsize uint32 + uc_mcontext *mcontext32 +} + +type keventt struct { + ident uint32 + filter int16 + flags uint16 + fflags uint32 + data int32 + udata *byte +} diff --git a/hack/go1_7_3/runtime/defs_darwin_arm64.go b/hack/go1_7_3/runtime/defs_darwin_arm64.go new file mode 100644 index 0000000..58472ff --- /dev/null +++ b/hack/go1_7_3/runtime/defs_darwin_arm64.go @@ -0,0 +1,250 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_darwin.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_FREE = 0x5 + + _MACH_MSG_TYPE_MOVE_RECEIVE = 0x10 + _MACH_MSG_TYPE_MOVE_SEND = 0x11 + _MACH_MSG_TYPE_MOVE_SEND_ONCE = 0x12 + _MACH_MSG_TYPE_COPY_SEND = 0x13 + _MACH_MSG_TYPE_MAKE_SEND = 0x14 + _MACH_MSG_TYPE_MAKE_SEND_ONCE = 0x15 + _MACH_MSG_TYPE_COPY_RECEIVE = 0x16 + + _MACH_MSG_PORT_DESCRIPTOR = 0x0 + _MACH_MSG_OOL_DESCRIPTOR = 0x1 + _MACH_MSG_OOL_PORTS_DESCRIPTOR = 0x2 + _MACH_MSG_OOL_VOLATILE_DESCRIPTOR = 0x3 + + _MACH_MSGH_BITS_COMPLEX = 0x80000000 + + _MACH_SEND_MSG = 0x1 + _MACH_RCV_MSG = 0x2 + _MACH_RCV_LARGE = 0x4 + + _MACH_SEND_TIMEOUT = 0x10 + _MACH_SEND_INTERRUPT = 0x40 + _MACH_SEND_ALWAYS = 0x10000 + _MACH_SEND_TRAILER = 0x20000 + _MACH_RCV_TIMEOUT = 0x100 + _MACH_RCV_NOTIFY = 0x200 + _MACH_RCV_INTERRUPT = 0x400 + _MACH_RCV_OVERWRITE = 0x1000 + + _NDR_PROTOCOL_2_0 = 0x0 + _NDR_INT_BIG_ENDIAN = 0x0 + _NDR_INT_LITTLE_ENDIAN = 0x1 + _NDR_FLOAT_IEEE = 0x0 + _NDR_CHAR_ASCII = 0x0 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + _SA_USERTRAMP = 0x100 + _SA_64REGSET = 0x200 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x7 + _FPE_INTOVF = 0x8 + _FPE_FLTDIV = 0x1 + _FPE_FLTOVF = 0x2 + _FPE_FLTUND = 0x3 + _FPE_FLTRES = 0x4 + _FPE_FLTINV = 0x5 + _FPE_FLTSUB = 0x6 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0x40 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type machbody struct { + msgh_descriptor_count uint32 +} + +type machheader struct { + msgh_bits uint32 + msgh_size uint32 + msgh_remote_port uint32 + msgh_local_port uint32 + msgh_reserved uint32 + msgh_id int32 +} + +type machndr struct { + mig_vers uint8 + if_vers uint8 + reserved1 uint8 + mig_encoding uint8 + int_rep uint8 + char_rep uint8 + float_rep uint8 + reserved2 uint8 +} + +type machport struct { + name uint32 + pad1 uint32 + pad2 uint16 + disposition uint8 + _type uint8 +} + +type stackt struct { + ss_sp *byte + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type sigactiont struct { + __sigaction_u [8]byte + sa_tramp unsafe.Pointer + sa_mask uint32 + sa_flags int32 +} + +type usigactiont struct { + __sigaction_u [8]byte + sa_mask uint32 + sa_flags int32 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr *byte + si_value [8]byte + si_band int64 + __pad [7]uint64 +} + +type timeval struct { + tv_sec int64 + tv_usec int32 + pad_cgo_0 [4]byte +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type exceptionstate64 struct { + far uint64 + esr uint32 + exc uint32 +} + +type regs64 struct { + x [29]uint64 + fp uint64 + lr uint64 + sp uint64 + pc uint64 + cpsr uint32 + __pad uint32 +} + +type neonstate64 struct { + v [64]uint64 + fpsr uint32 + fpcr uint32 +} + +type mcontext64 struct { + es exceptionstate64 + ss regs64 + ns neonstate64 +} + +type ucontext struct { + uc_onstack int32 + uc_sigmask uint32 + uc_stack stackt + uc_link *ucontext + uc_mcsize uint64 + uc_mcontext *mcontext64 +} + +type keventt struct { + ident uint64 + filter int16 + flags uint16 + fflags uint32 + data int64 + udata *byte +} diff --git a/hack/go1_7_3/runtime/defs_dragonfly_amd64.go b/hack/go1_7_3/runtime/defs_dragonfly_amd64.go new file mode 100644 index 0000000..850a1a9 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_dragonfly_amd64.go @@ -0,0 +1,200 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_dragonfly.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + _EBUSY = 0x10 + _EAGAIN = 0x23 + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x5 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x2 + _FPE_INTOVF = 0x1 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type rtprio struct { + _type uint16 + prio uint16 +} + +type lwpparams struct { + start_func uintptr + arg unsafe.Pointer + stack uintptr + tid1 unsafe.Pointer + tid2 unsafe.Pointer +} + +type sigaltstackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type sigset struct { + __bits [4]uint32 +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr uint64 + si_value [8]byte + si_band int64 + __spare__ [7]int32 + pad_cgo_0 [4]byte +} + +type mcontext struct { + mc_onstack uint64 + mc_rdi uint64 + mc_rsi uint64 + mc_rdx uint64 + mc_rcx uint64 + mc_r8 uint64 + mc_r9 uint64 + mc_rax uint64 + mc_rbx uint64 + mc_rbp uint64 + mc_r10 uint64 + mc_r11 uint64 + mc_r12 uint64 + mc_r13 uint64 + mc_r14 uint64 + mc_r15 uint64 + mc_xflags uint64 + mc_trapno uint64 + mc_addr uint64 + mc_flags uint64 + mc_err uint64 + mc_rip uint64 + mc_cs uint64 + mc_rflags uint64 + mc_rsp uint64 + mc_ss uint64 + mc_len uint32 + mc_fpformat uint32 + mc_ownedfp uint32 + mc_reserved uint32 + mc_unused [8]uint32 + mc_fpregs [256]int32 +} + +type ucontext struct { + uc_sigmask sigset + pad_cgo_0 [48]byte + uc_mcontext mcontext + uc_link *ucontext + uc_stack stackt + __spare__ [8]int32 +} + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type keventt struct { + ident uint64 + filter int16 + flags uint16 + fflags uint32 + data int64 + udata *byte +} diff --git a/hack/go1_7_3/runtime/defs_freebsd_386.go b/hack/go1_7_3/runtime/defs_freebsd_386.go new file mode 100644 index 0000000..385bb08 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_freebsd_386.go @@ -0,0 +1,213 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_freebsd.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x5 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _CLOCK_MONOTONIC = 0x4 + + _UMTX_OP_WAIT_UINT = 0xb + _UMTX_OP_WAIT_UINT_PRIVATE = 0xf + _UMTX_OP_WAKE = 0x3 + _UMTX_OP_WAKE_PRIVATE = 0x10 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x2 + _FPE_INTOVF = 0x1 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0x40 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type rtprio struct { + _type uint16 + prio uint16 +} + +type thrparam struct { + start_func uintptr + arg unsafe.Pointer + stack_base uintptr + stack_size uintptr + tls_base unsafe.Pointer + tls_size uintptr + child_tid unsafe.Pointer + parent_tid *int32 + flags int32 + rtp *rtprio + spare [3]uintptr +} + +type sigaltstackt struct { + ss_sp *int8 + ss_size uint32 + ss_flags int32 +} + +type sigset struct { + __bits [4]uint32 +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr uintptr + si_value [4]byte + _reason [32]byte +} + +type mcontext struct { + mc_onstack uint32 + mc_gs uint32 + mc_fs uint32 + mc_es uint32 + mc_ds uint32 + mc_edi uint32 + mc_esi uint32 + mc_ebp uint32 + mc_isp uint32 + mc_ebx uint32 + mc_edx uint32 + mc_ecx uint32 + mc_eax uint32 + mc_trapno uint32 + mc_err uint32 + mc_eip uint32 + mc_cs uint32 + mc_eflags uint32 + mc_esp uint32 + mc_ss uint32 + mc_len uint32 + mc_fpformat uint32 + mc_ownedfp uint32 + mc_flags uint32 + mc_fpstate [128]uint32 + mc_fsbase uint32 + mc_gsbase uint32 + mc_xfpustate uint32 + mc_xfpustate_len uint32 + mc_spare2 [4]uint32 +} + +type ucontext struct { + uc_sigmask sigset + uc_mcontext mcontext + uc_link *ucontext + uc_stack stackt + uc_flags int32 + __spare__ [4]int32 + pad_cgo_0 [12]byte +} + +type timespec struct { + tv_sec int32 + tv_nsec int32 +} + +type timeval struct { + tv_sec int32 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type umtx_time struct { + _timeout timespec + _flags uint32 + _clockid uint32 +} + +type keventt struct { + ident uint32 + filter int16 + flags uint16 + fflags uint32 + data int32 + udata *byte +} diff --git a/hack/go1_7_3/runtime/defs_freebsd_amd64.go b/hack/go1_7_3/runtime/defs_freebsd_amd64.go new file mode 100644 index 0000000..cb0484d --- /dev/null +++ b/hack/go1_7_3/runtime/defs_freebsd_amd64.go @@ -0,0 +1,224 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_freebsd.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x5 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _CLOCK_MONOTONIC = 0x4 + + _UMTX_OP_WAIT_UINT = 0xb + _UMTX_OP_WAIT_UINT_PRIVATE = 0xf + _UMTX_OP_WAKE = 0x3 + _UMTX_OP_WAKE_PRIVATE = 0x10 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x2 + _FPE_INTOVF = 0x1 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0x40 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type rtprio struct { + _type uint16 + prio uint16 +} + +type thrparam struct { + start_func uintptr + arg unsafe.Pointer + stack_base uintptr + stack_size uintptr + tls_base unsafe.Pointer + tls_size uintptr + child_tid unsafe.Pointer + parent_tid *int64 + flags int32 + pad_cgo_0 [4]byte + rtp *rtprio + spare [3]uintptr +} + +type sigaltstackt struct { + ss_sp *int8 + ss_size uint64 + ss_flags int32 + pad_cgo_0 [4]byte +} + +type sigset struct { + __bits [4]uint32 +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr uint64 + si_value [8]byte + _reason [40]byte +} + +type mcontext struct { + mc_onstack uint64 + mc_rdi uint64 + mc_rsi uint64 + mc_rdx uint64 + mc_rcx uint64 + mc_r8 uint64 + mc_r9 uint64 + mc_rax uint64 + mc_rbx uint64 + mc_rbp uint64 + mc_r10 uint64 + mc_r11 uint64 + mc_r12 uint64 + mc_r13 uint64 + mc_r14 uint64 + mc_r15 uint64 + mc_trapno uint32 + mc_fs uint16 + mc_gs uint16 + mc_addr uint64 + mc_flags uint32 + mc_es uint16 + mc_ds uint16 + mc_err uint64 + mc_rip uint64 + mc_cs uint64 + mc_rflags uint64 + mc_rsp uint64 + mc_ss uint64 + mc_len uint64 + mc_fpformat uint64 + mc_ownedfp uint64 + mc_fpstate [64]uint64 + mc_fsbase uint64 + mc_gsbase uint64 + mc_xfpustate uint64 + mc_xfpustate_len uint64 + mc_spare [4]uint64 +} + +type ucontext struct { + uc_sigmask sigset + uc_mcontext mcontext + uc_link *ucontext + uc_stack stackt + uc_flags int32 + __spare__ [4]int32 + pad_cgo_0 [12]byte +} + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type umtx_time struct { + _timeout timespec + _flags uint32 + _clockid uint32 +} + +type keventt struct { + ident uint64 + filter int16 + flags uint16 + fflags uint32 + data int64 + udata *byte +} diff --git a/hack/go1_7_3/runtime/defs_freebsd_arm.go b/hack/go1_7_3/runtime/defs_freebsd_arm.go new file mode 100644 index 0000000..ea2551e --- /dev/null +++ b/hack/go1_7_3/runtime/defs_freebsd_arm.go @@ -0,0 +1,186 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_freebsd.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x5 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _CLOCK_MONOTONIC = 0x4 + + _UMTX_OP_WAIT_UINT = 0xb + _UMTX_OP_WAIT_UINT_PRIVATE = 0xf + _UMTX_OP_WAKE = 0x3 + _UMTX_OP_WAKE_PRIVATE = 0x10 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x2 + _FPE_INTOVF = 0x1 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_RECEIPT = 0x40 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type rtprio struct { + _type uint16 + prio uint16 +} + +type thrparam struct { + start_func uintptr + arg unsafe.Pointer + stack_base uintptr + stack_size uintptr + tls_base unsafe.Pointer + tls_size uintptr + child_tid unsafe.Pointer + parent_tid *int32 + flags int32 + rtp *rtprio + spare [3]uintptr +} + +type sigaltstackt struct { + ss_sp *uint8 + ss_size uint32 + ss_flags int32 +} + +type sigset struct { + __bits [4]uint32 +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + si_pid int32 + si_uid uint32 + si_status int32 + si_addr uintptr + si_value [4]byte + _reason [32]byte +} + +type mcontext struct { + __gregs [17]uint32 + __fpu [140]byte +} + +type ucontext struct { + uc_sigmask sigset + uc_mcontext mcontext + uc_link *ucontext + uc_stack stackt + uc_flags int32 + __spare__ [4]int32 +} + +type timespec struct { + tv_sec int64 + tv_nsec int32 + pad_cgo_0 [4]byte +} + +type timeval struct { + tv_sec int64 + tv_usec int32 + pad_cgo_0 [4]byte +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type umtx_time struct { + _timeout timespec + _flags uint32 + _clockid uint32 +} + +type keventt struct { + ident uint32 + filter int16 + flags uint16 + fflags uint32 + data int32 + udata *byte +} diff --git a/hack/go1_7_3/runtime/defs_linux_386.go b/hack/go1_7_3/runtime/defs_linux_386.go new file mode 100644 index 0000000..43f6d52 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_linux_386.go @@ -0,0 +1,217 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs2_linux.go + +package runtime + +const ( + _EINTR = 0x4 + _EAGAIN = 0xb + _ENOMEM = 0xc + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x20 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_RESTORER = 0x4000000 + _SA_SIGINFO = 0x4 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _O_RDONLY = 0x0 + _O_CLOEXEC = 0x80000 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 + + _AF_UNIX = 0x1 + _F_SETFL = 0x4 + _SOCK_DGRAM = 0x2 +) + +type fpreg struct { + significand [4]uint16 + exponent uint16 +} + +type fpxreg struct { + significand [4]uint16 + exponent uint16 + padding [3]uint16 +} + +type xmmreg struct { + element [4]uint32 +} + +type fpstate struct { + cw uint32 + sw uint32 + tag uint32 + ipoff uint32 + cssel uint32 + dataoff uint32 + datasel uint32 + _st [8]fpreg + status uint16 + magic uint16 + _fxsr_env [6]uint32 + mxcsr uint32 + reserved uint32 + _fxsr_st [8]fpxreg + _xmm [8]xmmreg + padding1 [44]uint32 + anon0 [48]byte +} + +type timespec struct { + tv_sec int32 + tv_nsec int32 +} + +type timeval struct { + tv_sec int32 + tv_usec int32 +} + +type sigactiont struct { + sa_handler uintptr + sa_flags uint32 + sa_restorer uintptr + sa_mask uint64 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + + si_addr uint32 +} + +type sigaltstackt struct { + ss_sp *byte + ss_flags int32 + ss_size uintptr +} + +type sigcontext struct { + gs uint16 + __gsh uint16 + fs uint16 + __fsh uint16 + es uint16 + __esh uint16 + ds uint16 + __dsh uint16 + edi uint32 + esi uint32 + ebp uint32 + esp uint32 + ebx uint32 + edx uint32 + ecx uint32 + eax uint32 + trapno uint32 + err uint32 + eip uint32 + cs uint16 + __csh uint16 + eflags uint32 + esp_at_signal uint32 + ss uint16 + __ssh uint16 + fpstate *fpstate + oldmask uint32 + cr2 uint32 +} + +type ucontext struct { + uc_flags uint32 + uc_link *ucontext + uc_stack sigaltstackt + uc_mcontext sigcontext + uc_sigmask uint32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type epollevent struct { + events uint32 + data [8]byte +} + +type sockaddr_un struct { + family uint16 + path [108]byte +} diff --git a/hack/go1_7_3/runtime/defs_linux_amd64.go b/hack/go1_7_3/runtime/defs_linux_amd64.go new file mode 100644 index 0000000..2d7742c --- /dev/null +++ b/hack/go1_7_3/runtime/defs_linux_amd64.go @@ -0,0 +1,249 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_linux.go defs1_linux.go + +package runtime + +const ( + _EINTR = 0x4 + _EAGAIN = 0xb + _ENOMEM = 0xc + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x20 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_RESTORER = 0x4000000 + _SA_SIGINFO = 0x4 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 + + _AF_UNIX = 0x1 + _F_SETFL = 0x4 + _SOCK_DGRAM = 0x2 +) + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type sigactiont struct { + sa_handler uintptr + sa_flags uint64 + sa_restorer uintptr + sa_mask uint64 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + + si_addr uint64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type epollevent struct { + events uint32 + data [8]byte +} + +const ( + _O_RDONLY = 0x0 + _O_CLOEXEC = 0x80000 +) + +type usigset struct { + __val [16]uint64 +} + +type fpxreg struct { + significand [4]uint16 + exponent uint16 + padding [3]uint16 +} + +type xmmreg struct { + element [4]uint32 +} + +type fpstate struct { + cwd uint16 + swd uint16 + ftw uint16 + fop uint16 + rip uint64 + rdp uint64 + mxcsr uint32 + mxcr_mask uint32 + _st [8]fpxreg + _xmm [16]xmmreg + padding [24]uint32 +} + +type fpxreg1 struct { + significand [4]uint16 + exponent uint16 + padding [3]uint16 +} + +type xmmreg1 struct { + element [4]uint32 +} + +type fpstate1 struct { + cwd uint16 + swd uint16 + ftw uint16 + fop uint16 + rip uint64 + rdp uint64 + mxcsr uint32 + mxcr_mask uint32 + _st [8]fpxreg1 + _xmm [16]xmmreg1 + padding [24]uint32 +} + +type fpreg1 struct { + significand [4]uint16 + exponent uint16 +} + +type sigaltstackt struct { + ss_sp *byte + ss_flags int32 + pad_cgo_0 [4]byte + ss_size uintptr +} + +type mcontext struct { + gregs [23]uint64 + fpregs *fpstate + __reserved1 [8]uint64 +} + +type ucontext struct { + uc_flags uint64 + uc_link *ucontext + uc_stack sigaltstackt + uc_mcontext mcontext + uc_sigmask usigset + __fpregs_mem fpstate +} + +type sigcontext struct { + r8 uint64 + r9 uint64 + r10 uint64 + r11 uint64 + r12 uint64 + r13 uint64 + r14 uint64 + r15 uint64 + rdi uint64 + rsi uint64 + rbp uint64 + rbx uint64 + rdx uint64 + rax uint64 + rcx uint64 + rsp uint64 + rip uint64 + eflags uint64 + cs uint16 + gs uint16 + fs uint16 + __pad0 uint16 + err uint64 + trapno uint64 + oldmask uint64 + cr2 uint64 + fpstate *fpstate1 + __reserved1 [8]uint64 +} + +type sockaddr_un struct { + family uint16 + path [108]byte +} diff --git a/hack/go1_7_3/runtime/defs_linux_arm.go b/hack/go1_7_3/runtime/defs_linux_arm.go new file mode 100644 index 0000000..a666b92 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_linux_arm.go @@ -0,0 +1,170 @@ +package runtime + +// Constants +const ( + _EINTR = 0x4 + _ENOMEM = 0xc + _EAGAIN = 0xb + + _PROT_NONE = 0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x20 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_RESTORER = 0 + _SA_SIGINFO = 0x4 + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + _ITIMER_REAL = 0 + _ITIMER_PROF = 0x2 + _ITIMER_VIRTUAL = 0x1 + _O_RDONLY = 0 + _O_CLOEXEC = 0x80000 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 + + _AF_UNIX = 0x1 + _F_SETFL = 0x4 + _SOCK_DGRAM = 0x2 +) + +type timespec struct { + tv_sec int32 + tv_nsec int32 +} + +type sigaltstackt struct { + ss_sp *byte + ss_flags int32 + ss_size uintptr +} + +type sigcontext struct { + trap_no uint32 + error_code uint32 + oldmask uint32 + r0 uint32 + r1 uint32 + r2 uint32 + r3 uint32 + r4 uint32 + r5 uint32 + r6 uint32 + r7 uint32 + r8 uint32 + r9 uint32 + r10 uint32 + fp uint32 + ip uint32 + sp uint32 + lr uint32 + pc uint32 + cpsr uint32 + fault_address uint32 +} + +type ucontext struct { + uc_flags uint32 + uc_link *ucontext + uc_stack sigaltstackt + uc_mcontext sigcontext + uc_sigmask uint32 + __unused [31]int32 + uc_regspace [128]uint32 +} + +type timeval struct { + tv_sec int32 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + + si_addr uint32 +} + +type sigactiont struct { + sa_handler uintptr + sa_flags uint32 + sa_restorer uintptr + sa_mask uint64 +} + +type epollevent struct { + events uint32 + _pad uint32 + data [8]byte +} + +type sockaddr_un struct { + family uint16 + path [108]byte +} diff --git a/hack/go1_7_3/runtime/defs_linux_arm64.go b/hack/go1_7_3/runtime/defs_linux_arm64.go new file mode 100644 index 0000000..8eacf10 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_linux_arm64.go @@ -0,0 +1,172 @@ +// Created by cgo -cdefs and converted (by hand) to Go +// ../cmd/cgo/cgo -cdefs defs_linux.go defs1_linux.go defs2_linux.go + +package runtime + +const ( + _EINTR = 0x4 + _EAGAIN = 0xb + _ENOMEM = 0xc + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x20 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_RESTORER = 0x0 + _SA_SIGINFO = 0x4 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 + + _AF_UNIX = 0x1 + _F_SETFL = 0x4 + _SOCK_DGRAM = 0x2 +) + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type sigactiont struct { + sa_handler uintptr + sa_flags uint64 + sa_restorer uintptr + sa_mask uint64 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + + si_addr uint64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type epollevent struct { + events uint32 + _pad uint32 + data [8]byte +} + +const ( + _O_RDONLY = 0x0 + _O_CLOEXEC = 0x80000 +) + +type usigset struct { + __val [16]uint64 +} + +type sigaltstackt struct { + ss_sp *byte + ss_flags int32 + pad_cgo_0 [4]byte + ss_size uintptr +} + +type sigcontext struct { + fault_address uint64 + + regs [31]uint64 + sp uint64 + pc uint64 + pstate uint64 + _pad [8]byte + __reserved [4096]byte +} + +type sockaddr_un struct { + family uint16 + path [108]byte +} + +type ucontext struct { + uc_flags uint64 + uc_link *ucontext + uc_stack sigaltstackt + uc_sigmask uint64 + _pad [(1024 - 64) / 8]byte + _pad2 [8]byte + uc_mcontext sigcontext +} diff --git a/hack/go1_7_3/runtime/defs_linux_mips64x.go b/hack/go1_7_3/runtime/defs_linux_mips64x.go new file mode 100644 index 0000000..be729e3 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_linux_mips64x.go @@ -0,0 +1,165 @@ +// +build mips64 mips64le +// +build linux + +package runtime + +const ( + _EINTR = 0x4 + _EAGAIN = 0xb + _ENOMEM = 0xc + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x800 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_SIGINFO = 0x8 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGUSR1 = 0x10 + _SIGUSR2 = 0x11 + _SIGCHLD = 0x12 + _SIGPWR = 0x13 + _SIGWINCH = 0x14 + _SIGURG = 0x15 + _SIGIO = 0x16 + _SIGSTOP = 0x17 + _SIGTSTP = 0x18 + _SIGCONT = 0x19 + _SIGTTIN = 0x1a + _SIGTTOU = 0x1b + _SIGVTALRM = 0x1c + _SIGPROF = 0x1d + _SIGXCPU = 0x1e + _SIGXFSZ = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 +) + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type sigactiont struct { + sa_flags uint32 + sa_handler uintptr + sa_mask [2]uint64 + + sa_restorer uintptr +} + +type siginfo struct { + si_signo int32 + si_code int32 + si_errno int32 + __pad0 [1]int32 + + si_addr uint64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type epollevent struct { + events uint32 + pad_cgo_0 [4]byte + data [8]byte +} + +const ( + _O_RDONLY = 0x0 + _O_CLOEXEC = 0x80000 + _SA_RESTORER = 0 +) + +type sigaltstackt struct { + ss_sp *byte + ss_size uintptr + ss_flags int32 +} + +type sigcontext struct { + sc_regs [32]uint64 + sc_fpregs [32]uint64 + sc_mdhi uint64 + sc_hi1 uint64 + sc_hi2 uint64 + sc_hi3 uint64 + sc_mdlo uint64 + sc_lo1 uint64 + sc_lo2 uint64 + sc_lo3 uint64 + sc_pc uint64 + sc_fpc_csr uint32 + sc_used_math uint32 + sc_dsp uint32 + sc_reserved uint32 +} + +type ucontext struct { + uc_flags uint64 + uc_link *ucontext + uc_stack sigaltstackt + uc_mcontext sigcontext + uc_sigmask uint64 +} diff --git a/hack/go1_7_3/runtime/defs_linux_ppc64.go b/hack/go1_7_3/runtime/defs_linux_ppc64.go new file mode 100644 index 0000000..eef35bd --- /dev/null +++ b/hack/go1_7_3/runtime/defs_linux_ppc64.go @@ -0,0 +1,180 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_linux.go defs3_linux.go + +package runtime + +const ( + _EINTR = 0x4 + _EAGAIN = 0xb + _ENOMEM = 0xc + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x20 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_SIGINFO = 0x4 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 +) + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type sigactiont struct { + sa_handler uintptr + sa_flags uint64 + sa_restorer uintptr + sa_mask uint64 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + + si_addr uint64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type epollevent struct { + events uint32 + pad_cgo_0 [4]byte + data [8]byte +} + +const ( + _O_RDONLY = 0x0 + _O_CLOEXEC = 0x80000 + _SA_RESTORER = 0 +) + +type ptregs struct { + gpr [32]uint64 + nip uint64 + msr uint64 + orig_gpr3 uint64 + ctr uint64 + link uint64 + xer uint64 + ccr uint64 + softe uint64 + trap uint64 + dar uint64 + dsisr uint64 + result uint64 +} + +type vreg struct { + u [4]uint32 +} + +type sigaltstackt struct { + ss_sp *byte + ss_flags int32 + pad_cgo_0 [4]byte + ss_size uintptr +} + +type sigcontext struct { + _unused [4]uint64 + signal int32 + _pad0 int32 + handler uint64 + oldmask uint64 + regs *ptregs + gp_regs [48]uint64 + fp_regs [33]float64 + v_regs *vreg + vmx_reserve [101]int64 +} + +type ucontext struct { + uc_flags uint64 + uc_link *ucontext + uc_stack sigaltstackt + uc_sigmask uint64 + __unused [15]uint64 + uc_mcontext sigcontext +} diff --git a/hack/go1_7_3/runtime/defs_linux_ppc64le.go b/hack/go1_7_3/runtime/defs_linux_ppc64le.go new file mode 100644 index 0000000..eef35bd --- /dev/null +++ b/hack/go1_7_3/runtime/defs_linux_ppc64le.go @@ -0,0 +1,180 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_linux.go defs3_linux.go + +package runtime + +const ( + _EINTR = 0x4 + _EAGAIN = 0xb + _ENOMEM = 0xc + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x20 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_SIGINFO = 0x4 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 +) + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type sigactiont struct { + sa_handler uintptr + sa_flags uint64 + sa_restorer uintptr + sa_mask uint64 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + + si_addr uint64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type epollevent struct { + events uint32 + pad_cgo_0 [4]byte + data [8]byte +} + +const ( + _O_RDONLY = 0x0 + _O_CLOEXEC = 0x80000 + _SA_RESTORER = 0 +) + +type ptregs struct { + gpr [32]uint64 + nip uint64 + msr uint64 + orig_gpr3 uint64 + ctr uint64 + link uint64 + xer uint64 + ccr uint64 + softe uint64 + trap uint64 + dar uint64 + dsisr uint64 + result uint64 +} + +type vreg struct { + u [4]uint32 +} + +type sigaltstackt struct { + ss_sp *byte + ss_flags int32 + pad_cgo_0 [4]byte + ss_size uintptr +} + +type sigcontext struct { + _unused [4]uint64 + signal int32 + _pad0 int32 + handler uint64 + oldmask uint64 + regs *ptregs + gp_regs [48]uint64 + fp_regs [33]float64 + v_regs *vreg + vmx_reserve [101]int64 +} + +type ucontext struct { + uc_flags uint64 + uc_link *ucontext + uc_stack sigaltstackt + uc_sigmask uint64 + __unused [15]uint64 + uc_mcontext sigcontext +} diff --git a/hack/go1_7_3/runtime/defs_linux_s390x.go b/hack/go1_7_3/runtime/defs_linux_s390x.go new file mode 100644 index 0000000..241ccf9 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_linux_s390x.go @@ -0,0 +1,155 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _EINTR = 0x4 + _EAGAIN = 0xb + _ENOMEM = 0xc + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x20 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_DONTNEED = 0x4 + _MADV_HUGEPAGE = 0xe + _MADV_NOHUGEPAGE = 0xf + + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_SIGINFO = 0x4 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EPOLLIN = 0x1 + _EPOLLOUT = 0x4 + _EPOLLERR = 0x8 + _EPOLLHUP = 0x10 + _EPOLLRDHUP = 0x2000 + _EPOLLET = 0x80000000 + _EPOLL_CLOEXEC = 0x80000 + _EPOLL_CTL_ADD = 0x1 + _EPOLL_CTL_DEL = 0x2 + _EPOLL_CTL_MOD = 0x3 +) + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type sigactiont struct { + sa_handler uintptr + sa_flags uint64 + sa_restorer uintptr + sa_mask uint64 +} + +type siginfo struct { + si_signo int32 + si_errno int32 + si_code int32 + + si_addr uint64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type epollevent struct { + events uint32 + pad_cgo_0 [4]byte + data [8]byte +} + +const ( + _O_RDONLY = 0x0 + _O_CLOEXEC = 0x80000 + _SA_RESTORER = 0 +) + +type sigaltstackt struct { + ss_sp *byte + ss_flags int32 + ss_size uintptr +} + +type sigcontext struct { + psw_mask uint64 + psw_addr uint64 + gregs [16]uint64 + aregs [16]uint32 + fpc uint32 + fpregs [16]uint64 +} + +type ucontext struct { + uc_flags uint64 + uc_link *ucontext + uc_stack sigaltstackt + uc_mcontext sigcontext + uc_sigmask uint64 +} diff --git a/hack/go1_7_3/runtime/defs_nacl_386.go b/hack/go1_7_3/runtime/defs_nacl_386.go new file mode 100644 index 0000000..14cbcd3 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_nacl_386.go @@ -0,0 +1,41 @@ +package runtime + +const ( + _SIGQUIT = 3 + _SIGSEGV = 11 + _SIGPROF = 27 +) + +type timespec struct { + tv_sec int64 + tv_nsec int32 +} + +type excregs386 struct { + eax uint32 + ecx uint32 + edx uint32 + ebx uint32 + esp uint32 + ebp uint32 + esi uint32 + edi uint32 + eip uint32 + eflags uint32 +} + +type exccontext struct { + size uint32 + portable_context_offset uint32 + portable_context_size uint32 + arch uint32 + regs_size uint32 + reserved [11]uint32 + regs excregs386 +} + +type excportablecontext struct { + pc uint32 + sp uint32 + fp uint32 +} diff --git a/hack/go1_7_3/runtime/defs_nacl_amd64p32.go b/hack/go1_7_3/runtime/defs_nacl_amd64p32.go new file mode 100644 index 0000000..3162756 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_nacl_amd64p32.go @@ -0,0 +1,62 @@ +package runtime + +const ( + _SIGQUIT = 3 + _SIGSEGV = 11 + _SIGPROF = 27 +) + +type timespec struct { + tv_sec int64 + tv_nsec int32 +} + +type excregs386 struct { + eax uint32 + ecx uint32 + edx uint32 + ebx uint32 + esp uint32 + ebp uint32 + esi uint32 + edi uint32 + eip uint32 + eflags uint32 +} + +type excregsamd64 struct { + rax uint64 + rcx uint64 + rdx uint64 + rbx uint64 + rsp uint64 + rbp uint64 + rsi uint64 + rdi uint64 + r8 uint64 + r9 uint64 + r10 uint64 + r11 uint64 + r12 uint64 + r13 uint64 + r14 uint64 + r15 uint64 + rip uint64 + rflags uint32 +} + +type exccontext struct { + size uint32 + portable_context_offset uint32 + portable_context_size uint32 + arch uint32 + regs_size uint32 + reserved [11]uint32 + regs excregsamd64 +} + +type excportablecontext struct { + pc uint32 + sp uint32 + fp uint32 +} diff --git a/hack/go1_7_3/runtime/defs_nacl_arm.go b/hack/go1_7_3/runtime/defs_nacl_arm.go new file mode 100644 index 0000000..e8a2143 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_nacl_arm.go @@ -0,0 +1,48 @@ +package runtime + +const ( + _SIGQUIT = 3 + _SIGSEGV = 11 + _SIGPROF = 27 +) + +type timespec struct { + tv_sec int64 + tv_nsec int32 +} + +type excregsarm struct { + r0 uint32 + r1 uint32 + r2 uint32 + r3 uint32 + r4 uint32 + r5 uint32 + r6 uint32 + r7 uint32 + r8 uint32 + r9 uint32 + r10 uint32 + r11 uint32 + r12 uint32 + sp uint32 + lr uint32 + pc uint32 + cpsr uint32 +} + +type exccontext struct { + size uint32 + portable_context_offset uint32 + portable_context_size uint32 + arch uint32 + regs_size uint32 + reserved [11]uint32 + regs excregsarm +} + +type excportablecontext struct { + pc uint32 + sp uint32 + fp uint32 +} diff --git a/hack/go1_7_3/runtime/defs_openbsd_386.go b/hack/go1_7_3/runtime/defs_openbsd_386.go new file mode 100644 index 0000000..85c8765 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_openbsd_386.go @@ -0,0 +1,158 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_openbsd.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x6 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type tforkt struct { + tf_tcb unsafe.Pointer + tf_tid *int32 + tf_stack uintptr +} + +type sigaltstackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type sigcontext struct { + sc_gs uint32 + sc_fs uint32 + sc_es uint32 + sc_ds uint32 + sc_edi uint32 + sc_esi uint32 + sc_ebp uint32 + sc_ebx uint32 + sc_edx uint32 + sc_ecx uint32 + sc_eax uint32 + sc_eip uint32 + sc_cs uint32 + sc_eflags uint32 + sc_esp uint32 + sc_ss uint32 + __sc_unused uint32 + sc_mask uint32 + sc_trapno uint32 + sc_err uint32 + sc_fpstate unsafe.Pointer +} + +type siginfo struct { + si_signo int32 + si_code int32 + si_errno int32 + _data [116]byte +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type timespec struct { + tv_sec int64 + tv_nsec int32 +} + +type timeval struct { + tv_sec int64 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type keventt struct { + ident uint32 + filter int16 + flags uint16 + fflags uint32 + data int64 + udata *byte +} diff --git a/hack/go1_7_3/runtime/defs_openbsd_amd64.go b/hack/go1_7_3/runtime/defs_openbsd_amd64.go new file mode 100644 index 0000000..3167fd6 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_openbsd_amd64.go @@ -0,0 +1,169 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_openbsd.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x6 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type tforkt struct { + tf_tcb unsafe.Pointer + tf_tid *int32 + tf_stack uintptr +} + +type sigaltstackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type sigcontext struct { + sc_rdi uint64 + sc_rsi uint64 + sc_rdx uint64 + sc_rcx uint64 + sc_r8 uint64 + sc_r9 uint64 + sc_r10 uint64 + sc_r11 uint64 + sc_r12 uint64 + sc_r13 uint64 + sc_r14 uint64 + sc_r15 uint64 + sc_rbp uint64 + sc_rbx uint64 + sc_rax uint64 + sc_gs uint64 + sc_fs uint64 + sc_es uint64 + sc_ds uint64 + sc_trapno uint64 + sc_err uint64 + sc_rip uint64 + sc_cs uint64 + sc_rflags uint64 + sc_rsp uint64 + sc_ss uint64 + sc_fpstate unsafe.Pointer + __sc_unused int32 + sc_mask int32 +} + +type siginfo struct { + si_signo int32 + si_code int32 + si_errno int32 + pad_cgo_0 [4]byte + _data [120]byte +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 + pad_cgo_0 [4]byte +} + +type timespec struct { + tv_sec int64 + tv_nsec int64 +} + +type timeval struct { + tv_sec int64 + tv_usec int64 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type keventt struct { + ident uint64 + filter int16 + flags uint16 + fflags uint32 + data int64 + udata *byte +} diff --git a/hack/go1_7_3/runtime/defs_openbsd_arm.go b/hack/go1_7_3/runtime/defs_openbsd_arm.go new file mode 100644 index 0000000..22382fa --- /dev/null +++ b/hack/go1_7_3/runtime/defs_openbsd_arm.go @@ -0,0 +1,158 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_openbsd.go + +package runtime + +import "unsafe" + +const ( + _EINTR = 0x4 + _EFAULT = 0xe + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_ANON = 0x1000 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + + _MADV_FREE = 0x6 + + _SA_SIGINFO = 0x40 + _SA_RESTART = 0x2 + _SA_ONSTACK = 0x1 + + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGEMT = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGBUS = 0xa + _SIGSEGV = 0xb + _SIGSYS = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGTERM = 0xf + _SIGURG = 0x10 + _SIGSTOP = 0x11 + _SIGTSTP = 0x12 + _SIGCONT = 0x13 + _SIGCHLD = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGIO = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGINFO = 0x1d + _SIGUSR1 = 0x1e + _SIGUSR2 = 0x1f + + _FPE_INTDIV = 0x1 + _FPE_INTOVF = 0x2 + _FPE_FLTDIV = 0x3 + _FPE_FLTOVF = 0x4 + _FPE_FLTUND = 0x5 + _FPE_FLTRES = 0x6 + _FPE_FLTINV = 0x7 + _FPE_FLTSUB = 0x8 + + _BUS_ADRALN = 0x1 + _BUS_ADRERR = 0x2 + _BUS_OBJERR = 0x3 + + _SEGV_MAPERR = 0x1 + _SEGV_ACCERR = 0x2 + + _ITIMER_REAL = 0x0 + _ITIMER_VIRTUAL = 0x1 + _ITIMER_PROF = 0x2 + + _EV_ADD = 0x1 + _EV_DELETE = 0x2 + _EV_CLEAR = 0x20 + _EV_ERROR = 0x4000 + _EVFILT_READ = -0x1 + _EVFILT_WRITE = -0x2 +) + +type tforkt struct { + tf_tcb unsafe.Pointer + tf_tid *int32 + tf_stack uintptr +} + +type sigaltstackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type sigcontext struct { + __sc_unused int32 + sc_mask int32 + + sc_spsr uint32 + sc_r0 uint32 + sc_r1 uint32 + sc_r2 uint32 + sc_r3 uint32 + sc_r4 uint32 + sc_r5 uint32 + sc_r6 uint32 + sc_r7 uint32 + sc_r8 uint32 + sc_r9 uint32 + sc_r10 uint32 + sc_r11 uint32 + sc_r12 uint32 + sc_usr_sp uint32 + sc_usr_lr uint32 + sc_svc_lr uint32 + sc_pc uint32 +} + +type siginfo struct { + si_signo int32 + si_code int32 + si_errno int32 + _data [116]byte +} + +type stackt struct { + ss_sp uintptr + ss_size uintptr + ss_flags int32 +} + +type timespec struct { + tv_sec int64 + tv_nsec int32 +} + +type timeval struct { + tv_sec int64 + tv_usec int32 +} + +type itimerval struct { + it_interval timeval + it_value timeval +} + +type keventt struct { + ident uint32 + filter int16 + flags uint16 + fflags uint32 + data int64 + udata *byte +} diff --git a/hack/go1_7_3/runtime/defs_plan9_386.go b/hack/go1_7_3/runtime/defs_plan9_386.go new file mode 100644 index 0000000..320a00e --- /dev/null +++ b/hack/go1_7_3/runtime/defs_plan9_386.go @@ -0,0 +1,29 @@ +package runtime + +const _PAGESIZE = 0x1000 + +type ureg struct { + di uint32 + si uint32 + bp uint32 + nsp uint32 + bx uint32 + dx uint32 + cx uint32 + ax uint32 + gs uint32 + fs uint32 + es uint32 + ds uint32 + trap uint32 + ecode uint32 + pc uint32 + cs uint32 + flags uint32 + sp uint32 + ss uint32 +} + +type sigctxt struct { + u *ureg +} diff --git a/hack/go1_7_3/runtime/defs_plan9_amd64.go b/hack/go1_7_3/runtime/defs_plan9_amd64.go new file mode 100644 index 0000000..7cb955c --- /dev/null +++ b/hack/go1_7_3/runtime/defs_plan9_amd64.go @@ -0,0 +1,38 @@ +package runtime + +const _PAGESIZE = 0x1000 + +type ureg struct { + ax uint64 + bx uint64 + cx uint64 + dx uint64 + si uint64 + di uint64 + bp uint64 + r8 uint64 + r9 uint64 + r10 uint64 + r11 uint64 + r12 uint64 + r13 uint64 + r14 uint64 + r15 uint64 + + ds uint16 + es uint16 + fs uint16 + gs uint16 + + _type uint64 + error uint64 + ip uint64 + cs uint64 + flags uint64 + sp uint64 + ss uint64 +} + +type sigctxt struct { + u *ureg +} diff --git a/hack/go1_7_3/runtime/defs_plan9_arm.go b/hack/go1_7_3/runtime/defs_plan9_arm.go new file mode 100644 index 0000000..08d2643 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_plan9_arm.go @@ -0,0 +1,32 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const _PAGESIZE = 0x1000 + +type ureg struct { + r0 uint32 + r1 uint32 + r2 uint32 + r3 uint32 + r4 uint32 + r5 uint32 + r6 uint32 + r7 uint32 + r8 uint32 + r9 uint32 + r10 uint32 + r11 uint32 + r12 uint32 + sp uint32 + link uint32 + trap uint32 + psr uint32 + pc uint32 +} + +type sigctxt struct { + u *ureg +} diff --git a/hack/go1_7_3/runtime/defs_windows_386.go b/hack/go1_7_3/runtime/defs_windows_386.go new file mode 100644 index 0000000..abec2d8 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_windows_386.go @@ -0,0 +1,109 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_windows.go + +package runtime + +const ( + _PROT_NONE = 0 + _PROT_READ = 1 + _PROT_WRITE = 2 + _PROT_EXEC = 4 + + _MAP_ANON = 1 + _MAP_PRIVATE = 2 + + _DUPLICATE_SAME_ACCESS = 0x2 + _THREAD_PRIORITY_HIGHEST = 0x2 + + _SIGINT = 0x2 + _CTRL_C_EVENT = 0x0 + _CTRL_BREAK_EVENT = 0x1 + + _CONTEXT_CONTROL = 0x10001 + _CONTEXT_FULL = 0x10007 + + _EXCEPTION_ACCESS_VIOLATION = 0xc0000005 + _EXCEPTION_BREAKPOINT = 0x80000003 + _EXCEPTION_FLT_DENORMAL_OPERAND = 0xc000008d + _EXCEPTION_FLT_DIVIDE_BY_ZERO = 0xc000008e + _EXCEPTION_FLT_INEXACT_RESULT = 0xc000008f + _EXCEPTION_FLT_OVERFLOW = 0xc0000091 + _EXCEPTION_FLT_UNDERFLOW = 0xc0000093 + _EXCEPTION_INT_DIVIDE_BY_ZERO = 0xc0000094 + _EXCEPTION_INT_OVERFLOW = 0xc0000095 + + _INFINITE = 0xffffffff + _WAIT_TIMEOUT = 0x102 + + _EXCEPTION_CONTINUE_EXECUTION = -0x1 + _EXCEPTION_CONTINUE_SEARCH = 0x0 +) + +type systeminfo struct { + anon0 [4]byte + dwpagesize uint32 + lpminimumapplicationaddress *byte + lpmaximumapplicationaddress *byte + dwactiveprocessormask uint32 + dwnumberofprocessors uint32 + dwprocessortype uint32 + dwallocationgranularity uint32 + wprocessorlevel uint16 + wprocessorrevision uint16 +} + +type exceptionrecord struct { + exceptioncode uint32 + exceptionflags uint32 + exceptionrecord *exceptionrecord + exceptionaddress *byte + numberparameters uint32 + exceptioninformation [15]uint32 +} + +type floatingsavearea struct { + controlword uint32 + statusword uint32 + tagword uint32 + erroroffset uint32 + errorselector uint32 + dataoffset uint32 + dataselector uint32 + registerarea [80]uint8 + cr0npxstate uint32 +} + +type context struct { + contextflags uint32 + dr0 uint32 + dr1 uint32 + dr2 uint32 + dr3 uint32 + dr6 uint32 + dr7 uint32 + floatsave floatingsavearea + seggs uint32 + segfs uint32 + seges uint32 + segds uint32 + edi uint32 + esi uint32 + ebx uint32 + edx uint32 + ecx uint32 + eax uint32 + ebp uint32 + eip uint32 + segcs uint32 + eflags uint32 + esp uint32 + segss uint32 + extendedregisters [512]uint8 +} + +type overlapped struct { + internal uint32 + internalhigh uint32 + anon0 [8]byte + hevent *byte +} diff --git a/hack/go1_7_3/runtime/defs_windows_amd64.go b/hack/go1_7_3/runtime/defs_windows_amd64.go new file mode 100644 index 0000000..81b1359 --- /dev/null +++ b/hack/go1_7_3/runtime/defs_windows_amd64.go @@ -0,0 +1,124 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_windows.go + +package runtime + +const ( + _PROT_NONE = 0 + _PROT_READ = 1 + _PROT_WRITE = 2 + _PROT_EXEC = 4 + + _MAP_ANON = 1 + _MAP_PRIVATE = 2 + + _DUPLICATE_SAME_ACCESS = 0x2 + _THREAD_PRIORITY_HIGHEST = 0x2 + + _SIGINT = 0x2 + _CTRL_C_EVENT = 0x0 + _CTRL_BREAK_EVENT = 0x1 + + _CONTEXT_CONTROL = 0x100001 + _CONTEXT_FULL = 0x10000b + + _EXCEPTION_ACCESS_VIOLATION = 0xc0000005 + _EXCEPTION_BREAKPOINT = 0x80000003 + _EXCEPTION_FLT_DENORMAL_OPERAND = 0xc000008d + _EXCEPTION_FLT_DIVIDE_BY_ZERO = 0xc000008e + _EXCEPTION_FLT_INEXACT_RESULT = 0xc000008f + _EXCEPTION_FLT_OVERFLOW = 0xc0000091 + _EXCEPTION_FLT_UNDERFLOW = 0xc0000093 + _EXCEPTION_INT_DIVIDE_BY_ZERO = 0xc0000094 + _EXCEPTION_INT_OVERFLOW = 0xc0000095 + + _INFINITE = 0xffffffff + _WAIT_TIMEOUT = 0x102 + + _EXCEPTION_CONTINUE_EXECUTION = -0x1 + _EXCEPTION_CONTINUE_SEARCH = 0x0 +) + +type systeminfo struct { + anon0 [4]byte + dwpagesize uint32 + lpminimumapplicationaddress *byte + lpmaximumapplicationaddress *byte + dwactiveprocessormask uint64 + dwnumberofprocessors uint32 + dwprocessortype uint32 + dwallocationgranularity uint32 + wprocessorlevel uint16 + wprocessorrevision uint16 +} + +type exceptionrecord struct { + exceptioncode uint32 + exceptionflags uint32 + exceptionrecord *exceptionrecord + exceptionaddress *byte + numberparameters uint32 + pad_cgo_0 [4]byte + exceptioninformation [15]uint64 +} + +type m128a struct { + low uint64 + high int64 +} + +type context struct { + p1home uint64 + p2home uint64 + p3home uint64 + p4home uint64 + p5home uint64 + p6home uint64 + contextflags uint32 + mxcsr uint32 + segcs uint16 + segds uint16 + seges uint16 + segfs uint16 + seggs uint16 + segss uint16 + eflags uint32 + dr0 uint64 + dr1 uint64 + dr2 uint64 + dr3 uint64 + dr6 uint64 + dr7 uint64 + rax uint64 + rcx uint64 + rdx uint64 + rbx uint64 + rsp uint64 + rbp uint64 + rsi uint64 + rdi uint64 + r8 uint64 + r9 uint64 + r10 uint64 + r11 uint64 + r12 uint64 + r13 uint64 + r14 uint64 + r15 uint64 + rip uint64 + anon0 [512]byte + vectorregister [26]m128a + vectorcontrol uint64 + debugcontrol uint64 + lastbranchtorip uint64 + lastbranchfromrip uint64 + lastexceptiontorip uint64 + lastexceptionfromrip uint64 +} + +type overlapped struct { + internal uint64 + internalhigh uint64 + anon0 [8]byte + hevent *byte +} diff --git a/hack/go1_7_3/runtime/error.go b/hack/go1_7_3/runtime/error.go new file mode 100644 index 0000000..fbc6a69 --- /dev/null +++ b/hack/go1_7_3/runtime/error.go @@ -0,0 +1,32 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +// The Error interface identifies a run time error. +type Error interface { + error + + RuntimeError() +} + +// A TypeAssertionError explains a failed type assertion. +type TypeAssertionError struct { + interfaceString string + concreteString string + assertedString string + missingMethod string +} + +// An errorString represents a runtime error described by a single string. +type errorString string + +// plainError represents a runtime error described a string without +// the prefix "runtime error: " after invoking errorString.Error(). +// See Issue #14965. +type plainError string + +type stringer interface { + String() string +} diff --git a/hack/go1_7_3/runtime/extern.go b/hack/go1_7_3/runtime/extern.go new file mode 100644 index 0000000..fba5461 --- /dev/null +++ b/hack/go1_7_3/runtime/extern.go @@ -0,0 +1,170 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Package runtime contains operations that interact with Go's runtime system, +such as functions to control goroutines. It also includes the low-level type information +used by the reflect package; see reflect's documentation for the programmable +interface to the run-time type system. + +Environment Variables + +The following environment variables ($name or %name%, depending on the host +operating system) control the run-time behavior of Go programs. The meanings +and use may change from release to release. + +The GOGC variable sets the initial garbage collection target percentage. +A collection is triggered when the ratio of freshly allocated data to live data +remaining after the previous collection reaches this percentage. The default +is GOGC=100. Setting GOGC=off disables the garbage collector entirely. +The runtime/debug package's SetGCPercent function allows changing this +percentage at run time. See https://golang.org/pkg/runtime/debug/#SetGCPercent. + +The GODEBUG variable controls debugging variables within the runtime. +It is a comma-separated list of name=val pairs setting these named variables: + + allocfreetrace: setting allocfreetrace=1 causes every allocation to be + profiled and a stack trace printed on each object's allocation and free. + + cgocheck: setting cgocheck=0 disables all checks for packages + using cgo to incorrectly pass Go pointers to non-Go code. + Setting cgocheck=1 (the default) enables relatively cheap + checks that may miss some errors. Setting cgocheck=2 enables + expensive checks that should not miss any errors, but will + cause your program to run slower. + + efence: setting efence=1 causes the allocator to run in a mode + where each object is allocated on a unique page and addresses are + never recycled. + + gccheckmark: setting gccheckmark=1 enables verification of the + garbage collector's concurrent mark phase by performing a + second mark pass while the world is stopped. If the second + pass finds a reachable object that was not found by concurrent + mark, the garbage collector will panic. + + gcpacertrace: setting gcpacertrace=1 causes the garbage collector to + print information about the internal state of the concurrent pacer. + + gcshrinkstackoff: setting gcshrinkstackoff=1 disables moving goroutines + onto smaller stacks. In this mode, a goroutine's stack can only grow. + + gcstackbarrieroff: setting gcstackbarrieroff=1 disables the use of stack barriers + that allow the garbage collector to avoid repeating a stack scan during the + mark termination phase. + + gcstackbarrierall: setting gcstackbarrierall=1 installs stack barriers + in every stack frame, rather than in exponentially-spaced frames. + + gcstoptheworld: setting gcstoptheworld=1 disables concurrent garbage collection, + making every garbage collection a stop-the-world event. Setting gcstoptheworld=2 + also disables concurrent sweeping after the garbage collection finishes. + + gctrace: setting gctrace=1 causes the garbage collector to emit a single line to standard + error at each collection, summarizing the amount of memory collected and the + length of the pause. Setting gctrace=2 emits the same summary but also + repeats each collection. The format of this line is subject to change. + Currently, it is: + gc # @#s #%: #+#+# ms clock, #+#/#/#+# ms cpu, #->#-># MB, # MB goal, # P + where the fields are as follows: + gc # the GC number, incremented at each GC + @#s time in seconds since program start + #% percentage of time spent in GC since program start + #+...+# wall-clock/CPU times for the phases of the GC + #->#-># MB heap size at GC start, at GC end, and live heap + # MB goal goal heap size + # P number of processors used + The phases are stop-the-world (STW) sweep termination, concurrent + mark and scan, and STW mark termination. The CPU times + for mark/scan are broken down in to assist time (GC performed in + line with allocation), background GC time, and idle GC time. + If the line ends with "(forced)", this GC was forced by a + runtime.GC() call and all phases are STW. + + Setting gctrace to any value > 0 also causes the garbage collector + to emit a summary when memory is released back to the system. + This process of returning memory to the system is called scavenging. + The format of this summary is subject to change. + Currently it is: + scvg#: # MB released printed only if non-zero + scvg#: inuse: # idle: # sys: # released: # consumed: # (MB) + where the fields are as follows: + scvg# the scavenge cycle number, incremented at each scavenge + inuse: # MB used or partially used spans + idle: # MB spans pending scavenging + sys: # MB mapped from the system + released: # MB released to the system + consumed: # MB allocated from the system + + memprofilerate: setting memprofilerate=X will update the value of runtime.MemProfileRate. + When set to 0 memory profiling is disabled. Refer to the description of + MemProfileRate for the default value. + + invalidptr: defaults to invalidptr=1, causing the garbage collector and stack + copier to crash the program if an invalid pointer value (for example, 1) + is found in a pointer-typed location. Setting invalidptr=0 disables this check. + This should only be used as a temporary workaround to diagnose buggy code. + The real fix is to not store integers in pointer-typed locations. + + sbrk: setting sbrk=1 replaces the memory allocator and garbage collector + with a trivial allocator that obtains memory from the operating system and + never reclaims any memory. + + scavenge: scavenge=1 enables debugging mode of heap scavenger. + + scheddetail: setting schedtrace=X and scheddetail=1 causes the scheduler to emit + detailed multiline info every X milliseconds, describing state of the scheduler, + processors, threads and goroutines. + + schedtrace: setting schedtrace=X causes the scheduler to emit a single line to standard + error every X milliseconds, summarizing the scheduler state. + +The net and net/http packages also refer to debugging variables in GODEBUG. +See the documentation for those packages for details. + +The GOMAXPROCS variable limits the number of operating system threads that +can execute user-level Go code simultaneously. There is no limit to the number of threads +that can be blocked in system calls on behalf of Go code; those do not count against +the GOMAXPROCS limit. This package's GOMAXPROCS function queries and changes +the limit. + +The GOTRACEBACK variable controls the amount of output generated when a Go +program fails due to an unrecovered panic or an unexpected runtime condition. +By default, a failure prints a stack trace for the current goroutine, +eliding functions internal to the run-time system, and then exits with exit code 2. +The failure prints stack traces for all goroutines if there is no current goroutine +or the failure is internal to the run-time. +GOTRACEBACK=none omits the goroutine stack traces entirely. +GOTRACEBACK=single (the default) behaves as described above. +GOTRACEBACK=all adds stack traces for all user-created goroutines. +GOTRACEBACK=system is like ``all'' but adds stack frames for run-time functions +and shows goroutines created internally by the run-time. +GOTRACEBACK=crash is like ``system'' but crashes in an operating system-specific +manner instead of exiting. For example, on Unix systems, the crash raises +SIGABRT to trigger a core dump. +For historical reasons, the GOTRACEBACK settings 0, 1, and 2 are synonyms for +none, all, and system, respectively. +The runtime/debug package's SetTraceback function allows increasing the +amount of output at run time, but it cannot reduce the amount below that +specified by the environment variable. +See https://golang.org/pkg/runtime/debug/#SetTraceback. + +The GOARCH, GOOS, GOPATH, and GOROOT environment variables complete +the set of Go environment variables. They influence the building of Go programs +(see https://golang.org/cmd/go and https://golang.org/pkg/go/build). +GOARCH, GOOS, and GOROOT are recorded at compile time and made available by +constants or functions in this package, but they do not influence the execution +of the run-time system. +*/ +package runtime + +import "github.com/huandu/goroutine/hack/go1_7_3/runtime/internal/sys" + +// GOOS is the running program's operating system target: +// one of darwin, freebsd, linux, and so on. +const GOOS string = sys.GOOS + +// GOARCH is the running program's architecture target: +// 386, amd64, arm, or s390x. +const GOARCH string = sys.GOARCH diff --git a/hack/go1_7_3/runtime/fastlog2table.go b/hack/go1_7_3/runtime/fastlog2table.go new file mode 100644 index 0000000..1ccb0e4 --- /dev/null +++ b/hack/go1_7_3/runtime/fastlog2table.go @@ -0,0 +1,7 @@ +// AUTO-GENERATED by mkfastlog2table.go +// Run go generate from src/runtime to update. +// See mkfastlog2table.go for comments. + +package runtime + +const fastlogNumBits = 5 diff --git a/hack/go1_7_3/runtime/hackedtypes.go b/hack/go1_7_3/runtime/hackedtypes.go new file mode 100644 index 0000000..3aef945 --- /dev/null +++ b/hack/go1_7_3/runtime/hackedtypes.go @@ -0,0 +1,13 @@ +// Copyright 2016 Huan Du. All rights reserved. +// Use of this source code is governed by a MIT +// license that can be found in the LICENSE file. + +package runtime + +// Goroutine is the internal type represents a goroutine. +type Goroutine g + +// Get goid. +func (g *Goroutine) Goid() int64 { + return g.goid +} diff --git a/hack/go1_7_3/runtime/hash32.go b/hack/go1_7_3/runtime/hash32.go new file mode 100644 index 0000000..f0f9436 --- /dev/null +++ b/hack/go1_7_3/runtime/hash32.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Hashing algorithm inspired by +// xxhash: https://code.google.com/p/xxhash/ +// cityhash: https://code.google.com/p/cityhash/ + +// +build 386 arm + +package runtime + +const ( + m1 = 3168982561 + m2 = 3339683297 + m3 = 832293441 + m4 = 2336365089 +) diff --git a/hack/go1_7_3/runtime/hash64.go b/hack/go1_7_3/runtime/hash64.go new file mode 100644 index 0000000..d5b2049 --- /dev/null +++ b/hack/go1_7_3/runtime/hash64.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Hashing algorithm inspired by +// xxhash: https://code.google.com/p/xxhash/ +// cityhash: https://code.google.com/p/cityhash/ + +// +build amd64 amd64p32 arm64 mips64 mips64le ppc64 ppc64le s390x + +package runtime + +const ( + m1 = 16877499708836156737 + m2 = 2820277070424839065 + m3 = 9497967016996688599 + m4 = 15839092249703872147 +) diff --git a/hack/go1_7_3/runtime/hashmap.go b/hack/go1_7_3/runtime/hashmap.go new file mode 100644 index 0000000..831e3fb --- /dev/null +++ b/hack/go1_7_3/runtime/hashmap.go @@ -0,0 +1,78 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_3/runtime/internal/sys" + "unsafe" +) + +const ( + bucketCntBits = 3 + bucketCnt = 1 << bucketCntBits + + loadFactor = 6.5 + + maxKeySize = 128 + maxValueSize = 128 + + dataOffset = unsafe.Offsetof(struct { + b bmap + v int64 + }{}.v) + + empty = 0 + evacuatedEmpty = 1 + evacuatedX = 2 + evacuatedY = 3 + minTopHash = 4 + + iterator = 1 + oldIterator = 2 + hashWriting = 4 + + noCheck = 1<<(8*sys.PtrSize) - 1 +) + +// A header for a Go map. +type hmap struct { + count int + flags uint8 + B uint8 + hash0 uint32 + + buckets unsafe.Pointer + oldbuckets unsafe.Pointer + nevacuate uintptr + + overflow *[2]*[]*bmap +} + +// A bucket for a Go map. +type bmap struct { + tophash [bucketCnt]uint8 +} + +// A hash iteration structure. +// If you modify hiter, also change cmd/internal/gc/reflect.go to indicate +// the layout of this structure. +type hiter struct { + key unsafe.Pointer + value unsafe.Pointer + t *maptype + h *hmap + buckets unsafe.Pointer + bptr *bmap + overflow [2]*[]*bmap + startBucket uintptr + offset uint8 + wrapped bool + B uint8 + i uint8 + bucket uintptr + checkBucket uintptr +} + +const maxZero = 1024 diff --git a/hack/go1_7_3/runtime/heapdump.go b/hack/go1_7_3/runtime/heapdump.go new file mode 100644 index 0000000..48d8272 --- /dev/null +++ b/hack/go1_7_3/runtime/heapdump.go @@ -0,0 +1,65 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Implementation of runtime/debug.WriteHeapDump. Writes all +// objects in the heap plus additional info (roots, threads, +// finalizers, etc.) to a file. + +// The format of the dumped file is described at +// https://golang.org/s/go15heapdump. + +package runtime + +const ( + fieldKindEol = 0 + fieldKindPtr = 1 + fieldKindIface = 2 + fieldKindEface = 3 + tagEOF = 0 + tagObject = 1 + tagOtherRoot = 2 + tagType = 3 + tagGoroutine = 4 + tagStackFrame = 5 + tagParams = 6 + tagFinalizer = 7 + tagItab = 8 + tagOSThread = 9 + tagMemStats = 10 + tagQueuedFinalizer = 11 + tagData = 12 + tagBSS = 13 + tagDefer = 14 + tagPanic = 15 + tagMemProf = 16 + tagAllocSample = 17 +) + +// buffer of pending write data +const ( + bufSize = 4096 +) + +// Cache of types that have been serialized already. +// We use a type's hash field to pick a bucket. +// Inside a bucket, we keep a list of types that +// have been serialized so far, most recently used first. +// Note: when a bucket overflows we may end up +// serializing a type more than once. That's ok. +const ( + typeCacheBuckets = 256 + typeCacheAssoc = 4 +) + +type typeCacheBucket struct { + t [typeCacheAssoc]*_type +} + +type childInfo struct { + argoff uintptr + arglen uintptr + args bitvector + sp *uint8 + depth uintptr +} diff --git a/hack/go1_7_3/runtime/iface.go b/hack/go1_7_3/runtime/iface.go new file mode 100644 index 0000000..ce4c87f --- /dev/null +++ b/hack/go1_7_3/runtime/iface.go @@ -0,0 +1,9 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + hashSize = 1009 +) diff --git a/hack/go1_7_3/runtime/internal/sys/arch.go b/hack/go1_7_3/runtime/internal/sys/arch.go new file mode 100644 index 0000000..c175704 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/arch.go @@ -0,0 +1,17 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +type ArchFamilyType int + +const ( + AMD64 ArchFamilyType = iota + ARM + ARM64 + I386 + MIPS64 + PPC64 + S390X +) diff --git a/hack/go1_7_3/runtime/internal/sys/arch_386.go b/hack/go1_7_3/runtime/internal/sys/arch_386.go new file mode 100644 index 0000000..55cdcba --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/arch_386.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = I386 + BigEndian = 0 + CacheLineSize = 64 + PhysPageSize = GoosNacl*65536 + (1-GoosNacl)*4096 + PCQuantum = 1 + Int64Align = 4 + HugePageSize = 1 << 21 + MinFrameSize = 0 +) + +type Uintreg uint32 diff --git a/hack/go1_7_3/runtime/internal/sys/arch_amd64.go b/hack/go1_7_3/runtime/internal/sys/arch_amd64.go new file mode 100644 index 0000000..1bbdb99 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/arch_amd64.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = AMD64 + BigEndian = 0 + CacheLineSize = 64 + PhysPageSize = 4096 + PCQuantum = 1 + Int64Align = 8 + HugePageSize = 1 << 21 + MinFrameSize = 0 +) + +type Uintreg uint64 diff --git a/hack/go1_7_3/runtime/internal/sys/arch_amd64p32.go b/hack/go1_7_3/runtime/internal/sys/arch_amd64p32.go new file mode 100644 index 0000000..b7011a4 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/arch_amd64p32.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = AMD64 + BigEndian = 0 + CacheLineSize = 64 + PhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl) + PCQuantum = 1 + Int64Align = 8 + HugePageSize = 1 << 21 + MinFrameSize = 0 +) + +type Uintreg uint64 diff --git a/hack/go1_7_3/runtime/internal/sys/arch_arm.go b/hack/go1_7_3/runtime/internal/sys/arch_arm.go new file mode 100644 index 0000000..f90f52d --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/arch_arm.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = ARM + BigEndian = 0 + CacheLineSize = 32 + PhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl) + PCQuantum = 4 + Int64Align = 4 + HugePageSize = 0 + MinFrameSize = 4 +) + +type Uintreg uint32 diff --git a/hack/go1_7_3/runtime/internal/sys/arch_arm64.go b/hack/go1_7_3/runtime/internal/sys/arch_arm64.go new file mode 100644 index 0000000..aaaa4b0 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/arch_arm64.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = ARM64 + BigEndian = 0 + CacheLineSize = 32 + PhysPageSize = 65536 + PCQuantum = 4 + Int64Align = 8 + HugePageSize = 0 + MinFrameSize = 8 +) + +type Uintreg uint64 diff --git a/hack/go1_7_3/runtime/internal/sys/arch_mips64.go b/hack/go1_7_3/runtime/internal/sys/arch_mips64.go new file mode 100644 index 0000000..d567259 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/arch_mips64.go @@ -0,0 +1,18 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = MIPS64 + BigEndian = 1 + CacheLineSize = 32 + PhysPageSize = 16384 + PCQuantum = 4 + Int64Align = 8 + HugePageSize = 0 + MinFrameSize = 8 +) + +type Uintreg uint64 diff --git a/hack/go1_7_3/runtime/internal/sys/arch_mips64le.go b/hack/go1_7_3/runtime/internal/sys/arch_mips64le.go new file mode 100644 index 0000000..f8cdf2b --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/arch_mips64le.go @@ -0,0 +1,18 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = MIPS64 + BigEndian = 0 + CacheLineSize = 32 + PhysPageSize = 16384 + PCQuantum = 4 + Int64Align = 8 + HugePageSize = 0 + MinFrameSize = 8 +) + +type Uintreg uint64 diff --git a/hack/go1_7_3/runtime/internal/sys/arch_ppc64.go b/hack/go1_7_3/runtime/internal/sys/arch_ppc64.go new file mode 100644 index 0000000..cdec63f --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/arch_ppc64.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = PPC64 + BigEndian = 1 + CacheLineSize = 64 + PhysPageSize = 65536 + PCQuantum = 4 + Int64Align = 8 + HugePageSize = 0 + MinFrameSize = 32 +) + +type Uintreg uint64 diff --git a/hack/go1_7_3/runtime/internal/sys/arch_ppc64le.go b/hack/go1_7_3/runtime/internal/sys/arch_ppc64le.go new file mode 100644 index 0000000..4fd68f9 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/arch_ppc64le.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = PPC64 + BigEndian = 0 + CacheLineSize = 64 + PhysPageSize = 65536 + PCQuantum = 4 + Int64Align = 8 + HugePageSize = 0 + MinFrameSize = 32 +) + +type Uintreg uint64 diff --git a/hack/go1_7_3/runtime/internal/sys/arch_s390x.go b/hack/go1_7_3/runtime/internal/sys/arch_s390x.go new file mode 100644 index 0000000..ca1cb86 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/arch_s390x.go @@ -0,0 +1,18 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const ( + ArchFamily = S390X + BigEndian = 1 + CacheLineSize = 256 + PhysPageSize = 4096 + PCQuantum = 2 + Int64Align = 8 + HugePageSize = 0 + MinFrameSize = 8 +) + +type Uintreg uint64 diff --git a/hack/go1_7_3/runtime/internal/sys/hackedbuildruntime.go b/hack/go1_7_3/runtime/internal/sys/hackedbuildruntime.go new file mode 100644 index 0000000..0e93bfd --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/hackedbuildruntime.go @@ -0,0 +1,8 @@ +// Copyright 2016 Huan Du. All rights reserved. +// Use of this source code is governed by a MIT +// license that can be found in the LICENSE file. + +package sys + +const TheVersion = `go1.7.3` +const StackGuardMultiplier = 1 diff --git a/hack/go1_7_3/runtime/internal/sys/intrinsics.go b/hack/go1_7_3/runtime/internal/sys/intrinsics.go new file mode 100644 index 0000000..e65becb --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/intrinsics.go @@ -0,0 +1,15 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !386 + +package sys + +const deBruijn64 = 0x0218a392cd3d5dbf + +const deBruijn32 = 0x04653adf + +const deBruijn16 = 0x09af + +const deBruijn8 = 0x17 diff --git a/hack/go1_7_3/runtime/internal/sys/stubs.go b/hack/go1_7_3/runtime/internal/sys/stubs.go new file mode 100644 index 0000000..9c24896 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/stubs.go @@ -0,0 +1,9 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sys + +const PtrSize = 4 << (^uintptr(0) >> 63) +const RegSize = 4 << (^Uintreg(0) >> 63) +const SpAlign = 1*(1-GoarchArm64) + 16*GoarchArm64 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoarch_386.go b/hack/go1_7_3/runtime/internal/sys/zgoarch_386.go new file mode 100644 index 0000000..3bcf83b --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoarch_386.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `386` + +const Goarch386 = 1 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoarch_amd64.go b/hack/go1_7_3/runtime/internal/sys/zgoarch_amd64.go new file mode 100644 index 0000000..699f191 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoarch_amd64.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `amd64` + +const Goarch386 = 0 +const GoarchAmd64 = 1 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoarch_amd64p32.go b/hack/go1_7_3/runtime/internal/sys/zgoarch_amd64p32.go new file mode 100644 index 0000000..cc2d658 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoarch_amd64p32.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `amd64p32` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 1 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoarch_arm.go b/hack/go1_7_3/runtime/internal/sys/zgoarch_arm.go new file mode 100644 index 0000000..a5fd789 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoarch_arm.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `arm` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 1 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoarch_arm64.go b/hack/go1_7_3/runtime/internal/sys/zgoarch_arm64.go new file mode 100644 index 0000000..084d2c7 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoarch_arm64.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `arm64` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 1 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoarch_mips64.go b/hack/go1_7_3/runtime/internal/sys/zgoarch_mips64.go new file mode 100644 index 0000000..2ad62bd --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoarch_mips64.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `mips64` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 1 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoarch_mips64le.go b/hack/go1_7_3/runtime/internal/sys/zgoarch_mips64le.go new file mode 100644 index 0000000..047c8b4 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoarch_mips64le.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `mips64le` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 1 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoarch_ppc64.go b/hack/go1_7_3/runtime/internal/sys/zgoarch_ppc64.go new file mode 100644 index 0000000..748b5b5 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoarch_ppc64.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `ppc64` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 1 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoarch_ppc64le.go b/hack/go1_7_3/runtime/internal/sys/zgoarch_ppc64le.go new file mode 100644 index 0000000..d3dcba4 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoarch_ppc64le.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `ppc64le` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 1 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 0 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoarch_s390x.go b/hack/go1_7_3/runtime/internal/sys/zgoarch_s390x.go new file mode 100644 index 0000000..1ead5d5 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoarch_s390x.go @@ -0,0 +1,26 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOARCH = `s390x` + +const Goarch386 = 0 +const GoarchAmd64 = 0 +const GoarchAmd64p32 = 0 +const GoarchArm = 0 +const GoarchArmbe = 0 +const GoarchArm64 = 0 +const GoarchArm64be = 0 +const GoarchPpc64 = 0 +const GoarchPpc64le = 0 +const GoarchMips = 0 +const GoarchMipsle = 0 +const GoarchMips64 = 0 +const GoarchMips64le = 0 +const GoarchMips64p32 = 0 +const GoarchMips64p32le = 0 +const GoarchPpc = 0 +const GoarchS390 = 0 +const GoarchS390x = 1 +const GoarchSparc = 0 +const GoarchSparc64 = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoos_android.go b/hack/go1_7_3/runtime/internal/sys/zgoos_android.go new file mode 100644 index 0000000..6503b15 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoos_android.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `android` + +const GoosAndroid = 1 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoos_darwin.go b/hack/go1_7_3/runtime/internal/sys/zgoos_darwin.go new file mode 100644 index 0000000..6a28598 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoos_darwin.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `darwin` + +const GoosAndroid = 0 +const GoosDarwin = 1 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoos_dragonfly.go b/hack/go1_7_3/runtime/internal/sys/zgoos_dragonfly.go new file mode 100644 index 0000000..886ac26 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoos_dragonfly.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `dragonfly` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 1 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoos_freebsd.go b/hack/go1_7_3/runtime/internal/sys/zgoos_freebsd.go new file mode 100644 index 0000000..0bf2403 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoos_freebsd.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `freebsd` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 1 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoos_linux.go b/hack/go1_7_3/runtime/internal/sys/zgoos_linux.go new file mode 100644 index 0000000..c8664db --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoos_linux.go @@ -0,0 +1,19 @@ +// generated by gengoos.go using 'go generate' + +// +build !android + +package sys + +const GOOS = `linux` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 1 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoos_nacl.go b/hack/go1_7_3/runtime/internal/sys/zgoos_nacl.go new file mode 100644 index 0000000..0541226 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoos_nacl.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `nacl` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 1 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoos_netbsd.go b/hack/go1_7_3/runtime/internal/sys/zgoos_netbsd.go new file mode 100644 index 0000000..5c509a1 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoos_netbsd.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `netbsd` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 1 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoos_openbsd.go b/hack/go1_7_3/runtime/internal/sys/zgoos_openbsd.go new file mode 100644 index 0000000..dc43157 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoos_openbsd.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `openbsd` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 1 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoos_plan9.go b/hack/go1_7_3/runtime/internal/sys/zgoos_plan9.go new file mode 100644 index 0000000..4b0934f --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoos_plan9.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `plan9` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 1 +const GoosSolaris = 0 +const GoosWindows = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoos_solaris.go b/hack/go1_7_3/runtime/internal/sys/zgoos_solaris.go new file mode 100644 index 0000000..42511a3 --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoos_solaris.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `solaris` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 1 +const GoosWindows = 0 diff --git a/hack/go1_7_3/runtime/internal/sys/zgoos_windows.go b/hack/go1_7_3/runtime/internal/sys/zgoos_windows.go new file mode 100644 index 0000000..d77f62c --- /dev/null +++ b/hack/go1_7_3/runtime/internal/sys/zgoos_windows.go @@ -0,0 +1,17 @@ +// generated by gengoos.go using 'go generate' + +package sys + +const GOOS = `windows` + +const GoosAndroid = 0 +const GoosDarwin = 0 +const GoosDragonfly = 0 +const GoosFreebsd = 0 +const GoosLinux = 0 +const GoosNacl = 0 +const GoosNetbsd = 0 +const GoosOpenbsd = 0 +const GoosPlan9 = 0 +const GoosSolaris = 0 +const GoosWindows = 1 diff --git a/hack/go1_7_3/runtime/lfstack_64bit.go b/hack/go1_7_3/runtime/lfstack_64bit.go new file mode 100644 index 0000000..9bb9eeb --- /dev/null +++ b/hack/go1_7_3/runtime/lfstack_64bit.go @@ -0,0 +1,13 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build amd64 arm64 mips64 mips64le ppc64 ppc64le s390x + +package runtime + +const ( + addrBits = 48 + + cntBits = 64 - addrBits + 3 +) diff --git a/hack/go1_7_3/runtime/lock_futex.go b/hack/go1_7_3/runtime/lock_futex.go new file mode 100644 index 0000000..4ef26b0 --- /dev/null +++ b/hack/go1_7_3/runtime/lock_futex.go @@ -0,0 +1,17 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build dragonfly freebsd linux + +package runtime + +const ( + mutex_unlocked = 0 + mutex_locked = 1 + mutex_sleeping = 2 + + active_spin = 4 + active_spin_cnt = 30 + passive_spin = 1 +) diff --git a/hack/go1_7_3/runtime/lock_sema.go b/hack/go1_7_3/runtime/lock_sema.go new file mode 100644 index 0000000..3b62d55 --- /dev/null +++ b/hack/go1_7_3/runtime/lock_sema.go @@ -0,0 +1,28 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build darwin nacl netbsd openbsd plan9 solaris windows + +package runtime + +// This implementation depends on OS-specific implementations of +// +// func semacreate(mp *m) +// Create a semaphore for mp, if it does not already have one. +// +// func semasleep(ns int64) int32 +// If ns < 0, acquire m's semaphore and return 0. +// If ns >= 0, try to acquire m's semaphore for at most ns nanoseconds. +// Return 0 if the semaphore was acquired, -1 if interrupted or timed out. +// +// func semawakeup(mp *m) +// Wake up mp, which is or will soon be sleeping on its semaphore. +// +const ( + locked uintptr = 1 + + active_spin = 4 + active_spin_cnt = 30 + passive_spin = 1 +) diff --git a/hack/go1_7_3/runtime/malloc.go b/hack/go1_7_3/runtime/malloc.go new file mode 100644 index 0000000..e6fb7c7 --- /dev/null +++ b/hack/go1_7_3/runtime/malloc.go @@ -0,0 +1,142 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Memory allocator, based on tcmalloc. +// http://goog-perftools.sourceforge.net/doc/tcmalloc.html + +// The main allocator works in runs of pages. +// Small allocation sizes (up to and including 32 kB) are +// rounded to one of about 100 size classes, each of which +// has its own free list of objects of exactly that size. +// Any free page of memory can be split into a set of objects +// of one size class, which are then managed using free list +// allocators. +// +// The allocator's data structures are: +// +// FixAlloc: a free-list allocator for fixed-size objects, +// used to manage storage used by the allocator. +// MHeap: the malloc heap, managed at page (4096-byte) granularity. +// MSpan: a run of pages managed by the MHeap. +// MCentral: a shared free list for a given size class. +// MCache: a per-thread (in Go, per-P) cache for small objects. +// MStats: allocation statistics. +// +// Allocating a small object proceeds up a hierarchy of caches: +// +// 1. Round the size up to one of the small size classes +// and look in the corresponding MCache free list. +// If the list is not empty, allocate an object from it. +// This can all be done without acquiring a lock. +// +// 2. If the MCache free list is empty, replenish it by +// taking a bunch of objects from the MCentral free list. +// Moving a bunch amortizes the cost of acquiring the MCentral lock. +// +// 3. If the MCentral free list is empty, replenish it by +// allocating a run of pages from the MHeap and then +// chopping that memory into objects of the given size. +// Allocating many objects amortizes the cost of locking +// the heap. +// +// 4. If the MHeap is empty or has no page runs large enough, +// allocate a new group of pages (at least 1MB) from the +// operating system. Allocating a large run of pages +// amortizes the cost of talking to the operating system. +// +// Freeing a small object proceeds up the same hierarchy: +// +// 1. Look up the size class for the object and add it to +// the MCache free list. +// +// 2. If the MCache free list is too long or the MCache has +// too much memory, return some to the MCentral free lists. +// +// 3. If all the objects in a given span have returned to +// the MCentral list, return that span to the page heap. +// +// 4. If the heap has too much memory, return some to the +// operating system. +// +// TODO(rsc): Step 4 is not implemented. +// +// Allocating and freeing a large object uses the page heap +// directly, bypassing the MCache and MCentral free lists. +// +// The small objects on the MCache and MCentral free lists +// may or may not be zeroed. They are zeroed if and only if +// the second word of the object is zero. A span in the +// page heap is zeroed unless s->needzero is set. When a span +// is allocated to break into small objects, it is zeroed if needed +// and s->needzero is set. There are two main benefits to delaying the +// zeroing this way: +// +// 1. stack frames allocated from the small object lists +// or the page heap can avoid zeroing altogether. +// 2. the cost of zeroing when reusing a small object is +// charged to the mutator, not the garbage collector. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_3/runtime/internal/sys" + "unsafe" +) + +const ( + debugMalloc = false + + maxTinySize = _TinySize + tinySizeClass = _TinySizeClass + maxSmallSize = _MaxSmallSize + + pageShift = _PageShift + pageSize = _PageSize + pageMask = _PageMask + + maxObjsPerSpan = pageSize / 8 + + mSpanInUse = _MSpanInUse + + concurrentSweep = _ConcurrentSweep +) + +const ( + _PageShift = 13 + _PageSize = 1 << _PageShift + _PageMask = _PageSize - 1 +) + +const ( + _64bit = 1 << (^uintptr(0) >> 63) / 2 + + _NumSizeClasses = 67 + + _MaxSmallSize = 32 << 10 + + _TinySize = 16 + _TinySizeClass = 2 + + _FixAllocChunk = 16 << 10 + _MaxMHeapList = 1 << (20 - _PageShift) + _HeapAllocChunk = 1 << 20 + + _StackCacheSize = 32 * 1024 + + _NumStackOrders = 4 - sys.PtrSize/4*sys.GoosWindows - 1*sys.GoosPlan9 + + _MHeapMap_TotalBits = (_64bit*sys.GoosWindows)*35 + (_64bit*(1-sys.GoosWindows)*(1-sys.GoosDarwin*sys.GoarchArm64))*39 + sys.GoosDarwin*sys.GoarchArm64*31 + (1-_64bit)*32 + _MHeapMap_Bits = _MHeapMap_TotalBits - _PageShift + + _MaxMem = uintptr(1<<_MHeapMap_TotalBits - 1) + + _MaxGcproc = 32 +) + +const _MaxArena32 = 1<<32 - 1 + +type persistentAlloc struct { + base unsafe.Pointer + off uintptr +} diff --git a/hack/go1_7_3/runtime/mbitmap.go b/hack/go1_7_3/runtime/mbitmap.go new file mode 100644 index 0000000..8440b69 --- /dev/null +++ b/hack/go1_7_3/runtime/mbitmap.go @@ -0,0 +1,110 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Garbage collector: type and heap bitmaps. +// +// Stack, data, and bss bitmaps +// +// Stack frames and global variables in the data and bss sections are described +// by 1-bit bitmaps in which 0 means uninteresting and 1 means live pointer +// to be visited during GC. The bits in each byte are consumed starting with +// the low bit: 1<<0, 1<<1, and so on. +// +// Heap bitmap +// +// The allocated heap comes from a subset of the memory in the range [start, used), +// where start == mheap_.arena_start and used == mheap_.arena_used. +// The heap bitmap comprises 2 bits for each pointer-sized word in that range, +// stored in bytes indexed backward in memory from start. +// That is, the byte at address start-1 holds the 2-bit entries for the four words +// start through start+3*ptrSize, the byte at start-2 holds the entries for +// start+4*ptrSize through start+7*ptrSize, and so on. +// +// In each 2-bit entry, the lower bit holds the same information as in the 1-bit +// bitmaps: 0 means uninteresting and 1 means live pointer to be visited during GC. +// The meaning of the high bit depends on the position of the word being described +// in its allocated object. In all words *except* the second word, the +// high bit indicates that the object is still being described. In +// these words, if a bit pair with a high bit 0 is encountered, the +// low bit can also be assumed to be 0, and the object description is +// over. This 00 is called the ``dead'' encoding: it signals that the +// rest of the words in the object are uninteresting to the garbage +// collector. +// +// In the second word, the high bit is the GC ``checkmarked'' bit (see below). +// +// The 2-bit entries are split when written into the byte, so that the top half +// of the byte contains 4 high bits and the bottom half contains 4 low (pointer) +// bits. +// This form allows a copy from the 1-bit to the 4-bit form to keep the +// pointer bits contiguous, instead of having to space them out. +// +// The code makes use of the fact that the zero value for a heap bitmap +// has no live pointer bit set and is (depending on position), not used, +// not checkmarked, and is the dead encoding. +// These properties must be preserved when modifying the encoding. +// +// Checkmarks +// +// In a concurrent garbage collector, one worries about failing to mark +// a live object due to mutations without write barriers or bugs in the +// collector implementation. As a sanity check, the GC has a 'checkmark' +// mode that retraverses the object graph with the world stopped, to make +// sure that everything that should be marked is marked. +// In checkmark mode, in the heap bitmap, the high bit of the 2-bit entry +// for the second word of the object holds the checkmark bit. +// When not in checkmark mode, this bit is set to 1. +// +// The smallest possible allocation is 8 bytes. On a 32-bit machine, that +// means every allocated object has two words, so there is room for the +// checkmark bit. On a 64-bit machine, however, the 8-byte allocation is +// just one word, so the second bit pair is not available for encoding the +// checkmark. However, because non-pointer allocations are combined +// into larger 16-byte (maxTinySize) allocations, a plain 8-byte allocation +// must be a pointer, so the type bit in the first word is not actually needed. +// It is still used in general, except in checkmark the type bit is repurposed +// as the checkmark bit and then reinitialized (to 1) as the type bit when +// finished. +// + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_3/runtime/internal/sys" +) + +const ( + bitPointer = 1 << 0 + bitMarked = 1 << 4 + + heapBitsShift = 1 + heapBitmapScale = sys.PtrSize * (8 / 2) + + bitMarkedAll = bitMarked | bitMarked<nonempty) +// and those that are completely allocated (c->empty). + +package runtime + +// Central list of free objects of a given size. +type mcentral struct { + lock mutex + sizeclass int32 + nonempty mSpanList + empty mSpanList +} diff --git a/hack/go1_7_3/runtime/mem_bsd.go b/hack/go1_7_3/runtime/mem_bsd.go new file mode 100644 index 0000000..866387a --- /dev/null +++ b/hack/go1_7_3/runtime/mem_bsd.go @@ -0,0 +1,9 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build dragonfly freebsd nacl netbsd openbsd solaris + +package runtime + +const _ENOMEM = 12 diff --git a/hack/go1_7_3/runtime/mem_darwin.go b/hack/go1_7_3/runtime/mem_darwin.go new file mode 100644 index 0000000..3f513c7 --- /dev/null +++ b/hack/go1_7_3/runtime/mem_darwin.go @@ -0,0 +1,9 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _ENOMEM = 12 +) diff --git a/hack/go1_7_3/runtime/mem_linux.go b/hack/go1_7_3/runtime/mem_linux.go new file mode 100644 index 0000000..12fc226 --- /dev/null +++ b/hack/go1_7_3/runtime/mem_linux.go @@ -0,0 +1,10 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _EACCES = 13 + _EINVAL = 22 +) diff --git a/hack/go1_7_3/runtime/mem_plan9.go b/hack/go1_7_3/runtime/mem_plan9.go new file mode 100644 index 0000000..cc782e0 --- /dev/null +++ b/hack/go1_7_3/runtime/mem_plan9.go @@ -0,0 +1,14 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const memDebug = false + +type memHdr struct { + next memHdrPtr + size uintptr +} + +type memHdrPtr uintptr diff --git a/hack/go1_7_3/runtime/mem_windows.go b/hack/go1_7_3/runtime/mem_windows.go new file mode 100644 index 0000000..62d3461 --- /dev/null +++ b/hack/go1_7_3/runtime/mem_windows.go @@ -0,0 +1,15 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _MEM_COMMIT = 0x1000 + _MEM_RESERVE = 0x2000 + _MEM_DECOMMIT = 0x4000 + _MEM_RELEASE = 0x8000 + + _PAGE_READWRITE = 0x0004 + _PAGE_NOACCESS = 0x0001 +) diff --git a/hack/go1_7_3/runtime/mfinal.go b/hack/go1_7_3/runtime/mfinal.go new file mode 100644 index 0000000..855ba14 --- /dev/null +++ b/hack/go1_7_3/runtime/mfinal.go @@ -0,0 +1,29 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Garbage collector: finalizers and block profiling. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_3/runtime/internal/sys" + "unsafe" +) + +type finblock struct { + alllink *finblock + next *finblock + cnt int32 + _ int32 + fin [(_FinBlockSize - 2*sys.PtrSize - 2*4) / unsafe.Sizeof(finalizer{})]finalizer +} + +// NOTE: Layout known to queuefinalizer. +type finalizer struct { + fn *funcval + arg unsafe.Pointer + nret uintptr + fint *_type + ot *ptrtype +} diff --git a/hack/go1_7_3/runtime/mfixalloc.go b/hack/go1_7_3/runtime/mfixalloc.go new file mode 100644 index 0000000..211a124 --- /dev/null +++ b/hack/go1_7_3/runtime/mfixalloc.go @@ -0,0 +1,39 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Fixed-size object allocator. Returned memory is not zeroed. +// +// See malloc.go for overview. + +package runtime + +import "unsafe" + +// FixAlloc is a simple free-list allocator for fixed size objects. +// Malloc uses a FixAlloc wrapped around sysAlloc to manages its +// MCache and MSpan objects. +// +// Memory returned by FixAlloc_Alloc is not zeroed. +// The caller is responsible for locking around FixAlloc calls. +// Callers can keep state in the object but the first word is +// smashed by freeing and reallocating. +type fixalloc struct { + size uintptr + first func(arg, p unsafe.Pointer) + arg unsafe.Pointer + list *mlink + chunk unsafe.Pointer + nchunk uint32 + inuse uintptr + stat *uint64 +} + +// A generic linked list of blocks. (Typically the block is bigger than sizeof(MLink).) +// Since assignments to mlink.next will result in a write barrier being performed +// this cannot be used by some of the internal GC structures. For example when +// the sweeper is placing an unmarked object on the free list it does not want the +// write barrier to be called since that could result in the object being reachable. +type mlink struct { + next *mlink +} diff --git a/hack/go1_7_3/runtime/mgc.go b/hack/go1_7_3/runtime/mgc.go new file mode 100644 index 0000000..844f19b --- /dev/null +++ b/hack/go1_7_3/runtime/mgc.go @@ -0,0 +1,227 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// TODO(rsc): The code having to do with the heap bitmap needs very serious cleanup. +// It has gotten completely out of control. + +// Garbage collector (GC). +// +// The GC runs concurrently with mutator threads, is type accurate (aka precise), allows multiple +// GC thread to run in parallel. It is a concurrent mark and sweep that uses a write barrier. It is +// non-generational and non-compacting. Allocation is done using size segregated per P allocation +// areas to minimize fragmentation while eliminating locks in the common case. +// +// The algorithm decomposes into several steps. +// This is a high level description of the algorithm being used. For an overview of GC a good +// place to start is Richard Jones' gchandbook.org. +// +// The algorithm's intellectual heritage includes Dijkstra's on-the-fly algorithm, see +// Edsger W. Dijkstra, Leslie Lamport, A. J. Martin, C. S. Scholten, and E. F. M. Steffens. 1978. +// On-the-fly garbage collection: an exercise in cooperation. Commun. ACM 21, 11 (November 1978), +// 966-975. +// For journal quality proofs that these steps are complete, correct, and terminate see +// Hudson, R., and Moss, J.E.B. Copying Garbage Collection without stopping the world. +// Concurrency and Computation: Practice and Experience 15(3-5), 2003. +// +// TODO(austin): The rest of this comment is woefully out of date and +// needs to be rewritten. There is no distinct scan phase any more and +// we allocate black during GC. +// +// 0. Set phase = GCscan from GCoff. +// 1. Wait for all P's to acknowledge phase change. +// At this point all goroutines have passed through a GC safepoint and +// know we are in the GCscan phase. +// 2. GC scans all goroutine stacks, mark and enqueues all encountered pointers +// (marking avoids most duplicate enqueuing but races may produce benign duplication). +// Preempted goroutines are scanned before P schedules next goroutine. +// 3. Set phase = GCmark. +// 4. Wait for all P's to acknowledge phase change. +// 5. Now write barrier marks and enqueues black, grey, or white to white pointers. +// Malloc still allocates white (non-marked) objects. +// 6. Meanwhile GC transitively walks the heap marking reachable objects. +// 7. When GC finishes marking heap, it preempts P's one-by-one and +// retakes partial wbufs (filled by write barrier or during a stack scan of the goroutine +// currently scheduled on the P). +// 8. Once the GC has exhausted all available marking work it sets phase = marktermination. +// 9. Wait for all P's to acknowledge phase change. +// 10. Malloc now allocates black objects, so number of unmarked reachable objects +// monotonically decreases. +// 11. GC preempts P's one-by-one taking partial wbufs and marks all unmarked yet +// reachable objects. +// 12. When GC completes a full cycle over P's and discovers no new grey +// objects, (which means all reachable objects are marked) set phase = GCoff. +// 13. Wait for all P's to acknowledge phase change. +// 14. Now malloc allocates white (but sweeps spans before use). +// Write barrier becomes nop. +// 15. GC does background sweeping, see description below. +// 16. When sufficient allocation has taken place replay the sequence starting at 0 above, +// see discussion of GC rate below. + +// Changing phases. +// Phases are changed by setting the gcphase to the next phase and possibly calling ackgcphase. +// All phase action must be benign in the presence of a change. +// Starting with GCoff +// GCoff to GCscan +// GSscan scans stacks and globals greying them and never marks an object black. +// Once all the P's are aware of the new phase they will scan gs on preemption. +// This means that the scanning of preempted gs can't start until all the Ps +// have acknowledged. +// When a stack is scanned, this phase also installs stack barriers to +// track how much of the stack has been active. +// This transition enables write barriers because stack barriers +// assume that writes to higher frames will be tracked by write +// barriers. Technically this only needs write barriers for writes +// to stack slots, but we enable write barriers in general. +// GCscan to GCmark +// In GCmark, work buffers are drained until there are no more +// pointers to scan. +// No scanning of objects (making them black) can happen until all +// Ps have enabled the write barrier, but that already happened in +// the transition to GCscan. +// GCmark to GCmarktermination +// The only change here is that we start allocating black so the Ps must acknowledge +// the change before we begin the termination algorithm +// GCmarktermination to GSsweep +// Object currently on the freelist must be marked black for this to work. +// Are things on the free lists black or white? How does the sweep phase work? + +// Concurrent sweep. +// +// The sweep phase proceeds concurrently with normal program execution. +// The heap is swept span-by-span both lazily (when a goroutine needs another span) +// and concurrently in a background goroutine (this helps programs that are not CPU bound). +// At the end of STW mark termination all spans are marked as "needs sweeping". +// +// The background sweeper goroutine simply sweeps spans one-by-one. +// +// To avoid requesting more OS memory while there are unswept spans, when a +// goroutine needs another span, it first attempts to reclaim that much memory +// by sweeping. When a goroutine needs to allocate a new small-object span, it +// sweeps small-object spans for the same object size until it frees at least +// one object. When a goroutine needs to allocate large-object span from heap, +// it sweeps spans until it frees at least that many pages into heap. There is +// one case where this may not suffice: if a goroutine sweeps and frees two +// nonadjacent one-page spans to the heap, it will allocate a new two-page +// span, but there can still be other one-page unswept spans which could be +// combined into a two-page span. +// +// It's critical to ensure that no operations proceed on unswept spans (that would corrupt +// mark bits in GC bitmap). During GC all mcaches are flushed into the central cache, +// so they are empty. When a goroutine grabs a new span into mcache, it sweeps it. +// When a goroutine explicitly frees an object or sets a finalizer, it ensures that +// the span is swept (either by sweeping it, or by waiting for the concurrent sweep to finish). +// The finalizer goroutine is kicked off only when all spans are swept. +// When the next GC starts, it sweeps all not-yet-swept spans (if any). + +// GC rate. +// Next GC is after we've allocated an extra amount of memory proportional to +// the amount already in use. The proportion is controlled by GOGC environment variable +// (100 by default). If GOGC=100 and we're using 4M, we'll GC again when we get to 8M +// (this mark is tracked in next_gc variable). This keeps the GC cost in linear +// proportion to the allocation cost. Adjusting GOGC just changes the linear constant +// (and also the amount of extra memory used). + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_3/runtime/internal/sys" +) + +const ( + _DebugGC = 0 + _ConcurrentSweep = true + _FinBlockSize = 4 * 1024 + + sweepMinHeapDistance = 1024 * 1024 +) + +// defaultHeapMinimum is the value of heapminimum for GOGC==100. +const defaultHeapMinimum = 4 << 20 + +const ( + _GCoff = iota + _GCmark + _GCmarktermination +) + +// gcMarkWorkerMode represents the mode that a concurrent mark worker +// should operate in. +// +// Concurrent marking happens through four different mechanisms. One +// is mutator assists, which happen in response to allocations and are +// not scheduled. The other three are variations in the per-P mark +// workers and are distinguished by gcMarkWorkerMode. +type gcMarkWorkerMode int + +const ( + gcMarkWorkerDedicatedMode gcMarkWorkerMode = iota + + gcMarkWorkerFractionalMode + + gcMarkWorkerIdleMode +) + +type gcControllerState struct { + scanWork int64 + + bgScanCredit int64 + + assistTime int64 + + dedicatedMarkTime int64 + + fractionalMarkTime int64 + + idleMarkTime int64 + + markStartTime int64 + + heapGoal uint64 + + dedicatedMarkWorkersNeeded int64 + + assistWorkPerByte float64 + + assistBytesPerWork float64 + + fractionalUtilizationGoal float64 + + triggerRatio float64 + + _ [sys.CacheLineSize]byte + + fractionalMarkWorkersNeeded int64 + + _ [sys.CacheLineSize]byte +} + +// gcGoalUtilization is the goal CPU utilization for background +// marking as a fraction of GOMAXPROCS. +const gcGoalUtilization = 0.25 + +// gcCreditSlack is the amount of scan work credit that can can +// accumulate locally before updating gcController.scanWork and, +// optionally, gcController.bgScanCredit. Lower values give a more +// accurate assist ratio and make it more likely that assists will +// successfully steal background credit. Higher values reduce memory +// contention. +const gcCreditSlack = 2000 + +// gcAssistTimeSlack is the nanoseconds of mutator assist time that +// can accumulate on a P before updating gcController.assistTime. +const gcAssistTimeSlack = 5000 + +// gcOverAssistWork determines how many extra units of scan work a GC +// assist does when an assist happens. This amortizes the cost of an +// assist by pre-paying for this many bytes of future allocations. +const gcOverAssistWork = 64 << 10 + +// gcMode indicates how concurrent a GC cycle should be. +type gcMode int + +const ( + gcBackgroundMode gcMode = iota + gcForceMode + gcForceBlockMode +) diff --git a/hack/go1_7_3/runtime/mgcmark.go b/hack/go1_7_3/runtime/mgcmark.go new file mode 100644 index 0000000..882dd96 --- /dev/null +++ b/hack/go1_7_3/runtime/mgcmark.go @@ -0,0 +1,28 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Garbage collector: marking and scanning + +package runtime + +const ( + fixedRootFinalizers = iota + fixedRootFlushCaches + fixedRootFreeGStacks + fixedRootCount + + rootBlockBytes = 256 << 10 + + rootBlockSpans = 8 * 1024 +) + +type gcDrainFlags int + +const ( + gcDrainUntilPreempt gcDrainFlags = 1 << iota + gcDrainNoBlock + gcDrainFlushBgCredit + + gcDrainBlock gcDrainFlags = 0 +) diff --git a/hack/go1_7_3/runtime/mgcsweep.go b/hack/go1_7_3/runtime/mgcsweep.go new file mode 100644 index 0000000..a047137 --- /dev/null +++ b/hack/go1_7_3/runtime/mgcsweep.go @@ -0,0 +1,20 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Garbage collector: sweeping + +package runtime + +// State of background sweep. +type sweepdata struct { + lock mutex + g *g + parked bool + started bool + + spanidx uint32 + + nbgsweep uint32 + npausesweep uint32 +} diff --git a/hack/go1_7_3/runtime/mgcwork.go b/hack/go1_7_3/runtime/mgcwork.go new file mode 100644 index 0000000..8f4f4f7 --- /dev/null +++ b/hack/go1_7_3/runtime/mgcwork.go @@ -0,0 +1,54 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_3/runtime/internal/sys" + "unsafe" +) + +const ( + _WorkbufSize = 2048 +) + +// A wbufptr holds a workbuf*, but protects it from write barriers. +// workbufs never live on the heap, so write barriers are unnecessary. +// Write barriers on workbuf pointers may also be dangerous in the GC. +type wbufptr uintptr + +// A gcWork provides the interface to produce and consume work for the +// garbage collector. +// +// A gcWork can be used on the stack as follows: +// +// (preemption must be disabled) +// gcw := &getg().m.p.ptr().gcw +// .. call gcw.put() to produce and gcw.get() to consume .. +// if gcBlackenPromptly { +// gcw.dispose() +// } +// +// It's important that any use of gcWork during the mark phase prevent +// the garbage collector from transitioning to mark termination since +// gcWork may locally hold GC work buffers. This can be done by +// disabling preemption (systemstack or acquirem). +type gcWork struct { + wbuf1, wbuf2 wbufptr + + bytesMarked uint64 + + scanWork int64 +} + +type workbufhdr struct { + node lfnode + nobj int +} + +type workbuf struct { + workbufhdr + + obj [(_WorkbufSize - unsafe.Sizeof(workbufhdr{})) / sys.PtrSize]uintptr +} diff --git a/hack/go1_7_3/runtime/mheap.go b/hack/go1_7_3/runtime/mheap.go new file mode 100644 index 0000000..88fa4f3 --- /dev/null +++ b/hack/go1_7_3/runtime/mheap.go @@ -0,0 +1,170 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Page heap. +// +// See malloc.go for overview. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_3/runtime/internal/sys" + "unsafe" +) + +// minPhysPageSize is a lower-bound on the physical page size. The +// true physical page size may be larger than this. In contrast, +// sys.PhysPageSize is an upper-bound on the physical page size. +const minPhysPageSize = 4096 + +// Main malloc heap. +// The heap itself is the "free[]" and "large" arrays, +// but all the other global data is here too. +type mheap struct { + lock mutex + free [_MaxMHeapList]mSpanList + freelarge mSpanList + busy [_MaxMHeapList]mSpanList + busylarge mSpanList + allspans **mspan + gcspans **mspan + nspan uint32 + sweepgen uint32 + sweepdone uint32 + + spans **mspan + spans_mapped uintptr + + pagesInUse uint64 + spanBytesAlloc uint64 + pagesSwept uint64 + sweepPagesPerByte float64 + + largefree uint64 + nlargefree uint64 + nsmallfree [_NumSizeClasses]uint64 + + bitmap uintptr + bitmap_mapped uintptr + arena_start uintptr + arena_used uintptr + arena_end uintptr + arena_reserved bool + + central [_NumSizeClasses]struct { + mcentral mcentral + pad [sys.CacheLineSize]byte + } + + spanalloc fixalloc + cachealloc fixalloc + specialfinalizeralloc fixalloc + specialprofilealloc fixalloc + speciallock mutex +} + +// An MSpan representing actual memory has state _MSpanInUse, +// _MSpanStack, or _MSpanFree. Transitions between these states are +// constrained as follows: +// +// * A span may transition from free to in-use or stack during any GC +// phase. +// +// * During sweeping (gcphase == _GCoff), a span may transition from +// in-use to free (as a result of sweeping) or stack to free (as a +// result of stacks being freed). +// +// * During GC (gcphase != _GCoff), a span *must not* transition from +// stack or in-use to free. Because concurrent GC may read a pointer +// and then look up its span, the span state must be monotonic. +const ( + _MSpanInUse = iota + _MSpanStack + _MSpanFree + _MSpanDead +) + +// mSpanList heads a linked list of spans. +// +// Linked list structure is based on BSD's "tail queue" data structure. +type mSpanList struct { + first *mspan + last **mspan +} + +type mspan struct { + next *mspan + prev **mspan + list *mSpanList + + startAddr uintptr + npages uintptr + stackfreelist gclinkptr + + freeindex uintptr + + nelems uintptr + + allocCache uint64 + + allocBits *uint8 + gcmarkBits *uint8 + + sweepgen uint32 + divMul uint32 + allocCount uint16 + sizeclass uint8 + incache bool + state uint8 + needzero uint8 + divShift uint8 + divShift2 uint8 + elemsize uintptr + unusedsince int64 + npreleased uintptr + limit uintptr + speciallock mutex + specials *special + baseMask uintptr +} + +const ( + _KindSpecialFinalizer = 1 + _KindSpecialProfile = 2 +) + +type special struct { + next *special + offset uint16 + kind byte +} + +// The described object has a finalizer set for it. +type specialfinalizer struct { + special special + fn *funcval + nret uintptr + fint *_type + ot *ptrtype +} + +// The described object is being heap profiled. +type specialprofile struct { + special special + b *bucket +} + +const gcBitsChunkBytes = uintptr(64 << 10) +const gcBitsHeaderBytes = unsafe.Sizeof(gcBitsHeader{}) + +type gcBitsHeader struct { + free uintptr + next uintptr +} + +type gcBits struct { + free uintptr + next *gcBits + bits [gcBitsChunkBytes - gcBitsHeaderBytes]uint8 +} diff --git a/hack/go1_7_3/runtime/mprof.go b/hack/go1_7_3/runtime/mprof.go new file mode 100644 index 0000000..5ed72c0 --- /dev/null +++ b/hack/go1_7_3/runtime/mprof.go @@ -0,0 +1,83 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Malloc profiling. +// Patterned after tcmalloc's algorithms; shorter code. + +package runtime + +const ( + memProfile bucketType = 1 + iota + blockProfile + + buckHashSize = 179999 + + maxStack = 32 +) + +type bucketType int + +// A bucket holds per-call-stack profiling information. +// The representation is a bit sleazy, inherited from C. +// This struct defines the bucket header. It is followed in +// memory by the stack words and then the actual record +// data, either a memRecord or a blockRecord. +// +// Per-call-stack profiling information. +// Lookup by hashing call stack into a linked-list hash table. +type bucket struct { + next *bucket + allnext *bucket + typ bucketType + hash uintptr + size uintptr + nstk uintptr +} + +// A memRecord is the bucket data for a bucket of type memProfile, +// part of the memory profile. +type memRecord struct { + allocs uintptr + frees uintptr + alloc_bytes uintptr + free_bytes uintptr + + prev_allocs uintptr + prev_frees uintptr + prev_alloc_bytes uintptr + prev_free_bytes uintptr + + recent_allocs uintptr + recent_frees uintptr + recent_alloc_bytes uintptr + recent_free_bytes uintptr +} + +// A blockRecord is the bucket data for a bucket of type blockProfile, +// part of the blocking profile. +type blockRecord struct { + count int64 + cycles int64 +} + +// A StackRecord describes a single execution stack. +type StackRecord struct { + Stack0 [32]uintptr +} + +// A MemProfileRecord describes the live objects allocated +// by a particular call sequence (stack trace). +type MemProfileRecord struct { + AllocBytes, FreeBytes int64 + AllocObjects, FreeObjects int64 + Stack0 [32]uintptr +} + +// BlockProfileRecord describes blocking events originated +// at a particular call sequence (stack trace). +type BlockProfileRecord struct { + Count int64 + Cycles int64 + StackRecord +} diff --git a/hack/go1_7_3/runtime/msan.go b/hack/go1_7_3/runtime/msan.go new file mode 100644 index 0000000..4e84b2d --- /dev/null +++ b/hack/go1_7_3/runtime/msan.go @@ -0,0 +1,10 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build msan + +package runtime + +// Private interface for the runtime. +const msanenabled = true diff --git a/hack/go1_7_3/runtime/msan0.go b/hack/go1_7_3/runtime/msan0.go new file mode 100644 index 0000000..8f1516d --- /dev/null +++ b/hack/go1_7_3/runtime/msan0.go @@ -0,0 +1,11 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !msan + +// Dummy MSan support API, used when not built with -msan. + +package runtime + +const msanenabled = false diff --git a/hack/go1_7_3/runtime/msize.go b/hack/go1_7_3/runtime/msize.go new file mode 100644 index 0000000..80765e0 --- /dev/null +++ b/hack/go1_7_3/runtime/msize.go @@ -0,0 +1,59 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Malloc small size classes. +// +// See malloc.go for overview. +// +// The size classes are chosen so that rounding an allocation +// request up to the next size class wastes at most 12.5% (1.125x). +// +// Each size class has its own page count that gets allocated +// and chopped up when new objects of the size class are needed. +// That page count is chosen so that chopping up the run of +// pages into objects of the given size wastes at most 12.5% (1.125x) +// of the memory. It is not necessary that the cutoff here be +// the same as above. +// +// The two sources of waste multiply, so the worst possible case +// for the above constraints would be that allocations of some +// size might have a 26.6% (1.266x) overhead. +// In practice, only one of the wastes comes into play for a +// given size (sizes < 512 waste mainly on the round-up, +// sizes > 512 waste mainly on the page chopping). +// +// TODO(rsc): Compute max waste for any given size. + +package runtime + +// divMagic holds magic constants to implement division +// by a particular constant as a shift, multiply, and shift. +// That is, given +// m = computeMagic(d) +// then +// n/d == ((n>>m.shift) * m.mul) >> m.shift2 +// +// The magic computation picks m such that +// d = d₁*d₂ +// d₂= 2^m.shift +// m.mul = ⌈2^m.shift2 / d₁⌉ +// +// The magic computation here is tailored for malloc block sizes +// and does not handle arbitrary d correctly. Malloc block sizes d are +// always even, so the first shift implements the factors of 2 in d +// and then the mul and second shift implement the odd factor +// that remains. Because the first shift divides n by at least 2 (actually 8) +// before the multiply gets involved, the huge corner cases that +// require additional adjustment are impossible, so the usual +// fixup is not needed. +// +// For more details see Hacker's Delight, Chapter 10, and +// http://ridiculousfish.com/blog/posts/labor-of-division-episode-i.html +// http://ridiculousfish.com/blog/posts/labor-of-division-episode-iii.html +type divMagic struct { + shift uint8 + mul uint32 + shift2 uint8 + baseMask uintptr +} diff --git a/hack/go1_7_3/runtime/mstats.go b/hack/go1_7_3/runtime/mstats.go new file mode 100644 index 0000000..8b92974 --- /dev/null +++ b/hack/go1_7_3/runtime/mstats.go @@ -0,0 +1,104 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Memory statistics + +package runtime + +// Statistics. +// If you edit this structure, also edit type MemStats below. +type mstats struct { + alloc uint64 + total_alloc uint64 + sys uint64 + nlookup uint64 + nmalloc uint64 + nfree uint64 + + heap_alloc uint64 + heap_sys uint64 + heap_idle uint64 + heap_inuse uint64 + heap_released uint64 + heap_objects uint64 + + stacks_inuse uint64 + stacks_sys uint64 + mspan_inuse uint64 + mspan_sys uint64 + mcache_inuse uint64 + mcache_sys uint64 + buckhash_sys uint64 + gc_sys uint64 + other_sys uint64 + + next_gc uint64 + last_gc uint64 + pause_total_ns uint64 + pause_ns [256]uint64 + pause_end [256]uint64 + numgc uint32 + gc_cpu_fraction float64 + enablegc bool + debuggc bool + + by_size [_NumSizeClasses]struct { + size uint32 + nmalloc uint64 + nfree uint64 + } + + tinyallocs uint64 + + heap_live uint64 + + heap_scan uint64 + + heap_marked uint64 + + heap_reachable uint64 +} + +// A MemStats records statistics about the memory allocator. +type MemStats struct { + Alloc uint64 + TotalAlloc uint64 + Sys uint64 + Lookups uint64 + Mallocs uint64 + Frees uint64 + + HeapAlloc uint64 + HeapSys uint64 + HeapIdle uint64 + HeapInuse uint64 + HeapReleased uint64 + HeapObjects uint64 + + StackInuse uint64 + StackSys uint64 + MSpanInuse uint64 + MSpanSys uint64 + MCacheInuse uint64 + MCacheSys uint64 + BuckHashSys uint64 + GCSys uint64 + OtherSys uint64 + + NextGC uint64 + LastGC uint64 + PauseTotalNs uint64 + PauseNs [256]uint64 + PauseEnd [256]uint64 + NumGC uint32 + GCCPUFraction float64 + EnableGC bool + DebugGC bool + + BySize [61]struct { + Size uint32 + Mallocs uint64 + Frees uint64 + } +} diff --git a/hack/go1_7_3/runtime/mstkbar.go b/hack/go1_7_3/runtime/mstkbar.go new file mode 100644 index 0000000..425ce60 --- /dev/null +++ b/hack/go1_7_3/runtime/mstkbar.go @@ -0,0 +1,128 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Garbage collector: stack barriers +// +// Stack barriers enable the garbage collector to determine how much +// of a gorountine stack has changed between when a stack is scanned +// during the concurrent scan phase and when it is re-scanned during +// the stop-the-world mark termination phase. Mark termination only +// needs to re-scan the changed part, so for deep stacks this can +// significantly reduce GC pause time compared to the alternative of +// re-scanning whole stacks. The deeper the stacks, the more stack +// barriers help. +// +// When stacks are scanned during the concurrent scan phase, the stack +// scan installs stack barriers by selecting stack frames and +// overwriting the saved return PCs (or link registers) of these +// frames with the PC of a "stack barrier trampoline". Later, when a +// selected frame returns, it "returns" to this trampoline instead of +// returning to its actual caller. The trampoline records that the +// stack has unwound past this frame and jumps to the original return +// PC recorded when the stack barrier was installed. Mark termination +// re-scans only as far as the first frame that hasn't hit a stack +// barrier and then removes and un-hit stack barriers. +// +// This scheme is very lightweight. No special code is required in the +// mutator to record stack unwinding and the trampoline is only a few +// assembly instructions. +// +// Book-keeping +// ------------ +// +// The primary cost of stack barriers is book-keeping: the runtime has +// to record the locations of all stack barriers and the original +// return PCs in order to return to the correct caller when a stack +// barrier is hit and so it can remove un-hit stack barriers. In order +// to minimize this cost, the Go runtime places stack barriers in +// exponentially-spaced frames, starting 1K past the current frame. +// The book-keeping structure hence grows logarithmically with the +// size of the stack and mark termination re-scans at most twice as +// much stack as necessary. +// +// The runtime reserves space for this book-keeping structure at the +// top of the stack allocation itself (just above the outermost +// frame). This is necessary because the regular memory allocator can +// itself grow the stack, and hence can't be used when allocating +// stack-related structures. +// +// For debugging, the runtime also supports installing stack barriers +// at every frame. However, this requires significantly more +// book-keeping space. +// +// Correctness +// ----------- +// +// The runtime and the compiler cooperate to ensure that all objects +// reachable from the stack as of mark termination are marked. +// Anything unchanged since the concurrent scan phase will be marked +// because it is marked by the concurrent scan. After the concurrent +// scan, there are three possible classes of stack modifications that +// must be tracked: +// +// 1) Mutator writes below the lowest un-hit stack barrier. This +// includes all writes performed by an executing function to its own +// stack frame. This part of the stack will be re-scanned by mark +// termination, which will mark any objects made reachable from +// modifications to this part of the stack. +// +// 2) Mutator writes above the lowest un-hit stack barrier. It's +// possible for a mutator to modify the stack above the lowest un-hit +// stack barrier if a higher frame has passed down a pointer to a +// stack variable in its frame. This is called an "up-pointer". The +// compiler ensures that writes through up-pointers have an +// accompanying write barrier (it simply doesn't distinguish between +// writes through up-pointers and writes through heap pointers). This +// write barrier marks any object made reachable from modifications to +// this part of the stack. +// +// 3) Runtime writes to the stack. Various runtime operations such as +// sends to unbuffered channels can write to arbitrary parts of the +// stack, including above the lowest un-hit stack barrier. We solve +// this in two ways. In many cases, the runtime can perform an +// explicit write barrier operation like in case 2. However, in the +// case of bulk memory move (typedmemmove), the runtime doesn't +// necessary have ready access to a pointer bitmap for the memory +// being copied, so it simply unwinds any stack barriers below the +// destination. +// +// Gotchas +// ------- +// +// Anything that inspects or manipulates the stack potentially needs +// to understand stack barriers. The most obvious case is that +// gentraceback needs to use the original return PC when it encounters +// the stack barrier trampoline. Anything that unwinds the stack such +// as panic/recover must unwind stack barriers in tandem with +// unwinding the stack. +// +// Stack barriers require that any goroutine whose stack has been +// scanned must execute write barriers. Go solves this by simply +// enabling write barriers globally during the concurrent scan phase. +// However, traditionally, write barriers are not enabled during this +// phase. +// +// Synchronization +// --------------- +// +// For the most part, accessing and modifying stack barriers is +// synchronized around GC safe points. Installing stack barriers +// forces the G to a safe point, while all other operations that +// modify stack barriers run on the G and prevent it from reaching a +// safe point. +// +// Subtlety arises when a G may be tracebacked when *not* at a safe +// point. This happens during sigprof. For this, each G has a "stack +// barrier lock" (see gcLockStackBarriers, gcUnlockStackBarriers). +// Operations that manipulate stack barriers acquire this lock, while +// sigprof tries to acquire it and simply skips the traceback if it +// can't acquire it. There is one exception for performance and +// complexity reasons: hitting a stack barrier manipulates the stack +// barrier list without acquiring the stack barrier lock. For this, +// gentraceback performs a special fix up if the traceback starts in +// the stack barrier function. + +package runtime + +const debugStackBarrier = false diff --git a/hack/go1_7_3/runtime/netpoll.go b/hack/go1_7_3/runtime/netpoll.go new file mode 100644 index 0000000..fb5fa21 --- /dev/null +++ b/hack/go1_7_3/runtime/netpoll.go @@ -0,0 +1,48 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows + +package runtime + +// pollDesc contains 2 binary semaphores, rg and wg, to park reader and writer +// goroutines respectively. The semaphore can be in the following states: +// pdReady - io readiness notification is pending; +// a goroutine consumes the notification by changing the state to nil. +// pdWait - a goroutine prepares to park on the semaphore, but not yet parked; +// the goroutine commits to park by changing the state to G pointer, +// or, alternatively, concurrent io notification changes the state to READY, +// or, alternatively, concurrent timeout/close changes the state to nil. +// G pointer - the goroutine is blocked on the semaphore; +// io notification or timeout/close changes the state to READY or nil respectively +// and unparks the goroutine. +// nil - nothing of the above. +const ( + pdReady uintptr = 1 + pdWait uintptr = 2 +) + +const pollBlockSize = 4 * 1024 + +// Network poller descriptor. +type pollDesc struct { + link *pollDesc + + lock mutex + fd uintptr + closing bool + seq uintptr + rg uintptr + rt timer + rd int64 + wg uintptr + wt timer + wd int64 + user uint32 +} + +type pollCache struct { + lock mutex + first *pollDesc +} diff --git a/hack/go1_7_3/runtime/netpoll_windows.go b/hack/go1_7_3/runtime/netpoll_windows.go new file mode 100644 index 0000000..321d6d7 --- /dev/null +++ b/hack/go1_7_3/runtime/netpoll_windows.go @@ -0,0 +1,26 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const _DWORD_MAX = 0xffffffff + +const _INVALID_HANDLE_VALUE = ^uintptr(0) + +// net_op must be the same as beginning of net.operation. Keep these in sync. +type net_op struct { + o overlapped + + pd *pollDesc + mode int32 + errno int32 + qty uint32 +} + +type overlappedEntry struct { + key uintptr + op *net_op + internal uintptr + qty uint32 +} diff --git a/hack/go1_7_3/runtime/os2_freebsd.go b/hack/go1_7_3/runtime/os2_freebsd.go new file mode 100644 index 0000000..84ab715 --- /dev/null +++ b/hack/go1_7_3/runtime/os2_freebsd.go @@ -0,0 +1,15 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _SS_DISABLE = 4 + _NSIG = 33 + _SI_USER = 0x10001 + _RLIMIT_AS = 10 + _SIG_BLOCK = 1 + _SIG_UNBLOCK = 2 + _SIG_SETMASK = 3 +) diff --git a/hack/go1_7_3/runtime/os2_nacl.go b/hack/go1_7_3/runtime/os2_nacl.go new file mode 100644 index 0000000..48d8fea --- /dev/null +++ b/hack/go1_7_3/runtime/os2_nacl.go @@ -0,0 +1,149 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _NSIG = 32 + _SI_USER = 1 + + _EPERM = 1 + _ENOENT = 2 + _ESRCH = 3 + _EINTR = 4 + _EIO = 5 + _ENXIO = 6 + _E2BIG = 7 + _ENOEXEC = 8 + _EBADF = 9 + _ECHILD = 10 + _EAGAIN = 11 + + _EACCES = 13 + _EFAULT = 14 + _EBUSY = 16 + _EEXIST = 17 + _EXDEV = 18 + _ENODEV = 19 + _ENOTDIR = 20 + _EISDIR = 21 + _EINVAL = 22 + _ENFILE = 23 + _EMFILE = 24 + _ENOTTY = 25 + _EFBIG = 27 + _ENOSPC = 28 + _ESPIPE = 29 + _EROFS = 30 + _EMLINK = 31 + _EPIPE = 32 + _ENAMETOOLONG = 36 + _ENOSYS = 38 + _EDQUOT = 122 + _EDOM = 33 + _ERANGE = 34 + _EDEADLK = 35 + _ENOLCK = 37 + _ENOTEMPTY = 39 + _ELOOP = 40 + _ENOMSG = 42 + _EIDRM = 43 + _ECHRNG = 44 + _EL2NSYNC = 45 + _EL3HLT = 46 + _EL3RST = 47 + _ELNRNG = 48 + _EUNATCH = 49 + _ENOCSI = 50 + _EL2HLT = 51 + _EBADE = 52 + _EBADR = 53 + _EXFULL = 54 + _ENOANO = 55 + _EBADRQC = 56 + _EBADSLT = 57 + _EDEADLOCK = _EDEADLK + _EBFONT = 59 + _ENOSTR = 60 + _ENODATA = 61 + _ETIME = 62 + _ENOSR = 63 + _ENONET = 64 + _ENOPKG = 65 + _EREMOTE = 66 + _ENOLINK = 67 + _EADV = 68 + _ESRMNT = 69 + _ECOMM = 70 + _EPROTO = 71 + _EMULTIHOP = 72 + _EDOTDOT = 73 + _EBADMSG = 74 + _EOVERFLOW = 75 + _ENOTUNIQ = 76 + _EBADFD = 77 + _EREMCHG = 78 + _ELIBACC = 79 + _ELIBBAD = 80 + _ELIBSCN = 81 + _ELIBMAX = 82 + _ELIBEXEC = 83 + _EILSEQ = 84 + _EUSERS = 87 + _ENOTSOCK = 88 + _EDESTADDRREQ = 89 + _EMSGSIZE = 90 + _EPROTOTYPE = 91 + _ENOPROTOOPT = 92 + _EPROTONOSUPPORT = 93 + _ESOCKTNOSUPPORT = 94 + _EOPNOTSUPP = 95 + _EPFNOSUPPORT = 96 + _EAFNOSUPPORT = 97 + _EADDRINUSE = 98 + _EADDRNOTAVAIL = 99 + _ENETDOWN = 100 + _ENETUNREACH = 101 + _ENETRESET = 102 + _ECONNABORTED = 103 + _ECONNRESET = 104 + _ENOBUFS = 105 + _EISCONN = 106 + _ENOTCONN = 107 + _ESHUTDOWN = 108 + _ETOOMANYREFS = 109 + _ETIMEDOUT = 110 + _ECONNREFUSED = 111 + _EHOSTDOWN = 112 + _EHOSTUNREACH = 113 + _EALREADY = 114 + _EINPROGRESS = 115 + _ESTALE = 116 + _ENOTSUP = _EOPNOTSUPP + _ENOMEDIUM = 123 + _ECANCELED = 125 + _ELBIN = 2048 + _EFTYPE = 2049 + _ENMFILE = 2050 + _EPROCLIM = 2051 + _ENOSHARE = 2052 + _ECASECLASH = 2053 + _EWOULDBLOCK = _EAGAIN + + _PROT_NONE = 0x0 + _PROT_READ = 0x1 + _PROT_WRITE = 0x2 + _PROT_EXEC = 0x4 + + _MAP_SHARED = 0x1 + _MAP_PRIVATE = 0x2 + _MAP_FIXED = 0x10 + _MAP_ANON = 0x20 + + _MADV_FREE = 0 + _SIGFPE = 8 + _FPE_INTDIV = 0 +) + +type siginfo struct{} diff --git a/hack/go1_7_3/runtime/os2_openbsd.go b/hack/go1_7_3/runtime/os2_openbsd.go new file mode 100644 index 0000000..8656a91 --- /dev/null +++ b/hack/go1_7_3/runtime/os2_openbsd.go @@ -0,0 +1,14 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _SS_DISABLE = 4 + _SIG_BLOCK = 1 + _SIG_UNBLOCK = 2 + _SIG_SETMASK = 3 + _NSIG = 33 + _SI_USER = 0 +) diff --git a/hack/go1_7_3/runtime/os2_plan9.go b/hack/go1_7_3/runtime/os2_plan9.go new file mode 100644 index 0000000..5c4c05b --- /dev/null +++ b/hack/go1_7_3/runtime/os2_plan9.go @@ -0,0 +1,72 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Plan 9-specific system calls + +package runtime + +// open +const ( + _OREAD = 0 + _OWRITE = 1 + _ORDWR = 2 + _OEXEC = 3 + _OTRUNC = 16 + _OCEXEC = 32 + _ORCLOSE = 64 + _OEXCL = 0x1000 +) + +// rfork +const ( + _RFNAMEG = 1 << 0 + _RFENVG = 1 << 1 + _RFFDG = 1 << 2 + _RFNOTEG = 1 << 3 + _RFPROC = 1 << 4 + _RFMEM = 1 << 5 + _RFNOWAIT = 1 << 6 + _RFCNAMEG = 1 << 10 + _RFCENVG = 1 << 11 + _RFCFDG = 1 << 12 + _RFREND = 1 << 13 + _RFNOMNT = 1 << 14 +) + +// notify +const ( + _NCONT = 0 + _NDFLT = 1 +) + +type uinptr _Plink + +type tos struct { + prof struct { + pp *_Plink + next *_Plink + last *_Plink + first *_Plink + pid uint32 + what uint32 + } + cyclefreq uint64 + kcycles int64 + pcycles int64 + pid uint32 + clock uint32 +} + +const ( + _NSIG = 14 + _ERRMAX = 128 + + _SIGRFAULT = 2 + _SIGWFAULT = 3 + _SIGINTDIV = 4 + _SIGFLOAT = 5 + _SIGTRAP = 6 + _SIGPROF = 0 + _SIGQUIT = 0 +) diff --git a/hack/go1_7_3/runtime/os2_solaris.go b/hack/go1_7_3/runtime/os2_solaris.go new file mode 100644 index 0000000..385f515 --- /dev/null +++ b/hack/go1_7_3/runtime/os2_solaris.go @@ -0,0 +1,14 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _SS_DISABLE = 2 + _SIG_UNBLOCK = 2 + _SIG_SETMASK = 3 + _NSIG = 73 + _SI_USER = 0 + _RLIMIT_AS = 10 +) diff --git a/hack/go1_7_3/runtime/os_darwin.go b/hack/go1_7_3/runtime/os_darwin.go new file mode 100644 index 0000000..7c1b14e --- /dev/null +++ b/hack/go1_7_3/runtime/os_darwin.go @@ -0,0 +1,65 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type mOS struct { + machport uint32 + waitsema uint32 +} + +const _DebugMach = false + +// Mach RPC (MIG) +const ( + _MinMachMsg = 48 + _MachReply = 100 +) + +type codemsg struct { + h machheader + ndr machndr + code int32 +} + +const ( + tmach_semcreate = 3418 + rmach_semcreate = tmach_semcreate + _MachReply + + tmach_semdestroy = 3419 + rmach_semdestroy = tmach_semdestroy + _MachReply + + _KERN_ABORTED = 14 + _KERN_OPERATION_TIMED_OUT = 49 +) + +type tmach_semcreatemsg struct { + h machheader + ndr machndr + policy int32 + value int32 +} + +type rmach_semcreatemsg struct { + h machheader + body machbody + semaphore machport +} + +type tmach_semdestroymsg struct { + h machheader + body machbody + semaphore machport +} + +const ( + _NSIG = 32 + _SI_USER = 0 + _SIG_BLOCK = 1 + _SIG_UNBLOCK = 2 + _SIG_SETMASK = 3 + _SS_DISABLE = 4 +) + +type sigset uint32 diff --git a/hack/go1_7_3/runtime/os_dragonfly.go b/hack/go1_7_3/runtime/os_dragonfly.go new file mode 100644 index 0000000..597b932 --- /dev/null +++ b/hack/go1_7_3/runtime/os_dragonfly.go @@ -0,0 +1,31 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _NSIG = 33 + _SI_USER = 0 + _SS_DISABLE = 4 + _RLIMIT_AS = 10 + _SIG_BLOCK = 1 + _SIG_UNBLOCK = 2 + _SIG_SETMASK = 3 +) + +type mOS struct{} + +const stackSystem = 0 + +// From DragonFly's +const ( + _CTL_HW = 6 + _HW_NCPU = 3 +) + +type sigactiont struct { + sa_sigaction uintptr + sa_flags int32 + sa_mask sigset +} diff --git a/hack/go1_7_3/runtime/os_freebsd.go b/hack/go1_7_3/runtime/os_freebsd.go new file mode 100644 index 0000000..d7ffe22 --- /dev/null +++ b/hack/go1_7_3/runtime/os_freebsd.go @@ -0,0 +1,19 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type mOS struct{} + +// From FreeBSD's +const ( + _CTL_HW = 6 + _HW_NCPU = 3 +) + +type sigactiont struct { + sa_handler uintptr + sa_flags int32 + sa_mask sigset +} diff --git a/hack/go1_7_3/runtime/os_linux.go b/hack/go1_7_3/runtime/os_linux.go new file mode 100644 index 0000000..c890908 --- /dev/null +++ b/hack/go1_7_3/runtime/os_linux.go @@ -0,0 +1,46 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type mOS struct{} + +const ( + _FUTEX_WAIT = 0 + _FUTEX_WAKE = 1 +) + +// Clone, the Linux rfork. +const ( + _CLONE_VM = 0x100 + _CLONE_FS = 0x200 + _CLONE_FILES = 0x400 + _CLONE_SIGHAND = 0x800 + _CLONE_PTRACE = 0x2000 + _CLONE_VFORK = 0x4000 + _CLONE_PARENT = 0x8000 + _CLONE_THREAD = 0x10000 + _CLONE_NEWNS = 0x20000 + _CLONE_SYSVSEM = 0x40000 + _CLONE_SETTLS = 0x80000 + _CLONE_PARENT_SETTID = 0x100000 + _CLONE_CHILD_CLEARTID = 0x200000 + _CLONE_UNTRACED = 0x800000 + _CLONE_CHILD_SETTID = 0x1000000 + _CLONE_STOPPED = 0x2000000 + _CLONE_NEWUTS = 0x4000000 + _CLONE_NEWIPC = 0x8000000 + + cloneFlags = _CLONE_VM | + _CLONE_FS | + _CLONE_FILES | + _CLONE_SIGHAND | + _CLONE_THREAD +) + +const ( + _AT_NULL = 0 + _AT_PAGESZ = 6 + _AT_RANDOM = 25 +) diff --git a/hack/go1_7_3/runtime/os_linux_arm.go b/hack/go1_7_3/runtime/os_linux_arm.go new file mode 100644 index 0000000..db8e075 --- /dev/null +++ b/hack/go1_7_3/runtime/os_linux_arm.go @@ -0,0 +1,13 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _AT_PLATFORM = 15 + _AT_HWCAP = 16 + + _HWCAP_VFP = 1 << 6 + _HWCAP_VFPv3 = 1 << 13 +) diff --git a/hack/go1_7_3/runtime/os_linux_generic.go b/hack/go1_7_3/runtime/os_linux_generic.go new file mode 100644 index 0000000..f1a2dd5 --- /dev/null +++ b/hack/go1_7_3/runtime/os_linux_generic.go @@ -0,0 +1,30 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !mips64 +// +build !mips64le +// +build !s390x +// +build linux + +package runtime + +const ( + _SS_DISABLE = 2 + _NSIG = 65 + _SI_USER = 0 + _SIG_BLOCK = 0 + _SIG_UNBLOCK = 1 + _SIG_SETMASK = 2 + _RLIMIT_AS = 9 +) + +// It's hard to tease out exactly how big a Sigset is, but +// rt_sigprocmask crashes if we get it wrong, so if binaries +// are running, this is right. +type sigset [2]uint32 + +type rlimit struct { + rlim_cur uintptr + rlim_max uintptr +} diff --git a/hack/go1_7_3/runtime/os_linux_mips64x.go b/hack/go1_7_3/runtime/os_linux_mips64x.go new file mode 100644 index 0000000..9a6a92a --- /dev/null +++ b/hack/go1_7_3/runtime/os_linux_mips64x.go @@ -0,0 +1,25 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux +// +build mips64 mips64le + +package runtime + +const ( + _SS_DISABLE = 2 + _NSIG = 65 + _SI_USER = 0 + _SIG_BLOCK = 1 + _SIG_UNBLOCK = 2 + _SIG_SETMASK = 3 + _RLIMIT_AS = 6 +) + +type sigset [2]uint64 + +type rlimit struct { + rlim_cur uintptr + rlim_max uintptr +} diff --git a/hack/go1_7_3/runtime/os_linux_s390x.go b/hack/go1_7_3/runtime/os_linux_s390x.go new file mode 100644 index 0000000..d03b499 --- /dev/null +++ b/hack/go1_7_3/runtime/os_linux_s390x.go @@ -0,0 +1,22 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _SS_DISABLE = 2 + _NSIG = 65 + _SI_USER = 0 + _SIG_BLOCK = 0 + _SIG_UNBLOCK = 1 + _SIG_SETMASK = 2 + _RLIMIT_AS = 9 +) + +type sigset uint64 + +type rlimit struct { + rlim_cur uintptr + rlim_max uintptr +} diff --git a/hack/go1_7_3/runtime/os_nacl.go b/hack/go1_7_3/runtime/os_nacl.go new file mode 100644 index 0000000..92d7ecd --- /dev/null +++ b/hack/go1_7_3/runtime/os_nacl.go @@ -0,0 +1,13 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type mOS struct { + waitsema int32 + waitsemacount int32 + waitsemalock int32 +} + +type sigset struct{} diff --git a/hack/go1_7_3/runtime/os_netbsd.go b/hack/go1_7_3/runtime/os_netbsd.go new file mode 100644 index 0000000..5319426 --- /dev/null +++ b/hack/go1_7_3/runtime/os_netbsd.go @@ -0,0 +1,45 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _SS_DISABLE = 4 + _SIG_BLOCK = 1 + _SIG_UNBLOCK = 2 + _SIG_SETMASK = 3 + _NSIG = 33 + _SI_USER = 0 + + _UC_SIGMASK = 0x01 + _UC_CPU = 0x04 + + _EAGAIN = 35 +) + +type mOS struct { + waitsemacount uint32 +} + +const ( + _ESRCH = 3 + _ETIMEDOUT = 60 + + _CLOCK_REALTIME = 0 + _CLOCK_VIRTUAL = 1 + _CLOCK_PROF = 2 + _CLOCK_MONOTONIC = 3 +) + +// From NetBSD's +const ( + _CTL_HW = 6 + _HW_NCPU = 3 +) + +type sigactiont struct { + sa_sigaction uintptr + sa_mask sigset + sa_flags int32 +} diff --git a/hack/go1_7_3/runtime/os_openbsd.go b/hack/go1_7_3/runtime/os_openbsd.go new file mode 100644 index 0000000..574ecaa --- /dev/null +++ b/hack/go1_7_3/runtime/os_openbsd.go @@ -0,0 +1,40 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type mOS struct { + waitsemacount uint32 +} + +const ( + _ESRCH = 3 + _EAGAIN = 35 + _EWOULDBLOCK = _EAGAIN + _ENOTSUP = 91 + + _CLOCK_REALTIME = 0 + _CLOCK_VIRTUAL = 1 + _CLOCK_PROF = 2 + _CLOCK_MONOTONIC = 3 +) + +type sigset uint32 + +const ( + sigset_none = sigset(0) + sigset_all = ^sigset(0) +) + +// From OpenBSD's +const ( + _CTL_HW = 6 + _HW_NCPU = 3 +) + +type sigactiont struct { + sa_sigaction uintptr + sa_mask uint32 + sa_flags int32 +} diff --git a/hack/go1_7_3/runtime/os_plan9.go b/hack/go1_7_3/runtime/os_plan9.go new file mode 100644 index 0000000..fa62b1a --- /dev/null +++ b/hack/go1_7_3/runtime/os_plan9.go @@ -0,0 +1,15 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type mOS struct { + waitsemacount uint32 + notesig *int8 + errstr *byte +} + +type _Plink uintptr + +type sigset struct{} diff --git a/hack/go1_7_3/runtime/os_solaris.go b/hack/go1_7_3/runtime/os_solaris.go new file mode 100644 index 0000000..fe98cc2 --- /dev/null +++ b/hack/go1_7_3/runtime/os_solaris.go @@ -0,0 +1,24 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type mts struct { + tv_sec int64 + tv_nsec int64 +} + +type mscratch struct { + v [6]uintptr +} + +type mOS struct { + waitsema uintptr + perrno *int32 + + ts mts + scratch mscratch +} + +type libcFunc uintptr diff --git a/hack/go1_7_3/runtime/os_windows.go b/hack/go1_7_3/runtime/os_windows.go new file mode 100644 index 0000000..81d1bd9 --- /dev/null +++ b/hack/go1_7_3/runtime/os_windows.go @@ -0,0 +1,39 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +// TODO(brainman): should not need those +const ( + _NSIG = 65 +) + +type stdFunction unsafe.Pointer + +type mOS struct { + waitsema uintptr +} + +type sigset struct{} + +const ( + currentProcess = ^uintptr(0) + currentThread = ^uintptr(1) +) + +// Described in http://www.dcl.hpi.uni-potsdam.de/research/WRK/2007/08/getting-os-information-the-kuser_shared_data-structure/ +type _KSYSTEM_TIME struct { + LowPart uint32 + High1Time int32 + High2Time int32 +} + +const ( + _INTERRUPT_TIME = 0x7ffe0008 + _SYSTEM_TIME = 0x7ffe0014 +) diff --git a/hack/go1_7_3/runtime/panic.go b/hack/go1_7_3/runtime/panic.go new file mode 100644 index 0000000..80ff011 --- /dev/null +++ b/hack/go1_7_3/runtime/panic.go @@ -0,0 +1,15 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +const ( + deferHeaderSize = unsafe.Sizeof(_defer{}) + minDeferAlloc = (deferHeaderSize + 15) &^ 15 + minDeferArgs = minDeferAlloc - deferHeaderSize +) diff --git a/hack/go1_7_3/runtime/print.go b/hack/go1_7_3/runtime/print.go new file mode 100644 index 0000000..d02cf26 --- /dev/null +++ b/hack/go1_7_3/runtime/print.go @@ -0,0 +1,9 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +// The compiler knows that a print of a value of this type +// should use printhex instead of printuint (decimal). +type hex uint64 diff --git a/hack/go1_7_3/runtime/proc.go b/hack/go1_7_3/runtime/proc.go new file mode 100644 index 0000000..488f8b9 --- /dev/null +++ b/hack/go1_7_3/runtime/proc.go @@ -0,0 +1,54 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +const ( + _GoidCacheBatch = 16 +) + +// freezeStopWait is a large value that freezetheworld sets +// sched.stopwait to in order to request that all Gs permanently stop. +const freezeStopWait = 0x7fffffff + +type cgothreadstart struct { + g guintptr + tls *uint64 + fn unsafe.Pointer +} + +// forcePreemptNS is the time slice given to a G before it is +// preempted. +const forcePreemptNS = 10 * 1000 * 1000 + +// To shake out latent assumptions about scheduling order, +// we introduce some randomness into scheduling decisions +// when running with the race detector. +// The need for this was made obvious by changing the +// (deterministic) scheduling order in Go 1.5 and breaking +// many poorly-written tests. +// With the randomness here, as long as the tests pass +// consistently with -race, they shouldn't have latent scheduling +// assumptions. +const randomizeScheduler = raceenabled + +// randomOrder/randomEnum are helper types for randomized work stealing. +// They allow to enumerate all Ps in different pseudo-random orders without repetitions. +// The algorithm is based on the fact that if we have X such that X and GOMAXPROCS +// are coprime, then a sequences of (i + X) % GOMAXPROCS gives the required enumeration. +type randomOrder struct { + count uint32 + coprimes []uint32 +} + +type randomEnum struct { + i uint32 + count uint32 + pos uint32 + inc uint32 +} diff --git a/hack/go1_7_3/runtime/race.go b/hack/go1_7_3/runtime/race.go new file mode 100644 index 0000000..2aeefc0 --- /dev/null +++ b/hack/go1_7_3/runtime/race.go @@ -0,0 +1,38 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build race + +// Public race detection API, present iff build with -race. + +package runtime + +// private interface for the runtime +const raceenabled = true + +type symbolizeCodeContext struct { + pc uintptr + fn *byte + file *byte + line uintptr + off uintptr + res uintptr +} + +const ( + raceGetProcCmd = iota + raceSymbolizeCodeCmd + raceSymbolizeDataCmd +) + +type symbolizeDataContext struct { + addr uintptr + heap uintptr + start uintptr + size uintptr + name *byte + file *byte + line uintptr + res uintptr +} diff --git a/hack/go1_7_3/runtime/race0.go b/hack/go1_7_3/runtime/race0.go new file mode 100644 index 0000000..29bafea --- /dev/null +++ b/hack/go1_7_3/runtime/race0.go @@ -0,0 +1,11 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !race + +// Dummy race detection API, used when not built with -race. + +package runtime + +const raceenabled = false diff --git a/hack/go1_7_3/runtime/rune.go b/hack/go1_7_3/runtime/rune.go new file mode 100644 index 0000000..3fe4ed4 --- /dev/null +++ b/hack/go1_7_3/runtime/rune.go @@ -0,0 +1,55 @@ +/* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Portions Copyright 2009 The Go Authors. All rights reserved. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY + * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ + +/* + * This code is copied, with slight editing due to type differences, + * from a subset of ../lib9/utf/rune.c [which no longer exists] + */ + +package runtime + +const ( + bit1 = 7 + bitx = 6 + bit2 = 5 + bit3 = 4 + bit4 = 3 + bit5 = 2 + + t1 = ((1 << (bit1 + 1)) - 1) ^ 0xFF + tx = ((1 << (bitx + 1)) - 1) ^ 0xFF + t2 = ((1 << (bit2 + 1)) - 1) ^ 0xFF + t3 = ((1 << (bit3 + 1)) - 1) ^ 0xFF + t4 = ((1 << (bit4 + 1)) - 1) ^ 0xFF + t5 = ((1 << (bit5 + 1)) - 1) ^ 0xFF + + rune1 = (1 << (bit1 + 0*bitx)) - 1 + rune2 = (1 << (bit2 + 1*bitx)) - 1 + rune3 = (1 << (bit3 + 2*bitx)) - 1 + rune4 = (1 << (bit4 + 3*bitx)) - 1 + + maskx = (1 << bitx) - 1 + testx = maskx ^ 0xFF + + runeerror = 0xFFFD + runeself = 0x80 + + surrogateMin = 0xD800 + surrogateMax = 0xDFFF + + bad = runeerror + + runemax = 0x10FFFF +) diff --git a/hack/go1_7_3/runtime/runtime1.go b/hack/go1_7_3/runtime/runtime1.go new file mode 100644 index 0000000..b15fa9f --- /dev/null +++ b/hack/go1_7_3/runtime/runtime1.go @@ -0,0 +1,21 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +// Keep a cached value to make gotraceback fast, +// since we call it on every call to gentraceback. +// The cached value is a uint32 in which the low bits +// are the "crash" and "all" settings and the remaining +// bits are the traceback value (0 off, 1 on, 2 include system). +const ( + tracebackCrash = 1 << iota + tracebackAll + tracebackShift = iota +) + +type dbgVar struct { + name string + value *int32 +} diff --git a/hack/go1_7_3/runtime/runtime2.go b/hack/go1_7_3/runtime/runtime2.go new file mode 100644 index 0000000..fbae409 --- /dev/null +++ b/hack/go1_7_3/runtime/runtime2.go @@ -0,0 +1,516 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_3/runtime/internal/sys" + "unsafe" +) + +// defined constants +const ( + _Gidle = iota + + _Grunnable + + _Grunning + + _Gsyscall + + _Gwaiting + + _Gmoribund_unused + + _Gdead + + _Genqueue_unused + + _Gcopystack + + _Gscan = 0x1000 + _Gscanrunnable = _Gscan + _Grunnable + _Gscanrunning = _Gscan + _Grunning + _Gscansyscall = _Gscan + _Gsyscall + _Gscanwaiting = _Gscan + _Gwaiting +) + +const ( + _Pidle = iota + _Prunning + _Psyscall + _Pgcstop + _Pdead +) + +// Mutual exclusion locks. In the uncontended case, +// as fast as spin locks (just a few user-level instructions), +// but on the contention path they sleep in the kernel. +// A zeroed Mutex is unlocked (no need to initialize each lock). +type mutex struct { + key uintptr +} + +// sleep and wakeup on one-time events. +// before any calls to notesleep or notewakeup, +// must call noteclear to initialize the Note. +// then, exactly one thread can call notesleep +// and exactly one thread can call notewakeup (once). +// once notewakeup has been called, the notesleep +// will return. future notesleep will return immediately. +// subsequent noteclear must be called only after +// previous notesleep has returned, e.g. it's disallowed +// to call noteclear straight after notewakeup. +// +// notetsleep is like notesleep but wakes up after +// a given number of nanoseconds even if the event +// has not yet happened. if a goroutine uses notetsleep to +// wake up early, it must wait to call noteclear until it +// can be sure that no other goroutine is calling +// notewakeup. +// +// notesleep/notetsleep are generally called on g0, +// notetsleepg is similar to notetsleep but is called on user g. +type note struct { + key uintptr +} + +type funcval struct { + fn uintptr +} + +type iface struct { + tab *itab + data unsafe.Pointer +} + +type eface struct { + _type *_type + data unsafe.Pointer +} + +// A guintptr holds a goroutine pointer, but typed as a uintptr +// to bypass write barriers. It is used in the Gobuf goroutine state +// and in scheduling lists that are manipulated without a P. +// +// The Gobuf.g goroutine pointer is almost always updated by assembly code. +// In one of the few places it is updated by Go code - func save - it must be +// treated as a uintptr to avoid a write barrier being emitted at a bad time. +// Instead of figuring out how to emit the write barriers missing in the +// assembly manipulation, we change the type of the field to uintptr, +// so that it does not require write barriers at all. +// +// Goroutine structs are published in the allg list and never freed. +// That will keep the goroutine structs from being collected. +// There is never a time that Gobuf.g's contain the only references +// to a goroutine: the publishing of the goroutine in allg comes first. +// Goroutine pointers are also kept in non-GC-visible places like TLS, +// so I can't see them ever moving. If we did want to start moving data +// in the GC, we'd need to allocate the goroutine structs from an +// alternate arena. Using guintptr doesn't make that problem any worse. +type guintptr uintptr + +type puintptr uintptr + +type muintptr uintptr + +type gobuf struct { + sp uintptr + pc uintptr + g guintptr + ctxt unsafe.Pointer + ret sys.Uintreg + lr uintptr + bp uintptr +} + +// sudog represents a g in a wait list, such as for sending/receiving +// on a channel. +// +// sudog is necessary because the g ↔ synchronization object relation +// is many-to-many. A g can be on many wait lists, so there may be +// many sudogs for one g; and many gs may be waiting on the same +// synchronization object, so there may be many sudogs for one object. +// +// sudogs are allocated from a special pool. Use acquireSudog and +// releaseSudog to allocate and free them. +type sudog struct { + g *g + selectdone *uint32 + next *sudog + prev *sudog + elem unsafe.Pointer + + releasetime int64 + ticket uint32 + waitlink *sudog + c *hchan +} + +type gcstats struct { + nhandoff uint64 + nhandoffcnt uint64 + nprocyield uint64 + nosyield uint64 + nsleep uint64 +} + +type libcall struct { + fn uintptr + n uintptr + args uintptr + r1 uintptr + r2 uintptr + err uintptr +} + +// describes how to handle callback +type wincallbackcontext struct { + gobody unsafe.Pointer + argsize uintptr + restorestack uintptr + cleanstack bool +} + +// Stack describes a Go execution stack. +// The bounds of the stack are exactly [lo, hi), +// with no implicit data structures on either side. +type stack struct { + lo uintptr + hi uintptr +} + +// stkbar records the state of a G's stack barrier. +type stkbar struct { + savedLRPtr uintptr + savedLRVal uintptr +} + +type g struct { + stack stack + stackguard0 uintptr + stackguard1 uintptr + + _panic *_panic + _defer *_defer + m *m + stackAlloc uintptr + sched gobuf + syscallsp uintptr + syscallpc uintptr + stkbar []stkbar + stkbarPos uintptr + stktopsp uintptr + param unsafe.Pointer + atomicstatus uint32 + stackLock uint32 + goid int64 + waitsince int64 + waitreason string + schedlink guintptr + preempt bool + paniconfault bool + preemptscan bool + gcscandone bool + gcscanvalid bool + throwsplit bool + raceignore int8 + sysblocktraced bool + sysexitticks int64 + traceseq uint64 + tracelastp puintptr + lockedm *m + sig uint32 + writebuf []byte + sigcode0 uintptr + sigcode1 uintptr + sigpc uintptr + gopc uintptr + startpc uintptr + racectx uintptr + waiting *sudog + cgoCtxt []uintptr + + gcRescan int32 + + gcAssistBytes int64 +} + +type m struct { + g0 *g + morebuf gobuf + divmod uint32 + + procid uint64 + gsignal *g + sigmask sigset + tls [6]uintptr + mstartfn func() + curg *g + caughtsig guintptr + p puintptr + nextp puintptr + id int32 + mallocing int32 + throwing int32 + preemptoff string + locks int32 + softfloat int32 + dying int32 + profilehz int32 + helpgc int32 + spinning bool + blocked bool + inwb bool + newSigstack bool + printlock int8 + fastrand uint32 + ncgocall uint64 + ncgo int32 + cgoCallersUse uint32 + cgoCallers *cgoCallers + park note + alllink *m + schedlink muintptr + mcache *mcache + lockedg *g + createstack [32]uintptr + freglo [16]uint32 + freghi [16]uint32 + fflag uint32 + locked uint32 + nextwaitm uintptr + gcstats gcstats + needextram bool + traceback uint8 + waitunlockf unsafe.Pointer + waitlock unsafe.Pointer + waittraceev byte + waittraceskip int + startingtrace bool + syscalltick uint32 + thread uintptr + + libcall libcall + libcallpc uintptr + libcallsp uintptr + libcallg guintptr + syscall libcall + + mOS +} + +type p struct { + lock mutex + + id int32 + status uint32 + link puintptr + schedtick uint32 + syscalltick uint32 + m muintptr + mcache *mcache + racectx uintptr + + deferpool [5][]*_defer + deferpoolbuf [5][32]*_defer + + goidcache uint64 + goidcacheend uint64 + + runqhead uint32 + runqtail uint32 + runq [256]guintptr + + runnext guintptr + + gfree *g + gfreecnt int32 + + sudogcache []*sudog + sudogbuf [128]*sudog + + tracebuf traceBufPtr + + palloc persistentAlloc + + gcAssistTime int64 + gcBgMarkWorker guintptr + gcMarkWorkerMode gcMarkWorkerMode + + gcw gcWork + + runSafePointFn uint32 + + pad [64]byte +} + +const ( + _MaxGomaxprocs = 1 << 8 +) + +type schedt struct { + goidgen uint64 + lastpoll uint64 + + lock mutex + + midle muintptr + nmidle int32 + nmidlelocked int32 + mcount int32 + maxmcount int32 + + ngsys uint32 + + pidle puintptr + npidle uint32 + nmspinning uint32 + + runqhead guintptr + runqtail guintptr + runqsize int32 + + gflock mutex + gfreeStack *g + gfreeNoStack *g + ngfree int32 + + sudoglock mutex + sudogcache *sudog + + deferlock mutex + deferpool [5]*_defer + + gcwaiting uint32 + stopwait int32 + stopnote note + sysmonwait uint32 + sysmonnote note + + safePointFn func(*p) + safePointWait int32 + safePointNote note + + profilehz int32 + + procresizetime int64 + totaltime int64 +} + +// The m.locked word holds two pieces of state counting active calls to LockOSThread/lockOSThread. +// The low bit (LockExternal) is a boolean reporting whether any LockOSThread call is active. +// External locks are not recursive; a second lock is silently ignored. +// The upper bits of m.locked record the nesting depth of calls to lockOSThread +// (counting up by LockInternal), popped by unlockOSThread (counting down by LockInternal). +// Internal locks can be recursive. For instance, a lock for cgo can occur while the main +// goroutine is holding the lock during the initialization phase. +const ( + _LockExternal = 1 + _LockInternal = 2 +) + +type sigtabtt struct { + flags int32 + name *int8 +} + +const ( + _SigNotify = 1 << iota + _SigKill + _SigThrow + _SigPanic + _SigDefault + _SigHandling + _SigGoExit + _SigSetStack + _SigUnblock +) + +// Layout of in-memory per-function information prepared by linker +// See https://golang.org/s/go12symtab. +// Keep in sync with linker +// and with package debug/gosym and with symtab.go in package runtime. +type _func struct { + entry uintptr + nameoff int32 + + args int32 + _ int32 + + pcsp int32 + pcfile int32 + pcln int32 + npcdata int32 + nfuncdata int32 +} + +// layout of Itab known to compilers +// allocated in non-garbage-collected memory +// Needs to be in sync with +// ../cmd/compile/internal/gc/reflect.go:/^func.dumptypestructs. +type itab struct { + inter *interfacetype + _type *_type + link *itab + bad int32 + unused int32 + fun [1]uintptr +} + +// Lock-free stack node. +// // Also known to export_test.go. +type lfnode struct { + next uint64 + pushcnt uintptr +} + +type forcegcstate struct { + lock mutex + g *g + idle uint32 +} + +// deferred subroutine calls +type _defer struct { + siz int32 + started bool + sp uintptr + pc uintptr + fn *funcval + _panic *_panic + link *_defer +} + +// panics +type _panic struct { + argp unsafe.Pointer + arg interface{} + link *_panic + recovered bool + aborted bool +} + +// stack traces +type stkframe struct { + fn *_func + pc uintptr + continpc uintptr + lr uintptr + sp uintptr + fp uintptr + varp uintptr + argp uintptr + arglen uintptr + argmap *bitvector +} + +const ( + _TraceRuntimeFrames = 1 << iota + _TraceTrap + _TraceJumpStack +) + +// The maximum number of frames we print for a traceback +const _TracebackMaxFrames = 100 diff --git a/hack/go1_7_3/runtime/select.go b/hack/go1_7_3/runtime/select.go new file mode 100644 index 0000000..276a9f2 --- /dev/null +++ b/hack/go1_7_3/runtime/select.go @@ -0,0 +1,60 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +const ( + debugSelect = false + + caseRecv = iota + caseSend + caseDefault +) + +// Select statement header. +// Known to compiler. +// Changes here must also be made in src/cmd/internal/gc/select.go's selecttype. +type hselect struct { + tcase uint16 + ncase uint16 + pollorder *uint16 + lockorder *uint16 + scase [1]scase +} + +// Select case descriptor. +// Known to compiler. +// Changes here must also be made in src/cmd/internal/gc/select.go's selecttype. +type scase struct { + elem unsafe.Pointer + c *hchan + pc uintptr + kind uint16 + so uint16 + receivedp *bool + releasetime int64 +} + +// A runtimeSelect is a single case passed to rselect. +// This must match ../reflect/value.go:/runtimeSelect +type runtimeSelect struct { + dir selectDir + typ unsafe.Pointer + ch *hchan + val unsafe.Pointer +} + +// These values must match ../reflect/value.go:/SelectDir. +type selectDir int + +const ( + _ selectDir = iota + selectSend + selectRecv + selectDefault +) diff --git a/hack/go1_7_3/runtime/sema.go b/hack/go1_7_3/runtime/sema.go new file mode 100644 index 0000000..80ccc17 --- /dev/null +++ b/hack/go1_7_3/runtime/sema.go @@ -0,0 +1,43 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Semaphore implementation exposed to Go. +// Intended use is provide a sleep and wakeup +// primitive that can be used in the contended case +// of other synchronization primitives. +// Thus it targets the same goal as Linux's futex, +// but it has much simpler semantics. +// +// That is, don't think of these as semaphores. +// Think of them as a way to implement sleep and wakeup +// such that every sleep is paired with a single wakeup, +// even if, due to races, the wakeup happens before the sleep. +// +// See Mullender and Cox, ``Semaphores in Plan 9,'' +// http://swtch.com/semaphore.pdf + +package runtime + +type semaRoot struct { + lock mutex + head *sudog + tail *sudog + nwait uint32 +} + +// Prime to not correlate with any user patterns. +const semTabSize = 251 + +// notifyList is a ticket-based notification list used to implement sync.Cond. +// +// It must be kept in sync with the sync package. +type notifyList struct { + wait uint32 + + notify uint32 + + lock mutex + head *sudog + tail *sudog +} diff --git a/hack/go1_7_3/runtime/signal1_unix.go b/hack/go1_7_3/runtime/signal1_unix.go new file mode 100644 index 0000000..39442ed --- /dev/null +++ b/hack/go1_7_3/runtime/signal1_unix.go @@ -0,0 +1,17 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build darwin dragonfly freebsd linux netbsd openbsd solaris + +package runtime + +const ( + _SIG_DFL uintptr = 0 + _SIG_IGN uintptr = 1 +) + +// sigmask represents a general signal mask compatible with the GOOS +// specific sigset types: the signal numbered x is represented by bit x-1 +// to match the representation expected by sigprocmask. +type sigmask [(_NSIG + 31) / 32]uint32 diff --git a/hack/go1_7_3/runtime/signal_darwin.go b/hack/go1_7_3/runtime/signal_darwin.go new file mode 100644 index 0000000..76e1ad2 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_darwin.go @@ -0,0 +1,10 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_3/runtime/signal_darwin_386.go b/hack/go1_7_3/runtime/signal_darwin_386.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_darwin_386.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_darwin_amd64.go b/hack/go1_7_3/runtime/signal_darwin_amd64.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_darwin_amd64.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_darwin_arm.go b/hack/go1_7_3/runtime/signal_darwin_arm.go new file mode 100644 index 0000000..95b671d --- /dev/null +++ b/hack/go1_7_3/runtime/signal_darwin_arm.go @@ -0,0 +1,12 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_darwin_arm64.go b/hack/go1_7_3/runtime/signal_darwin_arm64.go new file mode 100644 index 0000000..afe8be5 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_darwin_arm64.go @@ -0,0 +1,12 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_dragonfly.go b/hack/go1_7_3/runtime/signal_dragonfly.go new file mode 100644 index 0000000..76e1ad2 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_dragonfly.go @@ -0,0 +1,10 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_3/runtime/signal_dragonfly_amd64.go b/hack/go1_7_3/runtime/signal_dragonfly_amd64.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_dragonfly_amd64.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_freebsd.go b/hack/go1_7_3/runtime/signal_freebsd.go new file mode 100644 index 0000000..76e1ad2 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_freebsd.go @@ -0,0 +1,10 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_3/runtime/signal_freebsd_386.go b/hack/go1_7_3/runtime/signal_freebsd_386.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_freebsd_386.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_freebsd_amd64.go b/hack/go1_7_3/runtime/signal_freebsd_amd64.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_freebsd_amd64.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_freebsd_arm.go b/hack/go1_7_3/runtime/signal_freebsd_arm.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_freebsd_arm.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_linux_386.go b/hack/go1_7_3/runtime/signal_linux_386.go new file mode 100644 index 0000000..d74a0f2 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_linux_386.go @@ -0,0 +1,14 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_linux_amd64.go b/hack/go1_7_3/runtime/signal_linux_amd64.go new file mode 100644 index 0000000..d74a0f2 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_linux_amd64.go @@ -0,0 +1,14 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_linux_arm.go b/hack/go1_7_3/runtime/signal_linux_arm.go new file mode 100644 index 0000000..d74a0f2 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_linux_arm.go @@ -0,0 +1,14 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_linux_arm64.go b/hack/go1_7_3/runtime/signal_linux_arm64.go new file mode 100644 index 0000000..86c38d6 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_linux_arm64.go @@ -0,0 +1,14 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_linux_mips64x.go b/hack/go1_7_3/runtime/signal_linux_mips64x.go new file mode 100644 index 0000000..4a3adc1 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_linux_mips64x.go @@ -0,0 +1,17 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux +// +build mips64 mips64le + +package runtime + +import ( + "unsafe" +) + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_linux_ppc64x.go b/hack/go1_7_3/runtime/signal_linux_ppc64x.go new file mode 100644 index 0000000..f608902 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_linux_ppc64x.go @@ -0,0 +1,17 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux +// +build ppc64 ppc64le + +package runtime + +import ( + "unsafe" +) + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_linux_s390x.go b/hack/go1_7_3/runtime/signal_linux_s390x.go new file mode 100644 index 0000000..f356222 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_linux_s390x.go @@ -0,0 +1,14 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_nacl.go b/hack/go1_7_3/runtime/signal_nacl.go new file mode 100644 index 0000000..76e1ad2 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_nacl.go @@ -0,0 +1,10 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_3/runtime/signal_nacl_386.go b/hack/go1_7_3/runtime/signal_nacl_386.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_nacl_386.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_nacl_amd64p32.go b/hack/go1_7_3/runtime/signal_nacl_amd64p32.go new file mode 100644 index 0000000..95b671d --- /dev/null +++ b/hack/go1_7_3/runtime/signal_nacl_amd64p32.go @@ -0,0 +1,12 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_nacl_arm.go b/hack/go1_7_3/runtime/signal_nacl_arm.go new file mode 100644 index 0000000..95b671d --- /dev/null +++ b/hack/go1_7_3/runtime/signal_nacl_arm.go @@ -0,0 +1,12 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_netbsd.go b/hack/go1_7_3/runtime/signal_netbsd.go new file mode 100644 index 0000000..76e1ad2 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_netbsd.go @@ -0,0 +1,10 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_3/runtime/signal_netbsd_386.go b/hack/go1_7_3/runtime/signal_netbsd_386.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_netbsd_386.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_netbsd_amd64.go b/hack/go1_7_3/runtime/signal_netbsd_amd64.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_netbsd_amd64.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_netbsd_arm.go b/hack/go1_7_3/runtime/signal_netbsd_arm.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_netbsd_arm.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_openbsd.go b/hack/go1_7_3/runtime/signal_openbsd.go new file mode 100644 index 0000000..76e1ad2 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_openbsd.go @@ -0,0 +1,10 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_3/runtime/signal_openbsd_386.go b/hack/go1_7_3/runtime/signal_openbsd_386.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_openbsd_386.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_openbsd_amd64.go b/hack/go1_7_3/runtime/signal_openbsd_amd64.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_openbsd_amd64.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_openbsd_arm.go b/hack/go1_7_3/runtime/signal_openbsd_arm.go new file mode 100644 index 0000000..deeee98 --- /dev/null +++ b/hack/go1_7_3/runtime/signal_openbsd_arm.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/signal_plan9.go b/hack/go1_7_3/runtime/signal_plan9.go new file mode 100644 index 0000000..8cec35e --- /dev/null +++ b/hack/go1_7_3/runtime/signal_plan9.go @@ -0,0 +1,10 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int + name string +} diff --git a/hack/go1_7_3/runtime/signal_solaris.go b/hack/go1_7_3/runtime/signal_solaris.go new file mode 100644 index 0000000..13e08ec --- /dev/null +++ b/hack/go1_7_3/runtime/signal_solaris.go @@ -0,0 +1,10 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_3/runtime/signal_solaris_amd64.go b/hack/go1_7_3/runtime/signal_solaris_amd64.go new file mode 100644 index 0000000..95b671d --- /dev/null +++ b/hack/go1_7_3/runtime/signal_solaris_amd64.go @@ -0,0 +1,12 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} diff --git a/hack/go1_7_3/runtime/sigqueue.go b/hack/go1_7_3/runtime/sigqueue.go new file mode 100644 index 0000000..65ee8eb --- /dev/null +++ b/hack/go1_7_3/runtime/sigqueue.go @@ -0,0 +1,35 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// This file implements runtime support for signal handling. +// +// Most synchronization primitives are not available from +// the signal handler (it cannot block, allocate memory, or use locks) +// so the handler communicates with a processing goroutine +// via struct sig, below. +// +// sigsend is called by the signal handler to queue a new signal. +// signal_recv is called by the Go program to receive a newly queued signal. +// Synchronization between sigsend and signal_recv is based on the sig.state +// variable. It can be in 3 states: sigIdle, sigReceiving and sigSending. +// sigReceiving means that signal_recv is blocked on sig.Note and there are no +// new pending signals. +// sigSending means that sig.mask *may* contain new pending signals, +// signal_recv can't be blocked in this state. +// sigIdle means that there are no new pending signals and signal_recv is not blocked. +// Transitions between states are done atomically with CAS. +// When signal_recv is unblocked, it resets sig.Note and rechecks sig.mask. +// If several sigsends and signal_recv execute concurrently, it can lead to +// unnecessary rechecks of sig.mask, but it cannot lead to missed signals +// nor deadlocks. + +// +build !plan9 + +package runtime + +const ( + sigIdle = iota + sigReceiving + sigSending +) diff --git a/hack/go1_7_3/runtime/sigqueue_plan9.go b/hack/go1_7_3/runtime/sigqueue_plan9.go new file mode 100644 index 0000000..22fcfc9 --- /dev/null +++ b/hack/go1_7_3/runtime/sigqueue_plan9.go @@ -0,0 +1,22 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// This file implements runtime support for signal handling. + +package runtime + +const qsize = 64 + +type noteData struct { + s [_ERRMAX]byte + n int +} + +type noteQueue struct { + lock mutex + data [qsize]noteData + ri int + wi int + full bool +} diff --git a/hack/go1_7_3/runtime/sigtab_linux_generic.go b/hack/go1_7_3/runtime/sigtab_linux_generic.go new file mode 100644 index 0000000..92b4739 --- /dev/null +++ b/hack/go1_7_3/runtime/sigtab_linux_generic.go @@ -0,0 +1,14 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !mips64 +// +build !mips64le +// +build linux + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_3/runtime/sigtab_linux_mips64x.go b/hack/go1_7_3/runtime/sigtab_linux_mips64x.go new file mode 100644 index 0000000..4f491fb --- /dev/null +++ b/hack/go1_7_3/runtime/sigtab_linux_mips64x.go @@ -0,0 +1,13 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build mips64 mips64le +// +build linux + +package runtime + +type sigTabT struct { + flags int32 + name string +} diff --git a/hack/go1_7_3/runtime/slice.go b/hack/go1_7_3/runtime/slice.go new file mode 100644 index 0000000..21caa12 --- /dev/null +++ b/hack/go1_7_3/runtime/slice.go @@ -0,0 +1,15 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +type slice struct { + array unsafe.Pointer + len int + cap int +} diff --git a/hack/go1_7_3/runtime/softfloat64.go b/hack/go1_7_3/runtime/softfloat64.go new file mode 100644 index 0000000..a5a459c --- /dev/null +++ b/hack/go1_7_3/runtime/softfloat64.go @@ -0,0 +1,27 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Software IEEE754 64-bit floating point. +// Only referred to (and thus linked in) by arm port +// and by tests in this directory. + +package runtime + +const ( + mantbits64 uint = 52 + expbits64 uint = 11 + bias64 = -1<<(expbits64-1) + 1 + + nan64 uint64 = (1<> 1) + _FixedStack3 = _FixedStack2 | (_FixedStack2 >> 2) + _FixedStack4 = _FixedStack3 | (_FixedStack3 >> 4) + _FixedStack5 = _FixedStack4 | (_FixedStack4 >> 8) + _FixedStack6 = _FixedStack5 | (_FixedStack5 >> 16) + _FixedStack = _FixedStack6 + 1 + + _StackBig = 4096 + + _StackGuard = 720*sys.StackGuardMultiplier + _StackSystem + + _StackSmall = 128 + + _StackLimit = _StackGuard - _StackSystem - _StackSmall +) + +// Goroutine preemption request. +// Stored into g->stackguard0 to cause split stack check failure. +// Must be greater than any real sp. +// 0xfffffade in hex. +const ( + _StackPreempt = uintptrMask & -1314 + _StackFork = uintptrMask & -1234 +) + +const ( + stackDebug = 0 + stackFromSystem = 0 + stackFaultOnFree = 0 + stackPoisonCopy = 0 + + stackCache = 1 +) + +const ( + uintptrMask = 1<<(8*sys.PtrSize) - 1 + + stackPreempt = uintptrMask & -1314 + + stackFork = uintptrMask & -1234 +) + +type adjustinfo struct { + old stack + delta uintptr + cache pcvalueCache + + sghi uintptr +} + +// Information from the compiler about the layout of stack frames. +type bitvector struct { + n int32 + bytedata *uint8 +} + +type gobitvector struct { + n uintptr + bytedata []uint8 +} diff --git a/hack/go1_7_3/runtime/string.go b/hack/go1_7_3/runtime/string.go new file mode 100644 index 0000000..4c07b53 --- /dev/null +++ b/hack/go1_7_3/runtime/string.go @@ -0,0 +1,26 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "unsafe" +) + +// The constant is known to the compiler. +// There is no fundamental theory behind this number. +const tmpStringBufSize = 32 + +type tmpBuf [tmpStringBufSize]byte + +type stringStruct struct { + str unsafe.Pointer + len int +} + +// Variant with *byte pointer type for DWARF debugging. +type stringStructDWARF struct { + str *byte + len int +} diff --git a/hack/go1_7_3/runtime/stubs.go b/hack/go1_7_3/runtime/stubs.go new file mode 100644 index 0000000..c661169 --- /dev/null +++ b/hack/go1_7_3/runtime/stubs.go @@ -0,0 +1,10 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type neverCallThisFunction struct{} + +// argp used in Defer structs when there is no argp. +const _NoArgs = ^uintptr(0) diff --git a/hack/go1_7_3/runtime/symtab.go b/hack/go1_7_3/runtime/symtab.go new file mode 100644 index 0000000..af1e670 --- /dev/null +++ b/hack/go1_7_3/runtime/symtab.go @@ -0,0 +1,124 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +// Frames may be used to get function/file/line information for a +// slice of PC values returned by Callers. +type Frames struct { + callers []uintptr + + wasPanic bool + + frames *[]Frame +} + +// Frame is the information returned by Frames for each call frame. +type Frame struct { + PC uintptr + + Func *Func + + Function string + File string + Line int + + Entry uintptr +} + +// A Func represents a Go function in the running binary. +type Func struct { + opaque struct{} +} + +// funcdata.h +const ( + _PCDATA_StackMapIndex = 0 + _FUNCDATA_ArgsPointerMaps = 0 + _FUNCDATA_LocalsPointerMaps = 1 + _ArgsSizeUnknown = -0x80000000 +) + +// moduledata records information about the layout of the executable +// image. It is written by the linker. Any changes here must be +// matched changes to the code in cmd/internal/ld/symtab.go:symtab. +// moduledata is stored in read-only memory; none of the pointers here +// are visible to the garbage collector. +type moduledata struct { + pclntable []byte + ftab []functab + filetab []uint32 + findfunctab uintptr + minpc, maxpc uintptr + + text, etext uintptr + noptrdata, enoptrdata uintptr + data, edata uintptr + bss, ebss uintptr + noptrbss, enoptrbss uintptr + end, gcdata, gcbss uintptr + types, etypes uintptr + + typelinks []int32 + itablinks []*itab + + modulename string + modulehashes []modulehash + + gcdatamask, gcbssmask bitvector + + typemap map[typeOff]*_type + + next *moduledata +} + +// For each shared library a module links against, the linker creates an entry in the +// moduledata.modulehashes slice containing the name of the module, the abi hash seen +// at link time and a pointer to the runtime abi hash. These are checked in +// moduledataverify1 below. +type modulehash struct { + modulename string + linktimehash string + runtimehash *string +} + +type functab struct { + entry uintptr + funcoff uintptr +} + +const minfunc = 16 +const pcbucketsize = 256 * minfunc + +// findfunctab is an array of these structures. +// Each bucket represents 4096 bytes of the text segment. +// Each subbucket represents 256 bytes of the text segment. +// To find a function given a pc, locate the bucket and subbucket for +// that pc. Add together the idx and subbucket value to obtain a +// function index. Then scan the functab array starting at that +// index to find the target function. +// This table uses 20 bytes for every 4096 bytes of code, or ~0.5% overhead. +type findfuncbucket struct { + idx uint32 + subbuckets [16]byte +} + +const debugPcln = false + +type pcvalueCache struct { + entries [16]pcvalueCacheEnt +} + +type pcvalueCacheEnt struct { + targetpc uintptr + off int32 + + val int32 +} + +type stackmap struct { + n int32 + nbit int32 + bytedata [1]byte +} diff --git a/hack/go1_7_3/runtime/syscall_windows.go b/hack/go1_7_3/runtime/syscall_windows.go new file mode 100644 index 0000000..6488ff0 --- /dev/null +++ b/hack/go1_7_3/runtime/syscall_windows.go @@ -0,0 +1,13 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +type callbacks struct { + lock mutex + ctxt [cb_max]*wincallbackcontext + n int +} + +const _LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 diff --git a/hack/go1_7_3/runtime/time.go b/hack/go1_7_3/runtime/time.go new file mode 100644 index 0000000..6000489 --- /dev/null +++ b/hack/go1_7_3/runtime/time.go @@ -0,0 +1,21 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Time-related runtime and pieces of package time. + +package runtime + +// Package time knows the layout of this structure. +// If this struct changes, adjust ../time/sleep.go:/runtimeTimer. +// For GOOS=nacl, package syscall knows the layout of this structure. +// If this struct changes, adjust ../syscall/net_nacl.go:/runtimeTimer. +type timer struct { + i int + + when int64 + period int64 + f func(interface{}, uintptr) + arg interface{} + seq uintptr +} diff --git a/hack/go1_7_3/runtime/trace.go b/hack/go1_7_3/runtime/trace.go new file mode 100644 index 0000000..7b9495b --- /dev/null +++ b/hack/go1_7_3/runtime/trace.go @@ -0,0 +1,144 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Go execution tracer. +// The tracer captures a wide range of execution events like goroutine +// creation/blocking/unblocking, syscall enter/exit/block, GC-related events, +// changes of heap size, processor start/stop, etc and writes them to a buffer +// in a compact form. A precise nanosecond-precision timestamp and a stack +// trace is captured for most events. +// See https://golang.org/s/go15trace for more info. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_3/runtime/internal/sys" + "unsafe" +) + +// Event types in the trace, args are given in square brackets. +const ( + traceEvNone = 0 + traceEvBatch = 1 + traceEvFrequency = 2 + traceEvStack = 3 + traceEvGomaxprocs = 4 + traceEvProcStart = 5 + traceEvProcStop = 6 + traceEvGCStart = 7 + traceEvGCDone = 8 + traceEvGCScanStart = 9 + traceEvGCScanDone = 10 + traceEvGCSweepStart = 11 + traceEvGCSweepDone = 12 + traceEvGoCreate = 13 + traceEvGoStart = 14 + traceEvGoEnd = 15 + traceEvGoStop = 16 + traceEvGoSched = 17 + traceEvGoPreempt = 18 + traceEvGoSleep = 19 + traceEvGoBlock = 20 + traceEvGoUnblock = 21 + traceEvGoBlockSend = 22 + traceEvGoBlockRecv = 23 + traceEvGoBlockSelect = 24 + traceEvGoBlockSync = 25 + traceEvGoBlockCond = 26 + traceEvGoBlockNet = 27 + traceEvGoSysCall = 28 + traceEvGoSysExit = 29 + traceEvGoSysBlock = 30 + traceEvGoWaiting = 31 + traceEvGoInSyscall = 32 + traceEvHeapAlloc = 33 + traceEvNextGC = 34 + traceEvTimerGoroutine = 35 + traceEvFutileWakeup = 36 + traceEvString = 37 + traceEvGoStartLocal = 38 + traceEvGoUnblockLocal = 39 + traceEvGoSysExitLocal = 40 + traceEvCount = 41 +) + +const ( + traceTickDiv = 16 + 48*(sys.Goarch386|sys.GoarchAmd64|sys.GoarchAmd64p32) + + traceStackSize = 128 + + traceGlobProc = -1 + + traceBytesPerNumber = 10 + + traceArgCountShift = 6 + + traceFutileWakeup byte = 128 +) + +// traceBufHeader is per-P tracing buffer. +type traceBufHeader struct { + link traceBufPtr + lastTicks uint64 + pos int + stk [traceStackSize]uintptr +} + +// traceBuf is per-P tracing buffer. +type traceBuf struct { + traceBufHeader + arr [64<<10 - unsafe.Sizeof(traceBufHeader{})]byte +} + +// traceBufPtr is a *traceBuf that is not traced by the garbage +// collector and doesn't have write barriers. traceBufs are not +// allocated from the GC'd heap, so this is safe, and are often +// manipulated in contexts where write barriers are not allowed, so +// this is necessary. +type traceBufPtr uintptr + +// traceStackTable maps stack traces (arrays of PC's) to unique uint32 ids. +// It is lock-free for reading. +type traceStackTable struct { + lock mutex + seq uint32 + mem traceAlloc + tab [1 << 13]traceStackPtr +} + +// traceStack is a single stack in traceStackTable. +type traceStack struct { + link traceStackPtr + hash uintptr + id uint32 + n int + stk [0]uintptr +} + +type traceStackPtr uintptr + +type traceFrame struct { + funcID uint64 + fileID uint64 + line uint64 +} + +// traceAlloc is a non-thread-safe region allocator. +// It holds a linked list of traceAllocBlock. +type traceAlloc struct { + head traceAllocBlockPtr + off uintptr +} + +// traceAllocBlock is a block in traceAlloc. +// +// traceAllocBlock is allocated from non-GC'd memory, so it must not +// contain heap pointers. Writes to pointers to traceAllocBlocks do +// not need write barriers. +type traceAllocBlock struct { + next traceAllocBlockPtr + data [64<<10 - sys.PtrSize]byte +} + +type traceAllocBlockPtr uintptr diff --git a/hack/go1_7_3/runtime/traceback.go b/hack/go1_7_3/runtime/traceback.go new file mode 100644 index 0000000..949cd01 --- /dev/null +++ b/hack/go1_7_3/runtime/traceback.go @@ -0,0 +1,35 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "github.com/huandu/goroutine/hack/go1_7_3/runtime/internal/sys" +) + +const usesLR = sys.MinFrameSize > 0 + +// cgoTracebackArg is the type passed to cgoTraceback. +type cgoTracebackArg struct { + context uintptr + sigContext uintptr + buf *uintptr + max uintptr +} + +// cgoContextArg is the type passed to the context function. +type cgoContextArg struct { + context uintptr +} + +// cgoSymbolizerArg is the type passed to cgoSymbolizer. +type cgoSymbolizerArg struct { + pc uintptr + file *byte + lineno uintptr + funcName *byte + entry uintptr + more uintptr + data uintptr +} diff --git a/hack/go1_7_3/runtime/type.go b/hack/go1_7_3/runtime/type.go new file mode 100644 index 0000000..491a011 --- /dev/null +++ b/hack/go1_7_3/runtime/type.go @@ -0,0 +1,131 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Runtime type representation. + +package runtime + +// tflag is documented in reflect/type.go. +// +// tflag values must be kept in sync with copies in: +// cmd/compile/internal/gc/reflect.go +// cmd/link/internal/ld/decodesym.go +// reflect/type.go +type tflag uint8 + +const ( + tflagUncommon tflag = 1 << 0 + tflagExtraStar tflag = 1 << 1 + tflagNamed tflag = 1 << 2 +) + +// Needs to be in sync with ../cmd/compile/internal/ld/decodesym.go:/^func.commonsize, +// ../cmd/compile/internal/gc/reflect.go:/^func.dcommontype and +// ../reflect/type.go:/^type.rtype. +type _type struct { + size uintptr + ptrdata uintptr + hash uint32 + tflag tflag + align uint8 + fieldalign uint8 + kind uint8 + alg *typeAlg + + gcdata *byte + str nameOff + ptrToThis typeOff +} + +type nameOff int32 +type typeOff int32 +type textOff int32 + +type method struct { + name nameOff + mtyp typeOff + ifn textOff + tfn textOff +} + +type uncommontype struct { + pkgpath nameOff + mcount uint16 + _ uint16 + moff uint32 + _ uint32 +} + +type imethod struct { + name nameOff + ityp typeOff +} + +type interfacetype struct { + typ _type + pkgpath name + mhdr []imethod +} + +type maptype struct { + typ _type + key *_type + elem *_type + bucket *_type + hmap *_type + keysize uint8 + indirectkey bool + valuesize uint8 + indirectvalue bool + bucketsize uint16 + reflexivekey bool + needkeyupdate bool +} + +type arraytype struct { + typ _type + elem *_type + slice *_type + len uintptr +} + +type chantype struct { + typ _type + elem *_type + dir uintptr +} + +type slicetype struct { + typ _type + elem *_type +} + +type functype struct { + typ _type + inCount uint16 + outCount uint16 +} + +type ptrtype struct { + typ _type + elem *_type +} + +type structfield struct { + name name + typ *_type + offset uintptr +} + +type structtype struct { + typ _type + pkgPath name + fields []structfield +} + +// name is an encoded type name with optional extra data. +// See reflect/type.go for details. +type name struct { + bytes *byte +} diff --git a/hack/go1_7_3/runtime/typekind.go b/hack/go1_7_3/runtime/typekind.go new file mode 100644 index 0000000..98aabf7 --- /dev/null +++ b/hack/go1_7_3/runtime/typekind.go @@ -0,0 +1,39 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + kindBool = 1 + iota + kindInt + kindInt8 + kindInt16 + kindInt32 + kindInt64 + kindUint + kindUint8 + kindUint16 + kindUint32 + kindUint64 + kindUintptr + kindFloat32 + kindFloat64 + kindComplex64 + kindComplex128 + kindArray + kindChan + kindFunc + kindInterface + kindMap + kindPtr + kindSlice + kindString + kindStruct + kindUnsafePointer + + kindDirectIface = 1 << 5 + kindGCProg = 1 << 6 + kindNoPointers = 1 << 7 + kindMask = (1 << 5) - 1 +) diff --git a/hack/go1_7_3/runtime/vdso_linux_amd64.go b/hack/go1_7_3/runtime/vdso_linux_amd64.go new file mode 100644 index 0000000..47a17ef --- /dev/null +++ b/hack/go1_7_3/runtime/vdso_linux_amd64.go @@ -0,0 +1,133 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +const ( + _AT_SYSINFO_EHDR = 33 + + _PT_LOAD = 1 + _PT_DYNAMIC = 2 + + _DT_NULL = 0 + _DT_HASH = 4 + _DT_STRTAB = 5 + _DT_SYMTAB = 6 + _DT_VERSYM = 0x6ffffff0 + _DT_VERDEF = 0x6ffffffc + + _VER_FLG_BASE = 0x1 + + _SHN_UNDEF = 0 + + _SHT_DYNSYM = 11 + + _STT_FUNC = 2 + + _STB_GLOBAL = 1 + _STB_WEAK = 2 + + _EI_NIDENT = 16 +) + +type elf64Sym struct { + st_name uint32 + st_info byte + st_other byte + st_shndx uint16 + st_value uint64 + st_size uint64 +} + +type elf64Verdef struct { + vd_version uint16 + vd_flags uint16 + vd_ndx uint16 + vd_cnt uint16 + vd_hash uint32 + vd_aux uint32 + vd_next uint32 +} + +type elf64Ehdr struct { + e_ident [_EI_NIDENT]byte + e_type uint16 + e_machine uint16 + e_version uint32 + e_entry uint64 + e_phoff uint64 + e_shoff uint64 + e_flags uint32 + e_ehsize uint16 + e_phentsize uint16 + e_phnum uint16 + e_shentsize uint16 + e_shnum uint16 + e_shstrndx uint16 +} + +type elf64Phdr struct { + p_type uint32 + p_flags uint32 + p_offset uint64 + p_vaddr uint64 + p_paddr uint64 + p_filesz uint64 + p_memsz uint64 + p_align uint64 +} + +type elf64Shdr struct { + sh_name uint32 + sh_type uint32 + sh_flags uint64 + sh_addr uint64 + sh_offset uint64 + sh_size uint64 + sh_link uint32 + sh_info uint32 + sh_addralign uint64 + sh_entsize uint64 +} + +type elf64Dyn struct { + d_tag int64 + d_val uint64 +} + +type elf64Verdaux struct { + vda_name uint32 + vda_next uint32 +} + +type elf64Auxv struct { + a_type uint64 + a_val uint64 +} + +type symbol_key struct { + name string + sym_hash uint32 + ptr *uintptr +} + +type version_key struct { + version string + ver_hash uint32 +} + +type vdso_info struct { + valid bool + + load_addr uintptr + load_offset uintptr + + symtab *[1 << 32]elf64Sym + symstrings *[1 << 32]byte + chain []uint32 + bucket []uint32 + + versym *[1 << 32]uint16 + verdef *elf64Verdef +} diff --git a/hack/go1_7_3/runtime/vlrt.go b/hack/go1_7_3/runtime/vlrt.go new file mode 100644 index 0000000..adbf471 --- /dev/null +++ b/hack/go1_7_3/runtime/vlrt.go @@ -0,0 +1,33 @@ +// Inferno's libkern/vlrt-arm.c +// http://code.google.com/p/inferno-os/source/browse/libkern/vlrt-arm.c +// +// Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. +// Revisions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com). All rights reserved. +// Portions Copyright 2009 The Go Authors. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// +build arm 386 + +package runtime + +const ( + sign32 = 1 << (32 - 1) + sign64 = 1 << (64 - 1) +) diff --git a/hack/go1_7_3/runtime/write_err_android.go b/hack/go1_7_3/runtime/write_err_android.go new file mode 100644 index 0000000..50aaf92 --- /dev/null +++ b/hack/go1_7_3/runtime/write_err_android.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +// Prior to Android-L, logging was done through writes to /dev/log files implemented +// in kernel ring buffers. In Android-L, those /dev/log files are no longer +// accessible and logging is done through a centralized user-mode logger, logd. +// +// https://android.googlesource.com/platform/system/core/+/master/liblog/logd_write.c +type loggerType int32 + +const ( + unknown loggerType = iota + legacy + logd +) diff --git a/hack/go1_7_3/runtime/zcallback_windows.go b/hack/go1_7_3/runtime/zcallback_windows.go new file mode 100644 index 0000000..2138906 --- /dev/null +++ b/hack/go1_7_3/runtime/zcallback_windows.go @@ -0,0 +1,5 @@ +// generated by wincallback.go; run go generate + +package runtime + +const cb_max = 2000 diff --git a/hack/packagewriter.go b/hack/packagewriter.go index d987a4c..d4e6322 100644 --- a/hack/packagewriter.go +++ b/hack/packagewriter.go @@ -37,3 +37,13 @@ func (pw *PackageWriter) CreateFile(filename string) (*os.File, error) { fullPath := filepath.Join(pw.output, filename) return os.Create(fullPath) } + +func (pw *PackageWriter) MustCreateFile(filename string) *os.File { + file, err := pw.CreateFile(filename) + + if err != nil { + panic(err) + } + + return file +} diff --git a/hack/runtime_hacker.go b/hack/runtime_hacker.go index 82ab4b2..acff6aa 100644 --- a/hack/runtime_hacker.go +++ b/hack/runtime_hacker.go @@ -5,7 +5,10 @@ package main import ( + "fmt" + "github.com/huandu/goroutine/copyright" + "github.com/huandu/goroutine/version" ) type RuntimeHacker struct{} @@ -16,15 +19,15 @@ func (h *RuntimeHacker) Package() string { func (h *RuntimeHacker) Hack(pw *PackageWriter) { h.genHackedtypes(pw) -} - -func (h *RuntimeHacker) genHackedtypes(pw *PackageWriter) { - file, err := pw.CreateFile("hackedtypes.go") - if err != nil { - panic(err) + // This hack only applies to go1.7.2 or later. + if pw.Context.Version.Compare(version.Version{"1", "7", "2"}) >= 0 { + h.genHackedBuildruntime(pw) } +} +func (h *RuntimeHacker) genHackedtypes(pw *PackageWriter) { + file := pw.MustCreateFile("hackedtypes.go") defer file.Close() file.WriteString(copyright.COPYRIGHT) file.WriteString(` @@ -40,3 +43,21 @@ func (g *Goroutine) Goid() int64 { } `) } + +func (h *RuntimeHacker) genHackedBuildruntime(pw *PackageWriter) { + file := pw.MustCreateFile("internal/sys/hackedbuildruntime.go") + defer file.Close() + file.WriteString(copyright.COPYRIGHT) + file.WriteString(` + +package sys + +`) + //file.WriteString(fmt.Sprintf("const DefaultGoroot = `%s`\n", runtime.GOROOT())) + file.WriteString(fmt.Sprintf("const TheVersion = `%s`\n", pw.Context.Version)) + //file.WriteString(fmt.Sprintf("const Goexperiment = `%s`\n", )) + + // HACK(huandu): Always assume current build is optimized version. + // If code is built with `-gcflags -N`, this hack fails. + file.WriteString(fmt.Sprintf("const StackGuardMultiplier = %d\n", 1)) +} diff --git a/info.go b/info.go index 0d64b83..3d8f6e7 100644 --- a/info.go +++ b/info.go @@ -18,6 +18,8 @@ import ( runtime1_6_3 "github.com/huandu/goroutine/hack/go1_6_3/runtime" runtime1_7 "github.com/huandu/goroutine/hack/go1_7/runtime" runtime1_7_1 "github.com/huandu/goroutine/hack/go1_7_1/runtime" + runtime1_7_2 "github.com/huandu/goroutine/hack/go1_7_2/runtime" + runtime1_7_3 "github.com/huandu/goroutine/hack/go1_7_3/runtime" ) func getg() unsafe.Pointer @@ -50,6 +52,10 @@ func GoroutineId() int64 { return (*runtime1_7.Goroutine)(gp).Goid() case _GO_VERSION1_7_1: return (*runtime1_7_1.Goroutine)(gp).Goid() + case _GO_VERSION1_7_2: + return (*runtime1_7_2.Goroutine)(gp).Goid() + case _GO_VERSION1_7_3: + return (*runtime1_7_3.Goroutine)(gp).Goid() default: panic("unsupported go version " + goVersion().String()) diff --git a/versions.go b/versions.go index 2ce416d..64646c0 100644 --- a/versions.go +++ b/versions.go @@ -26,6 +26,8 @@ const ( _GO_VERSION1_6_3 _GO_VERSION1_7 _GO_VERSION1_7_1 + _GO_VERSION1_7_2 + _GO_VERSION1_7_3 ) var ( @@ -62,6 +64,10 @@ func init() { _goVersionCode = _GO_VERSION1_7 } else if _goVersion.Equal("1", "7", "1") { _goVersionCode = _GO_VERSION1_7_1 + } else if _goVersion.Equal("1", "7", "2") { + _goVersionCode = _GO_VERSION1_7_2 + } else if _goVersion.Equal("1", "7", "3") { + _goVersionCode = _GO_VERSION1_7_3 } } @@ -72,3 +78,4 @@ func goVersionCode() _GoVersion { func goVersion() version.Version { return _goVersion } +