github.com/riscv/riscv-go@v0.0.0-20200123204226-124ebd6fcc8e/src/runtime/os_linux_s390x.go (about)

     1  // Copyright 2016 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 (
     8  	"runtime/internal/sys"
     9  )
    10  
    11  const (
    12  	// bit masks taken from bits/hwcap.h
    13  	_HWCAP_S390_VX = 2048 // vector facility
    14  )
    15  
    16  // facilities is padded to avoid false sharing.
    17  type facilities struct {
    18  	_     [sys.CacheLineSize]byte
    19  	hasVX bool // vector facility
    20  	_     [sys.CacheLineSize]byte
    21  }
    22  
    23  // cpu indicates the availability of s390x facilities that can be used in
    24  // Go assembly but are optional on models supported by Go.
    25  var cpu facilities
    26  
    27  func archauxv(tag, val uintptr) {
    28  	switch tag {
    29  	case _AT_HWCAP: // CPU capability bit flags
    30  		cpu.hasVX = val&_HWCAP_S390_VX != 0
    31  	}
    32  }