(local_apic_address: PhysAddr)
| 30 | |
| 31 | impl LocalApic { |
| 32 | pub unsafe fn init(local_apic_address: PhysAddr) -> &'static Self { |
| 33 | disable_pic(); |
| 34 | |
| 35 | let virtaddr: VirtAddr = phys_to_virt(local_apic_address); |
| 36 | let this = LOCAL_APIC.get_or_init(|| Self { |
| 37 | virt_address: virtaddr, |
| 38 | }); |
| 39 | log::info!("LocalApic {:?}", virtaddr); |
| 40 | |
| 41 | let mut msr = Msr::new(0x1B); |
| 42 | let r = msr.read(); |
| 43 | msr.write(r | (1 << 11)); |
| 44 | |
| 45 | this.write(0xF0, this.read(0xF0) | 0x1FF); |
| 46 | this |
| 47 | } |
| 48 | |
| 49 | unsafe fn read(&self, reg: u32) -> u32 { |
| 50 | volatile_load((self.virt_address.as_u64() + reg as u64) as *const u32) |
nothing calls this directly
no test coverage detected