(
&self,
host_address: *mut u8,
guest_address: u64,
size: usize,
measure: bool,
)
| 1374 | /// `host_address` must be valid for `size` bytes |
| 1375 | #[cfg(feature = "tdx")] |
| 1376 | unsafe fn tdx_init_memory_region( |
| 1377 | &self, |
| 1378 | host_address: *mut u8, |
| 1379 | guest_address: u64, |
| 1380 | size: usize, |
| 1381 | measure: bool, |
| 1382 | ) -> vm::Result<()> { |
| 1383 | #[repr(C)] |
| 1384 | struct TdxInitMemRegion { |
| 1385 | host_address: u64, |
| 1386 | guest_address: u64, |
| 1387 | pages: u64, |
| 1388 | } |
| 1389 | let data = TdxInitMemRegion { |
| 1390 | host_address: host_address as _, |
| 1391 | guest_address, |
| 1392 | pages: (size / 4096).try_into().unwrap(), |
| 1393 | }; |
| 1394 | |
| 1395 | tdx_command( |
| 1396 | &self.fd.as_raw_fd(), |
| 1397 | TdxCommand::InitMemRegion, |
| 1398 | u32::from(measure), |
| 1399 | (&raw const data).cast(), |
| 1400 | ) |
| 1401 | .map_err(vm::HypervisorVmError::InitMemRegionTdx) |
| 1402 | } |
| 1403 | |
| 1404 | /// Downcast to the underlying KvmVm type |
| 1405 | fn as_any(&self) -> &dyn Any { |
nothing calls this directly
no test coverage detected