예제 #1
0
        /// <summary>
        /// Initializes the specific x86 stuff
        /// </summary>
        public static void Init()
        {
            GDT.Init();
            PIC.Remap();
            IDT.Init();
            IRQ.Init();

            PhysicalMemoryManager.Init();
            Paging.Init();
            Heap.InitRealHeap();

            IOApicManager.Init();
            Acpi.Init();
            LocalApic.InitLocalAPIC();
            IOApicManager.InitIOApics();

            CMOS.UpdateTime();
            Time.FullTicks = Time.CalculateEpochTime();
        }
예제 #2
0
        /// <summary>
        /// Sets an interrupt handler for a PCI device
        /// </summary>
        /// <param name="dev">The device</param>
        public static void SetInterruptHandler(PciDevice dev, IRQ.IRQHandler handler)
        {
            // Get IRQ routing data from table
            PciIRQEntry irq    = m_irqTable[(dev.Slot * PCI_PINS) + (dev.IRQPin - 1)];
            uint        irqNum = irq.Irq;

            // If no routing exists, use the interrupt line
            if (irqNum == 0)
            {
                irqNum = dev.IRQLine;
            }

            // First set the IRQ handler to avoid race conditions
            IRQ.SetHandler(irqNum, handler);
            IOApicManager.CreateEntry(irqNum, irqNum, irq.Flags);

            // Info
            Console.Write("[PCI] Set device to use IRQ ");
            Console.WriteNum((int)irqNum);
            Console.Write('\n');
        }