Exemplo n.º 1
0
        /// <summary>
        /// Executes the specified parameter.
        /// </summary>
        /// <param name="param">The parameter.</param>
        public override void Execute(string param)
        {
            // Manually initiates a kernel panic
            var xCtx = new Cosmos.Core.INTs.IRQContext();

            Cosmos.Core.INTs.HandleInterrupt_00(ref xCtx);
            //Console.WriteLine("This shouldn't print!");
        }
 public void HandleIRQ(ref Cosmos.Core.INTs.IRQContext aContext)
 {
     if (mHandleKeyboardKey != null)
     {
         byte xScanCode = IO.Port60.Byte;
         bool xReleased = (xScanCode & 0x80) == 0x80;
         if (xReleased)
         {
             xScanCode = (byte)(xScanCode ^ 0x80);
         }
         mHandleKeyboardKey(xScanCode, xReleased);
     }
 }
Exemplo n.º 3
0
        static GUI()
        {
            _canvas     = FullScreenCanvas.GetFullScreenCanvas();
            _pen        = new Pen(Color.White);
            _screenSize = new System.Drawing.Size(1920, 1080);

            _canvas.Mode = new Mode(_screenSize.Width, _screenSize.Height, ColorDepth.ColorDepth32);
            _mouse       = new Mouse();
            _mouse.Initialize((uint)_screenSize.Width, (uint)_screenSize.Height);
            Cosmos.Core.INTs.IRQContext context = new Cosmos.Core.INTs.IRQContext();
            _mouse.HandleMouse(ref context);

            Core.MouseEnabled = true;
        }
Exemplo n.º 4
0
 public static void HandleInterrupt_Default(ref IRQContext aContext)
 {
     if (aContext.Interrupt >= 0x20 && aContext.Interrupt <= 0x2F)
     {
         if (aContext.Interrupt >= 0x28)
         {
             Cosmos.Core.Global.PIC.EoiSlave();
         }
         else
         {
             Cosmos.Core.Global.PIC.EoiMaster();
         }
     }
 }
 public void HandleIRQ(ref Cosmos.Core.INTs.IRQContext aContext)
 {
     if (mHandleKeyboardKey != null)
     {
         byte xScanCode = IO.Port60.Byte;
         bool xReleased = (xScanCode & 0x80) == 0x80;
         if (xReleased)
         {
             xScanCode = (byte)(xScanCode ^ 0x80);
         }
         if (Kernel.current is QTE)
         {
             ((QTE)Kernel.current).GetChar(ConsoleKey.A, 'A');
         }
         mHandleKeyboardKey(xScanCode, xReleased);
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Kernel Panic
        /// </summary>
        public static void Panic(string err, string desc, string lka, ref Cosmos.Core.INTs.IRQContext aContext)
        {
            AConsole.Clear();
            AConsole.Fill(ConsoleColor.Black);
            AConsole.CursorTop = 2;
            AConsole.WriteLineEx("kpanic occurred at :" + lka, ConsoleColor.Black, ConsoleColor.White);
            AConsole.WriteLineEx("Error: " + err, ConsoleColor.Black, ConsoleColor.White);
            AConsole.WriteLineEx("Description: " + desc, ConsoleColor.Black, ConsoleColor.White);
            AConsole.WriteLine("\n");
            AConsole.WriteLine("Debug info:");
            AConsole.WriteLine("\n");
            AConsole.WriteLine("eip: " + aContext.EIP);
            AConsole.WriteLine("eax: " + aContext.EAX + " edx: " + aContext.EDX + " ecx: " + aContext.ECX + " ebx: " + aContext.EBX);
            AConsole.WriteLine("esi: " + aContext.ESI + " edi: " + aContext.EDI + " ebp: " + aContext.EBP + " esp: " + aContext.ESP);

            // Enter an infinite loop
            while (true)
            {
            }
        }
Exemplo n.º 7
0
 public static void Panic(string message, Cosmos.Core.INTs.IRQContext context)
 {
     Console.BackgroundColor = ConsoleColor.Red;
     Console.ForegroundColor = ConsoleColor.White;
     for (int i = 0; i < (25 * 80); i++)
     {
         Console.Write(" ");
     }
     Console.CursorTop  = 1;
     Console.CursorLeft = 0;
     Services.srvman.syslog.Write(new SyslogEntry(SyslogEntry.Type.Kernel, "Kernel", "KERNELPANIC> " + message));
     Out.printf("KERNEL PANIC\n%s\n\n", message);
     Out.printf("Register values:\n");
     Out.printf("EAX: %i  EBP: %i  EBX: %i  ECX: %i  EDI: %i  EDX: %i  EIP: %i  ESI: %i  ESP: %i\n\n",
                context.EAX, context.EBP, context.EBX, context.ECX, context.EDI, context.EDX, context.EIP, context.ESI, context.ESP);
     while (true)
     {
         ;
     }
 }
        public void ReadBlock(UInt64 aBlockNo, UInt32 aBlockCount, byte[] aData)
        {
            //Partially working. When i read data it fails but in the ATA registers the DRQ bit is set to 1. so the device knows that data must be transfered!.
            //Maybe the problem is in the Interupt management (still don't know ho to do it)
            Statuses s = GetStatus();

            SelectDrive(currentDevice, 0);
            s = GetStatus();
            UsedBus.Feature.Byte = 0x00;
            UsedBus.LBA2.Byte    = (byte)((mBlockSize / 2) & 0xFF);
            UsedBus.LBA3.Byte    = (byte)((mBlockSize / 2) >> 8);
            SendCommand(Commands.Packet);
            Byte[] cmd = new Byte[] { (byte)ATAPICommands.Read2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
            cmd[9] = (byte)aBlockCount;
            cmd[2] = (byte)((aBlockNo & 0xFF000000) >> 24);
            cmd[3] = (byte)((aBlockNo & 0xFF0000) >> 16);
            cmd[4] = (byte)((aBlockNo & 0xFF00) >> 8);
            cmd[5] = (byte)(aBlockNo & 0xFF);
            for (int i = 0; i < cmd.Length / 2; i += 2)
            {
                UsedBus.Data.Word = (byte)(cmd[i] << 8 | cmd[i + 1]);
            }
            //Aurora: WON'T WORK - interrupts are locked by cosmos anyway.
            Cosmos.Core.INTs.IRQContext c = new Cosmos.Core.INTs.IRQContext();
            INTs.HandleInterrupt_2E(ref c);
            INTs.HandleInterrupt_2F(ref c);
            uint xD = c.Interrupt;

            s = GetStatus();
            s = GetStatus();
            s = GetStatus();
            uint size = (uint)(UsedBus.LBA3.Byte << 8 | UsedBus.LBA2.Byte);

            UsedBus.Data.Read8(aData);
            c = new Cosmos.Core.INTs.IRQContext();
            INTs.HandleInterrupt_2E(ref c);
            INTs.HandleInterrupt_2F(ref c);
            xD = c.Interrupt;
        }
Exemplo n.º 9
0
        // Basically the way this works is a number is stored in EAX, this is the function
        // we want to use. All of these can be accessed through software interrupt 0x80
        public unsafe static void HandleInt0x80(ref Cosmos.Core.INTs.IRQContext aContext)
        {
            if (aContext.EAX == 1) // Print
            {
                byte *ptr = (byte *)aContext.ESI;
                for (int i = 0; ptr[i] != 0; i++)
                {
                    Console.Write((char)ptr[i]);
                }
            }
            else if (aContext.EAX == 2) // Read
            {
                STIEnabler se = new STIEnabler();
                se.Enable();
                STI();                             // We need to enable interrupts so we can read, but for some reason this does not work :(

                byte * ptr = (byte *)aContext.EDI; // Input buffer
                string str = Console.ReadLine();
                for (int i = 0; i < str.Length; i++)
                {
                    ptr[i] = (byte)str[i];
                }
            }
        }
Exemplo n.º 10
0
 // IRQ0
 public static void HandleInterrupt_20(ref IRQContext aContext)
 {
     Cosmos.Core.Global.PIC.EoiMaster();
     Kernel.outb(0x20, 0x20);
 }
Exemplo n.º 11
0
 public static void HandleInterrupt_0B(ref IRQContext aContext)
 {
     Kernel.Panic("Segment not present", aContext);
 }
Exemplo n.º 12
0
 public static void HandleInterrupt_09(ref IRQContext aContext)
 {
     Kernel.Panic("Coprocessor Segment Overrun Exception", aContext);
 }
Exemplo n.º 13
0
 public static void HandleInterrupt_02(ref IRQContext aContext)
 {
     Kernel.Panic("Non Maskable Interrupt Exception", aContext);
 }
 public static void HandleInterrupt_0A(ref Cosmos.Core.INTs.IRQContext aContext)
 {
     FlowDOS.BSOD.Panic(errs[10]);
 }
 public static void HandleInterrupt_Default(ref Cosmos.Core.INTs.IRQContext aContext)
 {
     API.HandleInt0x80(ref aContext);
     // Interrupts.Handlers[aContext.Interrupt](ref aContext);
 }
Exemplo n.º 16
0
 // IRQ0
 public static void HandleInterrupt_20(ref IRQContext aContext)
 {
     Global.PIC.EoiMaster();
     AXP.Outb(0x20, 0x20);
     PIT.called = true;
 }
Exemplo n.º 17
0
 public static void HandleInterrupt_0F(ref IRQContext aContext) => RSoD.Push("Unknown Interrupt Exception", " ", true);
Exemplo n.º 18
0
 public static void HandleInterrupt_00(ref IRQContext aContext)
 {
     Kernel.Panic("Divide by zero Exception", aContext);
 }
Exemplo n.º 19
0
 public static void HandleInterrupt_01(ref IRQContext aContext)
 {
     Kernel.Panic("Debug Exception", aContext);
 }
Exemplo n.º 20
0
 public static void HandleInterrupt_04(ref IRQContext aContext)
 {
     Kernel.Panic("Into Detected Overflow Exception", aContext);
 }
Exemplo n.º 21
0
 public static void HandleInterrupt_03(ref IRQContext aContext)
 {
     Kernel.Panic("Breakpoint Exception", aContext);
 }
Exemplo n.º 22
0
 public static void HandleInterrupt_06(ref IRQContext aContext)
 {
     Kernel.Panic("Invalid Opcode", aContext);
 }
Exemplo n.º 23
0
 public static void HandleInterrupt_05(ref IRQContext aContext)
 {
     Kernel.Panic("Out of Bounds Exception", aContext);
 }
Exemplo n.º 24
0
 public static void HandleInterrupt_0F(ref IRQContext aContext)
 {
     Kernel.Panic("Unknown Interrupt Exception", aContext);
 }
Exemplo n.º 25
0
 public static void HandleInterrupt_07(ref IRQContext aContext)
 {
     Kernel.Panic("No Coprocessor Exception", aContext);
 }
Exemplo n.º 26
0
 public static void HandleInterrupt_10(ref IRQContext aContext)
 {
     Kernel.Panic("Coprocessor Fault Exception", aContext);
 }
Exemplo n.º 27
0
 public static void HandleInterrupt_0A(ref IRQContext aContext)
 {
     Kernel.Panic("Bad TSS Exception", aContext);
 }
Exemplo n.º 28
0
 public static void HandleInterrupt_11(ref IRQContext aContext)
 {
     Kernel.Panic("Alignment Exception", aContext);
 }
Exemplo n.º 29
0
 public static void HandleInterrupt_0E(ref IRQContext aContext)
 {
     Kernel.Panic("Page Fault Exception", aContext);
 }
Exemplo n.º 30
0
 public static void HandleInterrupt_12(ref IRQContext aContext)
 {
     Kernel.Panic("Machine Check Exception", aContext);
 }