github.com/primecitizens/pcz/std@v0.2.1/core/cpu/cpu_ppc64x_linux.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 // 4 // Copyright 2020 The Go Authors. All rights reserved. 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file. 7 8 //go:build (ppc64 || ppc64le) && linux 9 10 package cpu 11 12 // ppc64 doesn't have a 'cpuid' equivalent, so we rely on HWCAP/HWCAP2. 13 // These are initialized by archauxv and should not be changed after they are 14 // initialized. 15 var ( 16 HWCap uint 17 HWCap2 uint 18 ) 19 20 // HWCAP bits. These are exposed by Linux. 21 const ( 22 // ISA Level 23 hwcap2_ARCH_2_07 = 0x80000000 24 hwcap2_ARCH_3_00 = 0x00800000 25 hwcap2_ARCH_3_1 = 0x00040000 26 27 // CPU features 28 hwcap2_DARN = 0x00200000 29 hwcap2_SCV = 0x00100000 30 ) 31 32 func osinit() { 33 PPC64.IsPOWER8 = isSet(HWCap2, hwcap2_ARCH_2_07) 34 PPC64.IsPOWER9 = isSet(HWCap2, hwcap2_ARCH_3_00) 35 PPC64.IsPOWER10 = isSet(HWCap2, hwcap2_ARCH_3_1) 36 PPC64.HasDARN = isSet(HWCap2, hwcap2_DARN) 37 PPC64.HasSCV = isSet(HWCap2, hwcap2_SCV) 38 }