Don't use xgetbv on CPUs that don't support it.

Fixes #9996.

PiperOrigin-RevId: 606711566
This commit is contained in:
Konstantin Bogomolov
2024-02-13 12:38:38 -08:00
committed by gVisor bot
parent c2bcdb73aa
commit 5300f3d305
+5 -3
View File
@@ -401,9 +401,11 @@ func (fs FeatureSet) ExtendedStateSize() (size, align uint) {
// AMXExtendedStateSize returns the number of bytes within the "extended state"
// area that is used for AMX.
func (fs FeatureSet) AMXExtendedStateSize() uint {
xcr0 := xgetbv(0)
if (xcr0 & XCR0AMXMask) != 0 {
return uint(amxTileCfgSize + amxTileDataSize)
if fs.UseXsave() {
xcr0 := xgetbv(0)
if (xcr0 & XCR0AMXMask) != 0 {
return uint(amxTileCfgSize + amxTileDataSize)
}
}
return 0
}