mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-12-25 04:14:06 +00:00
kvm: fix test for getting and setting xcrs
The extension condition was reversed, also SSE is not enabled by default in guest VCPU, so limit the test to setting the FP bit. BUG=b:79692549 TEST=cargo test -p kvm Change-Id: I2959fe7dfff79703777d6254deae817fea892b00 Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1062645 Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
parent
52ba4e5c64
commit
10668e6387
1 changed files with 2 additions and 5 deletions
|
@ -1587,7 +1587,7 @@ mod tests {
|
|||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
fn xcrs() {
|
||||
let kvm = Kvm::new().unwrap();
|
||||
if kvm.check_extension(Cap::Xcrs) {
|
||||
if !kvm.check_extension(Cap::Xcrs) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1595,10 +1595,7 @@ mod tests {
|
|||
let vm = Vm::new(&kvm, gm).unwrap();
|
||||
let vcpu = Vcpu::new(0, &kvm, &vm).unwrap();
|
||||
let mut xcrs = vcpu.get_xcrs().unwrap();
|
||||
xcrs.nr_xcrs = 1;
|
||||
xcrs.flags = 0;
|
||||
// We assume anything we run on has SSE (bit 1). FP bit (bit 0) must always be set.
|
||||
xcrs.xcrs[0].value |= 3;
|
||||
xcrs.xcrs[0].value = 1;
|
||||
vcpu.set_xcrs(&xcrs).unwrap();
|
||||
let xcrs2 = vcpu.get_xcrs().unwrap();
|
||||
assert_eq!(xcrs.xcrs[0].value, xcrs2.xcrs[0].value);
|
||||
|
|
Loading…
Reference in a new issue