Tobias Klauser | fead790 | 2019-03-11 09:36:29 +0100 | [diff] [blame] | 1 | // Copyright 2019 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 | |
Russ Cox | 9a76102 | 2021-02-19 22:57:36 -0500 | [diff] [blame] | 5 | //go:build aix |
Clément Chigot | 1151b9d | 2020-05-13 10:39:30 +0200 | [diff] [blame] | 6 | // +build aix |
Tobias Klauser | fead790 | 2019-03-11 09:36:29 +0100 | [diff] [blame] | 7 | |
| 8 | package cpu |
| 9 | |
Tobias Klauser | fead790 | 2019-03-11 09:36:29 +0100 | [diff] [blame] | 10 | const ( |
| 11 | // getsystemcfg constants |
| 12 | _SC_IMPL = 2 |
| 13 | _IMPL_POWER8 = 0x10000 |
| 14 | _IMPL_POWER9 = 0x20000 |
| 15 | ) |
| 16 | |
Polina Osadcha | 0cf7623 | 2020-07-09 09:47:37 +0300 | [diff] [blame] | 17 | func archInit() { |
Brad Fitzpatrick | 3626398 | 2019-05-28 09:09:44 -0700 | [diff] [blame] | 18 | impl := getsystemcfg(_SC_IMPL) |
Tobias Klauser | fead790 | 2019-03-11 09:36:29 +0100 | [diff] [blame] | 19 | if impl&_IMPL_POWER8 != 0 { |
| 20 | PPC64.IsPOWER8 = true |
| 21 | } |
| 22 | if impl&_IMPL_POWER9 != 0 { |
Tobias Klauser | b0526f3 | 2021-05-10 22:48:28 +0200 | [diff] [blame] | 23 | PPC64.IsPOWER8 = true |
Tobias Klauser | fead790 | 2019-03-11 09:36:29 +0100 | [diff] [blame] | 24 | PPC64.IsPOWER9 = true |
| 25 | } |
| 26 | |
| 27 | Initialized = true |
| 28 | } |
Brad Fitzpatrick | 3626398 | 2019-05-28 09:09:44 -0700 | [diff] [blame] | 29 | |
| 30 | func getsystemcfg(label int) (n uint64) { |
| 31 | r0, _ := callgetsystemcfg(label) |
| 32 | n = uint64(r0) |
| 33 | return |
| 34 | } |