Source file src/runtime/export_windows_test.go

     1  // Copyright 2014 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Export guts for testing.
     6  
     7  package runtime
     8  
     9  import (
    10  	"internal/runtime/sys"
    11  	"unsafe"
    12  )
    13  
    14  var (
    15  	OsYield                 = osyield
    16  	TimeBeginPeriodRetValue = &timeBeginPeriodRetValue
    17  )
    18  
    19  func NumberOfProcessors() int32 {
    20  	var info systeminfo
    21  	stdcall(_GetSystemInfo, uintptr(unsafe.Pointer(&info)))
    22  	return int32(info.dwnumberofprocessors)
    23  }
    24  
    25  type ContextStub struct {
    26  	context
    27  }
    28  
    29  func (c ContextStub) GetPC() uintptr {
    30  	return c.ip()
    31  }
    32  
    33  func NewContextStub() *ContextStub {
    34  	var ctx context
    35  	ctx.set_ip(sys.GetCallerPC())
    36  	ctx.set_sp(sys.GetCallerSP())
    37  	ctx.set_fp(getcallerfp())
    38  	return &ContextStub{ctx}
    39  }
    40  

View as plain text