mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
hypervisor: aarch64: Use offset_of for nested fields
`std::mem::offset_of` could be used for calculating nested fields, use this feature to shorten aarch64 reg offset calculation. Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
@@ -2963,19 +2963,19 @@ mod tests {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[cfg(feature = "kvm")]
|
||||
use std::mem;
|
||||
use std::{mem, mem::offset_of};
|
||||
|
||||
use arch::layout;
|
||||
use hypervisor::arch::aarch64::regs::MPIDR_EL1;
|
||||
#[cfg(feature = "kvm")]
|
||||
use hypervisor::arm64_core_reg_id;
|
||||
#[cfg(feature = "kvm")]
|
||||
use hypervisor::kvm::aarch64::is_system_register;
|
||||
#[cfg(feature = "kvm")]
|
||||
use hypervisor::kvm::kvm_bindings::{
|
||||
user_pt_regs, KVM_REG_ARM64, KVM_REG_ARM64_SYSREG, KVM_REG_ARM_CORE, KVM_REG_SIZE_U64,
|
||||
};
|
||||
use hypervisor::HypervisorCpuError;
|
||||
#[cfg(feature = "kvm")]
|
||||
use hypervisor::{arm64_core_reg_id, offset_of};
|
||||
|
||||
#[test]
|
||||
fn test_setup_regs() {
|
||||
|
||||
Reference in New Issue
Block a user