コード例 #1
0
ファイル: Syscalls.cs プロジェクト: valentinbreiz/Sharpen
        /// <summary>
        /// Reboots the computer
        /// </summary>
        /// <returns>The error code</returns>
        public static ErrorCode Reboot()
        {
            if (Tasking.CurrentTask.UID > 0)
            {
                return(ErrorCode.EPERM);
            }

            Acpi.Reboot();
            return(ErrorCode.SUCCESS);
        }
コード例 #2
0
ファイル: Syscalls.cs プロジェクト: valentinbreiz/Sharpen
        /// <summary>
        /// Shuts down the computer
        /// </summary>
        /// <returns>The error code</returns>
        public static ErrorCode Shutdown()
        {
            if (Tasking.CurrentTask.UID > 0)
            {
                return(ErrorCode.EPERM);
            }

            Acpi.Shutdown();
            return(ErrorCode.SUCCESS);
        }
コード例 #3
0
ファイル: X86Arch.cs プロジェクト: valentinbreiz/Sharpen
        /// <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();
        }
コード例 #4
0
        /// <summary>
        /// Creates an ISA IRQ redirection entry
        /// </summary>
        /// <param name="src">The source interrupt</param>
        /// <param name="dst">The destination interrupt</param>
        public static void CreateISARedirection(uint src, uint dst)
        {
            Acpi.ISAOverride irq = Acpi.GetISARedirection(src);

            // Polarity and Trigger
            ulong flags = 0;

            if (irq.Polarity == 0 || irq.Polarity == 3)
            {
                flags |= IOApic.IOAPIC_REDIR_POLARITY_LOW;
            }
            else
            {
                flags |= IOApic.IOAPIC_REDIR_POLARITY_HIGH;
            }

            if (irq.Trigger == 0 || irq.Trigger == 1)
            {
                flags |= IOApic.IOAPIC_REDIR_TRIGGER_EDGE;
            }
            else
            {
                flags |= IOApic.IOAPIC_REDIR_TRIGGER_LEVEL;
            }

            // No override?
            uint irqNum = (irq.GSI == 0) ? src : dst;

            IOApic responsible = GetIOApicFor(irqNum);

            if (responsible == null)
            {
                Console.Write("[IOAPIC] No IO Apic was found responsible for pin ");
                Console.WriteNum((int)src);
                Console.Write("->");
                Console.WriteNum((int)dst);
                Console.Write('\n');
                return;
            }

            responsible.CreateRedirection(irqNum - responsible.GlobalSystemInterruptBase, 32 + dst, flags);
        }
コード例 #5
0
ファイル: Acpica.cs プロジェクト: valentinbreiz/Sharpen
 public static ulong AcpiOsGetRootPointer()
 {
     return((uint)Acpi.FindRSDP());
 }