summaryrefslogtreecommitdiff
path: root/libgo/go/runtime/os_linux_s390x.go
blob: 7640273e202d4d3a9e7200dbfd1c08fdd4aa3578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package runtime

import "internal/cpu"

const (
	// bit masks taken from bits/hwcap.h
	_HWCAP_S390_ZARCH  = 2
	_HWCAP_S390_STFLE  = 4
	_HWCAP_S390_MSA    = 8
	_HWCAP_S390_LDISP  = 16
	_HWCAP_S390_EIMM   = 32
	_HWCAP_S390_DFP    = 64
	_HWCAP_S390_ETF3EH = 256
	_HWCAP_S390_VX     = 2048 // vector facility
)

func archauxv(tag, val uintptr) {
	switch tag {
	case _AT_HWCAP: // CPU capability bit flags
		cpu.S390X.HasZArch = val&_HWCAP_S390_ZARCH != 0
		cpu.S390X.HasSTFLE = val&_HWCAP_S390_STFLE != 0
		cpu.S390X.HasMSA = val&_HWCAP_S390_MSA != 0
		cpu.S390X.HasLDisp = val&_HWCAP_S390_LDISP != 0
		cpu.S390X.HasEImm = val&_HWCAP_S390_EIMM != 0
		cpu.S390X.HasDFP = val&_HWCAP_S390_DFP != 0
		cpu.S390X.HasETF3Enhanced = val&_HWCAP_S390_ETF3EH != 0
		cpu.S390X.HasVX = val&_HWCAP_S390_VX != 0
	}
}