File tree 1 file changed +12
-11
lines changed
1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -113,22 +113,23 @@ pub fn has_cpuid() -> bool {
113
113
# xor with the original eflags sets the bits that
114
114
# have been modified:
115
115
xor $0, $1
116
- # There is a race between popfd (A) and pushfd (B)
117
- # where other bits beyond 21st may have been modified due to
118
- # interrupts, a debugger stepping through the asm, etc.
119
- #
120
- # Therefore, explicitly check whether the 21st bit
121
- # was modified or not:
122
- and $0, 0x200000
123
116
"#
124
117
: "=r" ( result) , "=r" ( _temp)
125
118
:
126
119
: "cc" , "memory"
127
120
: "intel" ) ;
128
- // If result == 0, the 21st bit was not modified and cpuid is
129
- // not available. If cpuid is available, the bit was modified and
130
- // result != 0.
131
- result != 0
121
+ // There is a race between popfd (A) and pushfd (B)
122
+ // where other bits beyond 21st may have been modified due to
123
+ // interrupts, a debugger stepping through the asm, etc.
124
+ //
125
+ // Therefore, explicitly check whether the 21st bit
126
+ // was modified or not.
127
+ //
128
+ // If the result is zero, the cpuid bit was not modified.
129
+ // If the result is 0x200000 (non-zero), then the cpuid
130
+ // was correctly modified and the CPU supports the cpuid
131
+ // instruction:
132
+ ( result & 0x200000 ) != 0
132
133
}
133
134
}
134
135
}
You can’t perform that action at this time.
0 commit comments