]> Cypherpunks.ru repositories - gostls13.git/blob - src/runtime/os_linux_386.go
[dev.cc] runtime: fix lfstack for amd64 addresses in top half of addr space
[gostls13.git] / src / runtime / os_linux_386.go
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.
4
5 package runtime
6
7 import "unsafe"
8
9 const (
10         _AT_NULL    = 0
11         _AT_RANDOM  = 25
12         _AT_SYSINFO = 32
13 )
14
15 var _vdso uint32
16
17 //go:nosplit
18 func linux_setup_vdso(argc int32, argv **byte) {
19         // skip over argv, envv to get to auxv
20         n := argc + 1
21         for argv_index(argv, n) != nil {
22                 n++
23         }
24         n++
25         auxv := (*[1 << 28]uint32)(add(unsafe.Pointer(argv), uintptr(n)*ptrSize))
26
27         for i := 0; auxv[i] != _AT_NULL; i += 2 {
28                 switch auxv[i] {
29                 case _AT_SYSINFO:
30                         _vdso = auxv[i+1]
31
32                 case _AT_RANDOM:
33                         startup_random_data = (*byte)(unsafe.Pointer(uintptr(auxv[i+1])))
34                         startup_random_data_len = 16
35                 }
36         }
37 }