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

Method set_config_address

pci/src/bus.rs:359–376  ·  view source on GitHub ↗
(&mut self, offset: u64, data: &[u8])

Source from the content-addressed store, hash-verified

357 }
358
359 fn set_config_address(&mut self, offset: u64, data: &[u8]) {
360 if offset as usize + data.len() > 4 {
361 return;
362 }
363 let (mask, value): (u32, u32) = match data.len() {
364 1 => (
365 0x0000_00ff << (offset * 8),
366 u32::from(data[0]) << (offset * 8),
367 ),
368 2 => (
369 0x0000_ffff << (offset * 16),
370 ((u32::from(data[1]) << 8) | u32::from(data[0])) << (offset * 16),
371 ),
372 4 => (0xffff_ffff, LittleEndian::read_u32(data)),
373 _ => return,
374 };
375 self.config_address = (self.config_address & !mask) | value;
376 }
377}
378
379impl BusDevice for PciConfigIo {

Callers 1

writeMethod · 0.80

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected