Ejemplo n.º 1
0
        public static void SetAPICBase(Pointer apic)
        {
            uint edx = 0;
            uint eax = (uint)(((uint)apic & 0xfffff0000) | IA32_APIC_BASE_MSR_ENABLE);

            /*if (PAE)
             *      edx = (apic >> 32) & 0x0f;*/

            MSR.SetMSR(IA32_APIC_BASE_MSR, (ulong)(edx << 32) | (ulong)eax);
        }
Ejemplo n.º 2
0
        public static Pointer GetAPICBase()
        {
            ulong msr = MSR.GetMSR(IA32_APIC_BASE_MSR);

            uint eax = (uint)msr;
            uint edx = (uint)(msr >> 32);

            /*if (PAE)
             *      return (eax & 0xfffff000) | ((edx & 0x0f) << 32);
             * else
             */return((Pointer)(eax & 0xfffff000));
        }
Ejemplo n.º 3
0
        public static void Setup(Pointer localApic, Pointer ioApic)
        {
            LocalApic = localApic;
            IOApic    = ioApic;

            if (!MSR.HasMSR())
            {
                return;
            }

            // Hardware enable the Local APIC if it wasn't enabled
            SetAPICBase(GetAPICBase());

            // Set the Spurious Interrupt Vector Register bit 8 to start receiving interrupts
            WriteRegister(0xF0, ReadRegister(0xF0) | IA32_APIC_BASE_MSR_BSP);
        }