Russ Cox | 7d51607 | 2014-12-05 16:17:09 -0500 | [diff] [blame] | 1 | // Copyright 2013 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package runtime |
| 6 | |
| 7 | import "unsafe" |
| 8 | |
| 9 | func lwp_mcontext_init(mc *mcontextt, stk unsafe.Pointer, mp *m, gp *g, fn uintptr) { |
| 10 | // Machine dependent mcontext initialisation for LWP. |
| 11 | mc.__gregs[_REG_R15] = uint32(funcPC(lwp_tramp)) |
| 12 | mc.__gregs[_REG_R13] = uint32(uintptr(stk)) |
| 13 | mc.__gregs[_REG_R0] = uint32(uintptr(unsafe.Pointer(mp))) |
| 14 | mc.__gregs[_REG_R1] = uint32(uintptr(unsafe.Pointer(gp))) |
| 15 | mc.__gregs[_REG_R2] = uint32(fn) |
| 16 | } |
| 17 | |
| 18 | func checkgoarm() { |
| 19 | // TODO(minux) |
| 20 | } |
| 21 | |
| 22 | //go:nosplit |
| 23 | func cputicks() int64 { |
| 24 | // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand1(). |
| 25 | // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler. |
| 26 | // TODO: need more entropy to better seed fastrand1. |
| 27 | return nanotime() |
| 28 | } |