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

Method ioapic_read

devices/src/ioapic.rs:298–324  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

296 }
297
298 fn ioapic_read(&self) -> u32 {
299 debug!("IOAPIC_R reg 0x{:x}", self.reg_sel);
300
301 match self.reg_sel as u8 {
302 IOAPIC_REG_VERSION => IOAPIC_VERSION_ID,
303 IOAPIC_REG_ID | IOAPIC_REG_ARBITRATION_ID => (self.id_reg & 0xf) << 24,
304 IOWIN_OFF..=REG_MAX_OFFSET => {
305 let (index, is_high_bits) = decode_irq_from_selector(self.reg_sel as u8);
306 if index > NUM_IOAPIC_PINS {
307 warn!("IOAPIC index out of range: {index}");
308 return 0;
309 }
310 if is_high_bits {
311 (self.reg_entries[index] >> 32) as u32
312 } else {
313 (self.reg_entries[index] & 0xffff_ffff) as u32
314 }
315 }
316 _ => {
317 error!(
318 "IOAPIC: invalid read from register offset 0x{:x}",
319 self.reg_sel
320 );
321 0
322 }
323 }
324 }
325
326 fn state(&self) -> IoapicState {
327 IoapicState {

Callers 1

readMethod · 0.80

Calls 1

decode_irq_from_selectorFunction · 0.85

Tested by

no test coverage detected