| 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 |
const MaxArgs = maxArgs |
| 15 |
|
| 16 |
var ( |
| 17 |
OsYield = osyield |
| 18 |
TimeBeginPeriodRetValue = &timeBeginPeriodRetValue |
| 19 |
) |
| 20 |
|
| 21 |
func NumberOfProcessors() int32 { |
| 22 |
var info systeminfo |
| 23 |
stdcall1(_GetSystemInfo, uintptr(unsafe.Pointer(&info))) |
| 24 |
return int32(info.dwnumberofprocessors) |
| 25 |
} |
| 26 |
|
| 27 |
type ContextStub struct { |
| 28 |
context |
| 29 |
} |
| 30 |
|
| 31 |
func (c ContextStub) GetPC() uintptr { |
| 32 |
return c.ip() |
| 33 |
} |
| 34 |
|
| 35 |
func NewContextStub() *ContextStub { |
| 36 |
var ctx context |
| 37 |
ctx.set_ip(sys.GetCallerPC()) |
| 38 |
ctx.set_sp(sys.GetCallerSP()) |
| 39 |
ctx.set_fp(getcallerfp()) |
| 40 |
return &ContextStub{ctx} |
| 41 |
} |