cpu: add support for zos/s390x

This adds feature detection that works on the s390x running zos.
There are some differences with Linux (no hwcap, facilities vector available in-memory).
These changes should not affect other platforms.

Fixes golang/go#41984.

Change-Id: Ieabbfafd07367a346a4d279dde0f00aa3fc4321b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/262477
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Trust: Martin Möhrmann <moehrmann@google.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
This commit is contained in:
Bill O'Farrell
2020-10-28 09:49:53 +00:00
committed by Tobias Klauser
parent 0fcbb8f492
commit 708e7fb298
6 changed files with 257 additions and 141 deletions
-17
View File
@@ -74,20 +74,3 @@ func TestPPC64minimalFeatures(t *testing.T) {
}
}
}
func TestS390X(t *testing.T) {
if runtime.GOARCH != "s390x" {
return
}
if testing.Verbose() {
t.Logf("%+v\n", cpu.S390X)
}
// z/Architecture is mandatory
if !cpu.S390X.HasZARCH {
t.Error("HasZARCH expected true, got false")
}
// vector-enhancements require vector facility to be enabled
if cpu.S390X.HasVXE && !cpu.S390X.HasVX {
t.Error("HasVX expected true, got false (VXE is true)")
}
}