x86: Make unsuccessful CPUID instructions zero the result.
The previous implementation left the registers unmodified which is
technically correct since there is no defined behavior in that case or
a fault to raise. That would make what happened when the following code
consumed the result unpredictable because it would depend on what junk
values were left in the registers. This was originally not a problem
since the space of supported functions were tightly packed, but someone
added a new function with a gap without adjusting this behavior.
This change makes CPUID zero out RAX, RBX, RCX, and RDX when it fails.
That should be more predictable and cause less flakey failures.
Reviewed-by: Jason Lowe-Power <firstname.lastname@example.org>
Reviewed-by: Pouya Fotouhi <email@example.com>
Maintainer: Gabe Black <firstname.lastname@example.org>
Tested-by: kokoro <email@example.com>
1 file changed