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
5package runtime
6
7import "internal/cpu"
8
9const (
10	// bit masks taken from bits/hwcap.h
11	_HWCAP_S390_ZARCH  = 2
12	_HWCAP_S390_STFLE  = 4
13	_HWCAP_S390_MSA    = 8
14	_HWCAP_S390_LDISP  = 16
15	_HWCAP_S390_EIMM   = 32
16	_HWCAP_S390_DFP    = 64
17	_HWCAP_S390_ETF3EH = 256
18	_HWCAP_S390_VX     = 2048 // vector facility
19	_HWCAP_S390_VXE    = 8192
20)
21
22func archauxv(tag, val uintptr) {
23	switch tag {
24	case _AT_HWCAP: // CPU capability bit flags
25		cpu.S390X.HasZARCH = val&_HWCAP_S390_ZARCH != 0
26		cpu.S390X.HasSTFLE = val&_HWCAP_S390_STFLE != 0
27		cpu.S390X.HasLDISP = val&_HWCAP_S390_LDISP != 0
28		cpu.S390X.HasEIMM = val&_HWCAP_S390_EIMM != 0
29		cpu.S390X.HasDFP = val&_HWCAP_S390_DFP != 0
30		cpu.S390X.HasETF3EH = val&_HWCAP_S390_ETF3EH != 0
31		cpu.S390X.HasMSA = val&_HWCAP_S390_MSA != 0
32		cpu.S390X.HasVX = val&_HWCAP_S390_VX != 0
33		cpu.S390X.HasVXE = val&_HWCAP_S390_VXE != 0
34	}
35}
36