runtime: scan register backing store on ia64
[official-gcc.git] / libgo / go / runtime / os_gccgo.go
blob5709555acdb1edde5c03c1883fedb8094f8ff61b
1 // Copyright 2009 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.
5 package runtime
7 import (
8 "unsafe"
11 // For C code to call:
12 //go:linkname minit runtime.minit
14 func goenvs() {
15 goenvs_unix()
18 // Called to initialize a new m (including the bootstrap m).
19 // Called on the parent thread (main thread in case of bootstrap), can allocate memory.
20 func mpreinit(mp *m) {
21 mp.gsignal = malg(true, true, &mp.gsignalstack, &mp.gsignalstacksize)
22 mp.gsignal.m = mp
25 // minit is called to initialize a new m (including the bootstrap m).
26 // Called on the new thread, cannot allocate memory.
27 func minit() {
28 minitSignals()
30 // FIXME: We should set _g_.m.procid here.
33 // Called from dropm to undo the effect of an minit.
34 //go:nosplit
35 //go:nowritebarrierrec
36 func unminit() {
37 unminitSignals()
40 var urandom_dev = []byte("/dev/urandom\x00")
42 func getRandomData(r []byte) {
43 if startupRandomData != nil {
44 n := copy(r, startupRandomData)
45 extendRandom(r, n)
46 return
48 fd := open(&urandom_dev[0], 0 /* O_RDONLY */, 0)
49 n := read(fd, unsafe.Pointer(&r[0]), int32(len(r)))
50 closefd(fd)
51 extendRandom(r, int(n))