mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-09 20:04:20 +00:00
hypervisor: fix set_efer test
BUG=b:245567489 TEST=cargo t --features win64,whpx -p hypervisor --no-default-features -- --test-threads=1 Change-Id: Idf9c51cbc6162ccf5855612957e2db0194de91ec Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3880625 Reviewed-by: Colin Downs-Razouk <colindr@google.com> Commit-Queue: Vikram Auradkar <auradkar@google.com> Tested-by: Vikram Auradkar <auradkar@google.com> Auto-Submit: Vikram Auradkar <auradkar@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
f1e3c34521
commit
cb73ecffd8
1 changed files with 9 additions and 0 deletions
|
@ -1507,6 +1507,9 @@ mod tests {
|
|||
const EFER_SCE: u64 = 0x00000001;
|
||||
const EFER_LME: u64 = 0x00000100;
|
||||
const EFER_LMA: u64 = 0x00000400;
|
||||
const X86_CR0_PE: u64 = 0x1;
|
||||
const X86_CR0_PG: u64 = 0x80000000;
|
||||
const X86_CR4_PAE: u64 = 0x20;
|
||||
|
||||
let cpu_count = 1;
|
||||
let mem =
|
||||
|
@ -1519,12 +1522,18 @@ mod tests {
|
|||
assert_eq!(sregs.efer, 0);
|
||||
|
||||
// Enable and activate long mode
|
||||
sregs.cr0 |= X86_CR0_PE; // enable protected mode
|
||||
sregs.cr0 |= X86_CR0_PG; // enable paging
|
||||
sregs.cr4 |= X86_CR4_PAE; // enable physical address extension
|
||||
sregs.efer = EFER_LMA | EFER_LME;
|
||||
vcpu.set_sregs(&sregs).expect("failed to set sregs");
|
||||
|
||||
// Verify that setting stuck
|
||||
let sregs = vcpu.get_sregs().expect("failed to get sregs");
|
||||
assert_eq!(sregs.efer, EFER_LMA | EFER_LME);
|
||||
assert_eq!(sregs.cr0 & X86_CR0_PE, X86_CR0_PE);
|
||||
assert_eq!(sregs.cr0 & X86_CR0_PG, X86_CR0_PG);
|
||||
assert_eq!(sregs.cr4 & X86_CR4_PAE, X86_CR4_PAE);
|
||||
|
||||
let mut efer_reg = vec![Register {
|
||||
id: MSR_EFER,
|
||||
|
|
Loading…
Reference in a new issue