...

Source file src/internal/cpu/cpu_arm64_openbsd.go

Documentation: internal/cpu

     1  // Copyright 2022 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  //go:build arm64
     6  
     7  package cpu
     8  
     9  const (
    10  	// From OpenBSD's sys/sysctl.h.
    11  	_CTL_MACHDEP = 7
    12  
    13  	// From OpenBSD's machine/cpu.h.
    14  	_CPU_ID_AA64ISAR0 = 2
    15  	_CPU_ID_AA64ISAR1 = 3
    16  )
    17  
    18  //go:noescape
    19  func sysctlUint64(mib []uint32) (uint64, bool)
    20  
    21  func osInit() {
    22  	// Get ID_AA64ISAR0 from sysctl.
    23  	isar0, ok := sysctlUint64([]uint32{_CTL_MACHDEP, _CPU_ID_AA64ISAR0})
    24  	if !ok {
    25  		return
    26  	}
    27  	parseARM64SystemRegisters(isar0)
    28  }
    29  

View as plain text