hypervisor: x86: provide a generic DescriptorTable structure

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu
2022-07-14 21:48:08 +00:00
committed by Liu Wei
parent 75797827d5
commit d2b194c4f1
3 changed files with 48 additions and 4 deletions

View File

@@ -7,7 +7,7 @@
// Copyright 2018-2019 CrowdStrike, Inc.
//
//
use crate::arch::x86::{SegmentRegister, StandardRegisters};
use crate::arch::x86::{DescriptorTable, SegmentRegister, StandardRegisters};
use serde::{Deserialize, Serialize};
use std::fmt;
@@ -23,7 +23,7 @@ pub use {
mshv_bindings::Msrs as MsrEntries, mshv_bindings::Msrs,
mshv_bindings::SegmentRegister as MshvSegmentRegister, mshv_bindings::SpecialRegisters,
mshv_bindings::StandardRegisters as MshvStandardRegisters, mshv_bindings::SuspendRegisters,
mshv_bindings::VcpuEvents, mshv_bindings::XSave as Xsave,
mshv_bindings::TableRegister, mshv_bindings::VcpuEvents, mshv_bindings::XSave as Xsave,
mshv_bindings::Xcrs as ExtendedControlRegisters,
};
@@ -155,3 +155,21 @@ impl From<MshvSegmentRegister> for SegmentRegister {
}
}
}
impl From<DescriptorTable> for TableRegister {
fn from(dt: DescriptorTable) -> Self {
Self {
base: dt.base,
limit: dt.limit,
}
}
}
impl From<TableRegister> for DescriptorTable {
fn from(dt: TableRegister) -> Self {
Self {
base: dt.base,
limit: dt.limit,
}
}
}