MCPcopy Create free account
hub / github.com/Ruddle/Fomos / init

Method init

bootloader/kernel/src/local_apic.rs:32–47  ·  view source on GitHub ↗
(local_apic_address: PhysAddr)

Source from the content-addressed store, hash-verified

30
31impl 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)

Callers

nothing calls this directly

Calls 4

disable_picFunction · 0.85
phys_to_virtFunction · 0.85
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected