MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / get_msrs

Method get_msrs

hypervisor/src/kvm/mod.rs:2299–2315  ·  view source on GitHub ↗

Returns the model-specific registers (MSR) for this vCPU.

(&self, msrs: &mut Vec<MsrEntry>)

Source from the content-addressed store, hash-verified

2297 /// Returns the model-specific registers (MSR) for this vCPU.
2298 ///
2299 fn get_msrs(&self, msrs: &mut Vec<MsrEntry>) -> cpu::Result<usize> {
2300 let kvm_msrs: Vec<kvm_msr_entry> = msrs.iter().map(|e| (*e).into()).collect();
2301 let mut kvm_msrs = MsrEntries::from_entries(&kvm_msrs).unwrap();
2302 let succ = self
2303 .fd
2304 .get_msrs(&mut kvm_msrs)
2305 .map_err(|e| cpu::HypervisorCpuError::GetMsrEntries(e.into()))?;
2306
2307 msrs[..succ].copy_from_slice(
2308 &kvm_msrs.as_slice()[..succ]
2309 .iter()
2310 .map(|e| (*e).into())
2311 .collect::<Vec<MsrEntry>>(),
2312 );
2313
2314 Ok(succ)
2315 }
2316
2317 #[cfg(target_arch = "x86_64")]
2318 ///

Callers 3

cpu_write_vmm_noteMethod · 0.45
test_setup_msrsFunction · 0.45
stateMethod · 0.45

Calls 3

iterMethod · 0.80
as_sliceMethod · 0.80
mapMethod · 0.45

Tested by 1

test_setup_msrsFunction · 0.36