/// <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); } }
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; }
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); } }
/// <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) { } }
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; }
// 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]; } } }
// IRQ0 public static void HandleInterrupt_20(ref IRQContext aContext) { Cosmos.Core.Global.PIC.EoiMaster(); Kernel.outb(0x20, 0x20); }
public static void HandleInterrupt_0B(ref IRQContext aContext) { Kernel.Panic("Segment not present", aContext); }
public static void HandleInterrupt_09(ref IRQContext aContext) { Kernel.Panic("Coprocessor Segment Overrun Exception", aContext); }
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); }
// IRQ0 public static void HandleInterrupt_20(ref IRQContext aContext) { Global.PIC.EoiMaster(); AXP.Outb(0x20, 0x20); PIT.called = true; }
public static void HandleInterrupt_0F(ref IRQContext aContext) => RSoD.Push("Unknown Interrupt Exception", " ", true);
public static void HandleInterrupt_00(ref IRQContext aContext) { Kernel.Panic("Divide by zero Exception", aContext); }
public static void HandleInterrupt_01(ref IRQContext aContext) { Kernel.Panic("Debug Exception", aContext); }
public static void HandleInterrupt_04(ref IRQContext aContext) { Kernel.Panic("Into Detected Overflow Exception", aContext); }
public static void HandleInterrupt_03(ref IRQContext aContext) { Kernel.Panic("Breakpoint Exception", aContext); }
public static void HandleInterrupt_06(ref IRQContext aContext) { Kernel.Panic("Invalid Opcode", aContext); }
public static void HandleInterrupt_05(ref IRQContext aContext) { Kernel.Panic("Out of Bounds Exception", aContext); }
public static void HandleInterrupt_0F(ref IRQContext aContext) { Kernel.Panic("Unknown Interrupt Exception", aContext); }
public static void HandleInterrupt_07(ref IRQContext aContext) { Kernel.Panic("No Coprocessor Exception", aContext); }
public static void HandleInterrupt_10(ref IRQContext aContext) { Kernel.Panic("Coprocessor Fault Exception", aContext); }
public static void HandleInterrupt_0A(ref IRQContext aContext) { Kernel.Panic("Bad TSS Exception", aContext); }
public static void HandleInterrupt_11(ref IRQContext aContext) { Kernel.Panic("Alignment Exception", aContext); }
public static void HandleInterrupt_0E(ref IRQContext aContext) { Kernel.Panic("Page Fault Exception", aContext); }
public static void HandleInterrupt_12(ref IRQContext aContext) { Kernel.Panic("Machine Check Exception", aContext); }