コード例 #1
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 //IRQ 15 - Secondary IDE
 public static void HandleInterrupt_2F(ref IRQContext aContext)
 {
     IRQ(0x2F, ref aContext);
     Global.PIC.EoiSlave();
 }
コード例 #2
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
        private static void HandleException(uint aEIP, string aDescription, string aName, ref IRQContext ctx, uint lastKnownAddressValue = 0)
        {
            // At this point we are in a very unstable state.
            // Try not to use any Cosmos routines, just
            // report a crash dump.
            const string xHex = "0123456789ABCDEF";
            uint xPtr = ctx.EIP;

            // we're printing exception info to the screen now:
            // 0/0: x
            // 1/0: exception number in hex
            unsafe
            {
                byte* xAddress = (byte*)0xB8000;
                PutErrorChar(0, 00, ' ');
                PutErrorChar(0, 01, '*');
                PutErrorChar(0, 02, '*');
                PutErrorChar(0, 03, '*');
                PutErrorChar(0, 04, ' ');
                PutErrorChar(0, 05, 'C');
                PutErrorChar(0, 06, 'P');
                PutErrorChar(0, 07, 'U');
                PutErrorChar(0, 08, ' ');
                PutErrorChar(0, 09, 'E');
                PutErrorChar(0, 10, 'x');
                PutErrorChar(0, 11, 'c');
                PutErrorChar(0, 12, 'e');
                PutErrorChar(0, 13, 'p');
                PutErrorChar(0, 14, 't');
                PutErrorChar(0, 15, 'i');
                PutErrorChar(0, 16, 'o');
                PutErrorChar(0, 17, 'n');
                PutErrorChar(0, 18, ' ');
                PutErrorChar(0, 19, 'x');
                PutErrorChar(0, 20, xHex[(int)((ctx.Interrupt >> 4) & 0xF)]);
                PutErrorChar(0, 21, xHex[(int)(ctx.Interrupt & 0xF)]);
                PutErrorChar(0, 22, ' ');
                PutErrorChar(0, 23, '*');
                PutErrorChar(0, 24, '*');
                PutErrorChar(0, 25, '*');
                PutErrorChar(0, 26, ' ');

                if (lastKnownAddressValue != 0)
                {
                    PutErrorString(1, 0, "Last known address: 0x");

                    PutErrorChar(1, 22, xHex[(int)((lastKnownAddressValue >> 28) & 0xF)]);
                    PutErrorChar(1, 23, xHex[(int)((lastKnownAddressValue >> 24) & 0xF)]);
                    PutErrorChar(1, 24, xHex[(int)((lastKnownAddressValue >> 20) & 0xF)]);
                    PutErrorChar(1, 25, xHex[(int)((lastKnownAddressValue >> 16) & 0xF)]);
                    PutErrorChar(1, 26, xHex[(int)((lastKnownAddressValue >> 12) & 0xF)]);
                    PutErrorChar(1, 27, xHex[(int)((lastKnownAddressValue >> 8) & 0xF)]);
                    PutErrorChar(1, 28, xHex[(int)((lastKnownAddressValue >> 4) & 0xF)]);
                    PutErrorChar(1, 29, xHex[(int)(lastKnownAddressValue & 0xF)]);
                }

            }

            // lock up
            while (true)
            {
            }
        }
コード例 #3
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_Default(ref IRQContext aContext)
 {
     if (aContext.Interrupt >= 0x20 && aContext.Interrupt <= 0x2F)
     {
         if (aContext.Interrupt >= 0x28)
         {
             Global.PIC.EoiSlave();
         }
         else
         {
             Global.PIC.EoiMaster();
         }
     }
 }
コード例 #4
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_0B(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Segment Not Present", "Segment Not Present", ref aContext);
 }
コード例 #5
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_10(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "x87 Floating Point Exception", "Coprocessor Fault Exception", ref aContext);
 }
コード例 #6
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_02(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Non Maskable Interrupt Exception", "Non Maskable Interrupt Exception", ref aContext);
 }
コード例 #7
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_06(ref IRQContext aContext)
 {
     // although mLastKnownAddress is a static, we need to get it here, any subsequent calls will change the value!!!
     var xLastKnownAddress = mLastKnownAddress;
     HandleException(aContext.EIP, "Invalid Opcode", "EInvalidOpcode", ref aContext, xLastKnownAddress);
 }
コード例 #8
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// No Coprocessor Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_07(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "No Coprocessor Exception", "No Coprocessor Exception", ref aContext);
 }
コード例 #9
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// Coprocessor Segment Overrun Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_09(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Coprocessor Segment Overrun Exception", "Coprocessor Segment Overrun Exception", ref aContext);
 }
コード例 #10
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// Into Detected Overflow Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_04(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Into Detected Overflow Exception", "Into Detected Overflow Exception", ref aContext);
 }
コード例 #11
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// Out of Bounds Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_05(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Out of Bounds Exception", "Out of Bounds Exception", ref aContext);
 }
コード例 #12
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// Breakpoint Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_03(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Breakpoint Exception", "Breakpoint Exception", ref aContext);
 }
コード例 #13
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// Non Maskable Interrupt Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_02(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Non Maskable Interrupt Exception", "Non Maskable Interrupt Exception", ref aContext);
 }
コード例 #14
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// Debug Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_01(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Debug Exception", "Debug Exception", ref aContext);
 }
コード例 #15
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_35(ref IRQContext aContext)
 {
     aContext.EAX *= 2;
     aContext.EBX *= 2;
     aContext.ECX *= 2;
     aContext.EDX *= 2;
 }
コード例 #16
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// Bad TSS Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_0A(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Bad TSS Exception", "Bad TSS Exception", ref aContext);
 }
コード例 #17
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_00(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Divide by zero", "EDivideByZero", ref aContext, aContext.EIP);
 }
コード例 #18
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// Segment Not Present.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_0B(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Segment Not Present", "Segment Not Present", ref aContext);
 }
コード例 #19
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_04(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Into Detected Overflow Exception", "Into Detected Overflow Exception", ref aContext);
 }
コード例 #20
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// Page Fault Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_0E(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Page Fault Exception", "Page Fault Exception", ref aContext);
 }
コード例 #21
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_09(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Coprocessor Segment Overrun Exception", "Coprocessor Segment Overrun Exception", ref aContext);
 }
コード例 #22
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// Unknown Interrupt Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_0F(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Unknown Interrupt Exception", "Unknown Interrupt Exception", ref aContext);
 }
コード例 #23
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_0E(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Page Fault Exception", "Page Fault Exception", ref aContext);
 }
コード例 #24
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// x87 Floating Point Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_10(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "x87 Floating Point Exception", "Coprocessor Fault Exception", ref aContext);
 }
コード例 #25
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_12(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Machine Check Exception", "Machine Check Exception", ref aContext);
 }
コード例 #26
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// Alignment Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_11(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Alignment Exception", "Alignment Exception", ref aContext);
 }
コード例 #27
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// Divide By Zero Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_00(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Divide by zero", "EDivideByZero", ref aContext, aContext.EIP);
 }
コード例 #28
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// Machine Check Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_12(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Machine Check Exception", "Machine Check Exception", ref aContext);
 }
コード例 #29
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
        public static void HandleInterrupt_27(ref IRQContext aContext)
        {

            IRQ(0x27, ref aContext);
            Global.PIC.EoiMaster();
        }
コード例 #30
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
 /// <summary>
 /// SIMD Floating Point Exception.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
 /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
 public static void HandleInterrupt_13(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "SIMD Floating Point Exception", "SIMD Floating Point Exception", ref aContext);
 }
コード例 #31
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 // Interrupt 0x30, enter VMM
 public static void HandleInterrupt_30(ref IRQContext aContext)
 {
     if (Interrupt30 != null)
     {
         Interrupt30(ref aContext);
     }
 }
コード例 #32
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
        /// <summary>
        /// Handle exception.
        /// </summary>
        /// <param name="aEIP">Unused.</param>
        /// <param name="aDescription">Unused.</param>
        /// <param name="aName">Unused.</param>
        /// <param name="ctx">IRQ context.</param>
        /// <param name="lastKnownAddressValue">Last known address value. (default = 0)</param>
        /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
        /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
        private static void HandleException(uint aEIP, string aDescription, string aName, ref IRQContext ctx, uint lastKnownAddressValue = 0)
        {
            // At this point we are in a very unstable state.
            // Try not to use any Cosmos routines, just
            // report a crash dump.
            const string xHex = "0123456789ABCDEF";
            uint         xPtr = ctx.EIP;

            // we're printing exception info to the screen now:
            // 0/0: x
            // 1/0: exception number in hex
            unsafe
            {
                byte *xAddress = (byte *)0xB8000;
                PutErrorChar(0, 00, ' ');
                PutErrorChar(0, 01, '*');
                PutErrorChar(0, 02, '*');
                PutErrorChar(0, 03, '*');
                PutErrorChar(0, 04, ' ');
                PutErrorChar(0, 05, 'C');
                PutErrorChar(0, 06, 'P');
                PutErrorChar(0, 07, 'U');
                PutErrorChar(0, 08, ' ');
                PutErrorChar(0, 09, 'E');
                PutErrorChar(0, 10, 'x');
                PutErrorChar(0, 11, 'c');
                PutErrorChar(0, 12, 'e');
                PutErrorChar(0, 13, 'p');
                PutErrorChar(0, 14, 't');
                PutErrorChar(0, 15, 'i');
                PutErrorChar(0, 16, 'o');
                PutErrorChar(0, 17, 'n');
                PutErrorChar(0, 18, ' ');
                PutErrorChar(0, 19, 'x');
                PutErrorChar(0, 20, xHex[(int)((ctx.Interrupt >> 4) & 0xF)]);
                PutErrorChar(0, 21, xHex[(int)(ctx.Interrupt & 0xF)]);
                PutErrorChar(0, 22, ' ');
                PutErrorChar(0, 23, '*');
                PutErrorChar(0, 24, '*');
                PutErrorChar(0, 25, '*');
                PutErrorChar(0, 26, ' ');

                if (lastKnownAddressValue != 0)
                {
                    PutErrorString(1, 0, "Last known address: 0x");

                    PutErrorChar(1, 22, xHex[(int)((lastKnownAddressValue >> 28) & 0xF)]);
                    PutErrorChar(1, 23, xHex[(int)((lastKnownAddressValue >> 24) & 0xF)]);
                    PutErrorChar(1, 24, xHex[(int)((lastKnownAddressValue >> 20) & 0xF)]);
                    PutErrorChar(1, 25, xHex[(int)((lastKnownAddressValue >> 16) & 0xF)]);
                    PutErrorChar(1, 26, xHex[(int)((lastKnownAddressValue >> 12) & 0xF)]);
                    PutErrorChar(1, 27, xHex[(int)((lastKnownAddressValue >> 8) & 0xF)]);
                    PutErrorChar(1, 28, xHex[(int)((lastKnownAddressValue >> 4) & 0xF)]);
                    PutErrorChar(1, 29, xHex[(int)(lastKnownAddressValue & 0xF)]);
                }
            }

            // lock up
            while (true)
            {
            }
        }
コード例 #33
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_49(ref IRQContext aContext)
 {
     IRQ(0x49, ref aContext);
 }
コード例 #34
0
ファイル: INTs.cs プロジェクト: ThomasBeHappy/Cosmos
        // This is to trick IL2CPU to compile it in
        //TODO: Make a new attribute that IL2CPU sees when scanning to force inclusion so we dont have to do this.
        // We dont actually need to call this method
        /// <summary>
        /// Dummy function, used by the bootstrap.
        /// </summary>
        /// <remarks>This is to trick IL2CPU to compile it in.</remarks>
        /// <exception cref="System.IndexOutOfRangeException">Thrown on fatal error, contact support.</exception>
        /// <exception cref="System.OverflowException">Thrown on fatal error, contact support.</exception>
        public static void Dummy()
        {
            // Compiler magic
            bool xTest = false;

            if (xTest)
            {
                unsafe
                {
                    var xCtx = new IRQContext();
                    HandleInterrupt_Default(ref xCtx);
                    HandleInterrupt_00(ref xCtx);
                    HandleInterrupt_01(ref xCtx);
                    HandleInterrupt_02(ref xCtx);
                    HandleInterrupt_03(ref xCtx);
                    HandleInterrupt_04(ref xCtx);
                    HandleInterrupt_05(ref xCtx);
                    HandleInterrupt_06(ref xCtx);
                    HandleInterrupt_07(ref xCtx);
                    HandleInterrupt_08(ref xCtx);
                    HandleInterrupt_09(ref xCtx);
                    HandleInterrupt_0A(ref xCtx);
                    HandleInterrupt_0B(ref xCtx);
                    HandleInterrupt_0C(ref xCtx);
                    HandleInterrupt_0D(ref xCtx);
                    HandleInterrupt_0E(ref xCtx);
                    HandleInterrupt_0F(ref xCtx);
                    HandleInterrupt_10(ref xCtx);
                    HandleInterrupt_11(ref xCtx);
                    HandleInterrupt_12(ref xCtx);
                    HandleInterrupt_13(ref xCtx);
                    HandleInterrupt_20(ref xCtx);
                    HandleInterrupt_21(ref xCtx);
                    HandleInterrupt_22(ref xCtx);
                    HandleInterrupt_23(ref xCtx);
                    HandleInterrupt_24(ref xCtx);
                    HandleInterrupt_25(ref xCtx);
                    HandleInterrupt_26(ref xCtx);
                    HandleInterrupt_27(ref xCtx);
                    HandleInterrupt_28(ref xCtx);
                    HandleInterrupt_29(ref xCtx);
                    HandleInterrupt_2A(ref xCtx);
                    HandleInterrupt_2B(ref xCtx);
                    HandleInterrupt_2C(ref xCtx);
                    HandleInterrupt_2D(ref xCtx);
                    HandleInterrupt_2E(ref xCtx);
                    HandleInterrupt_2F(ref xCtx);
                    HandleInterrupt_30(ref xCtx);
                    HandleInterrupt_35(ref xCtx);
                    HandleInterrupt_40(ref xCtx);
                    HandleInterrupt_41(ref xCtx);
                    HandleInterrupt_42(ref xCtx);
                    HandleInterrupt_43(ref xCtx);
                    HandleInterrupt_44(ref xCtx);
                    HandleInterrupt_45(ref xCtx);
                    HandleInterrupt_46(ref xCtx);
                    HandleInterrupt_47(ref xCtx);
                    HandleInterrupt_48(ref xCtx);
                    HandleInterrupt_49(ref xCtx);
                    Processing.ProcessorScheduler.SwitchTask();
                    Processing.ProcessorScheduler.EntryPoint();
                }
            }
        }
コード例 #35
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_01(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Debug Exception", "Debug Exception", ref aContext);
 }
コード例 #36
0
        public static void HandleException(uint aEIP, string aDescription, string aName, ref IRQContext ctx, uint lastKnownAddressValue = 0)
        {
            const string xHex = "0123456789ABCDEF";

            string ctxinterrupt = "";

            ctxinterrupt = ctxinterrupt + xHex[(int)((ctx.Interrupt >> 4) & 0xF)];
            ctxinterrupt = ctxinterrupt + xHex[(int)(ctx.Interrupt & 0xF)];

            string lastsknowaddress = "";

            if (lastKnownAddressValue != 0)
            {
                lastsknowaddress = lastsknowaddress + xHex[(int)((lastKnownAddressValue >> 28) & 0xF)];
                lastsknowaddress = lastsknowaddress + xHex[(int)((lastKnownAddressValue >> 24) & 0xF)];
                lastsknowaddress = lastsknowaddress + xHex[(int)((lastKnownAddressValue >> 20) & 0xF)];
                lastsknowaddress = lastsknowaddress + xHex[(int)((lastKnownAddressValue >> 16) & 0xF)];
                lastsknowaddress = lastsknowaddress + xHex[(int)((lastKnownAddressValue >> 12) & 0xF)];
                lastsknowaddress = lastsknowaddress + xHex[(int)((lastKnownAddressValue >> 8) & 0xF)];
                lastsknowaddress = lastsknowaddress + xHex[(int)((lastKnownAddressValue >> 4) & 0xF)];
                lastsknowaddress = lastsknowaddress + xHex[(int)(lastKnownAddressValue & 0xF)];
            }

            System.Crash.StopKernel(aName, aDescription, lastsknowaddress, ctxinterrupt);
        }
コード例 #37
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_03(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Breakpoint Exception", "Breakpoint Exception", ref aContext);
 }
コード例 #38
0
        protected void HandleNetworkInterrupt(ref IRQContext aContext)
        {
            ushort status = Ports.InW((ushort)(BaseAddress + 0x3E));

            if ((status & 0x0001) != 0)
            {
                ReadRawData();
            }
            if ((status & 0x0002) != 0)
            {
                Console.WriteLine("Receive error");
            }
            if (((status & 0x0004) != 0) && ((status & 0x0080) != 0))
            {
            }
            else
            {
                if ((status & 0x0004) != 0)
                {
                    Console.WriteLine("Transmit succesfull - descriptor not resetted");
                }
                //if ((status & 0x0080) != 0) Console.WriteLine("Transmit descriptor unavailable");
            }
            if ((status & 0x0008) != 0)
            {
                Console.WriteLine("Transmit error");
            }
            if ((status & 0x0010) != 0)
            {
                Console.WriteLine("Receive descriptor unavailable");
            }
            if ((status & 0x0020) != 0)
            {
                if ((Ports.InB((ushort)(BaseAddress + 0x6C)) & 0x02) != 0)
                {
                    Console.WriteLine("\nLink is up with ");
                    if ((Ports.InB((ushort)(BaseAddress + 0x6C)) & 0x04) != 0)
                    {
                        Console.WriteLine("10 Mbps and ");
                    }
                    if ((Ports.InB((ushort)(BaseAddress + 0x6C)) & 0x08) != 0)
                    {
                        Console.WriteLine("100 Mbps and ");
                    }
                    if ((Ports.InB((ushort)(BaseAddress + 0x6C)) & 0x10) != 0)
                    {
                        Console.WriteLine("1000 Mbps and ");
                    }
                    if ((Ports.InB((ushort)(BaseAddress + 0x6C)) & 0x01) != 0)
                    {
                        Console.WriteLine("Full-duplex");
                    }
                    else
                    {
                        Console.WriteLine("Half-duplex");
                    }
                }
                else
                {
                    Console.WriteLine("\nLink is down!");
                }
            }
            if ((status & 0x0040) != 0)
            {
                Console.WriteLine("RX FIFO overflow!");
                if ((status & 0x0200) != 0)
                {
                    Console.WriteLine("RX FIFO empty");
                }
            }
            if ((status & 0x0100) != 0)
            {
                Console.WriteLine("Software Interrupt");
            }
            if ((status & 0x0200) != 0)
            {
                Console.WriteLine("RX FIFO empty");
                Ports.OutW((ushort)(BaseAddress + status), 0x0040); //https://groups.google.com/forum/#!topic/fa.linux.kernel/Vo8-9W3LoQs
            }
            if ((status & 0x0400) != 0)
            {
                Console.WriteLine("Unknown Status (reserved Bit 11)");
            }
            if ((status & 0x0800) != 0)
            {
                Console.WriteLine("Unknown Status (reserved Bit 12)");
            }
            if ((status & 0x1000) != 0)
            {
                Console.WriteLine("Unknown Status (reserved Bit 13)");
            }
            if ((status & 0x2000) != 0)
            {
                Console.WriteLine("Unknown Status (reserved Bit 14)");
            }
            if ((status & 0x4000) != 0)
            {
                //Timeout
            }
            if ((status & 0x8000) != 0)
            {
                Console.WriteLine("Unknown Status (reserved Bit 16)");
            }

            Ports.OutW((ushort)(BaseAddress + 0x3E), status);
        }
コード例 #39
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_05(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Out of Bounds Exception", "Out of Bounds Exception", ref aContext);
 }
コード例 #40
0
 public static void HandleInterrupt_27(ref IRQContext aContext)
 {
     IRQ(0x27, ref aContext);
     Global.PIC.EoiMaster();
 }
コード例 #41
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_07(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "No Coprocessor Exception", "No Coprocessor Exception", ref aContext);
 }
コード例 #42
0
 /// <summary>
 /// IRQ 15 - Secondary IDE.
 /// </summary>
 /// <param name="aContext">IRQ context.</param>
 public static void HandleInterrupt_2F(ref IRQContext aContext)
 {
     IRQ(0x2F, ref aContext);
     Global.PIC.EoiSlave();
 }
コード例 #43
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_0A(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Bad TSS Exception", "Bad TSS Exception", ref aContext);
 }
コード例 #44
0
 public static void HandleInterrupt_44(ref IRQContext aContext)
 {
     IRQ(0x44, ref aContext);
 }
コード例 #45
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_0D(ref IRQContext aContext)
 {
     if (GeneralProtectionFault != null)
     {
         GeneralProtectionFault(ref aContext);
     }
     else
     {
         HandleException(aContext.EIP, "General Protection Fault", "GPF", ref aContext);
     }
 }
コード例 #46
0
ファイル: INTs.cs プロジェクト: iSalva/Cosmos
        private static void HandleException(uint aEIP, string aDescription, string aName, ref IRQContext ctx)
        {
          // At this point we are in a very unstable state.
          // Try not to use any Cosmos routines, just
          // report a crash dump.
            const string xHex = "0123456789ABCDEF";
            uint xPtr = ctx.EIP;

            // we're printing exception info to the screen now:
            // 0/0: x
            // 1/0: exception number in hex
            unsafe
            {
                byte* xAddress = (byte*)0xB8000;
                xAddress[0] = (byte)' ';
                xAddress[1] = 0x0C;
                xAddress[2] = (byte)'*';
                xAddress[3] = 0x0C;
                xAddress[4] = (byte)'*';
                xAddress[5] = 0x0C;
                xAddress[6] = (byte)'*';
                xAddress[7] = 0x0C;
                xAddress[8] = (byte)' ';
                xAddress[9] = 0x0C;
                xAddress[10] = (byte)'C';
                xAddress[11] = 0x0C;
                xAddress[12] = (byte)'P';
                xAddress[13] = 0x0C;
                xAddress[14] = (byte)'U';
                xAddress[15] = 0x0C;
                xAddress[16] = (byte)' ';
                xAddress[17] = 0x0C;
                xAddress[18] = (byte)'E';
                xAddress[19] = 0x0C;
                xAddress[20] = (byte)'x';
                xAddress[21] = 0x0C;
                xAddress[22] = (byte)'c';
                xAddress[23] = 0x0C;
                xAddress[24] = (byte)'e';
                xAddress[25] = 0x0C;
                xAddress[26] = (byte)'p';
                xAddress[27] = 0x0C;
                xAddress[28] = (byte)'t';
                xAddress[29] = 0x0C;
                xAddress[30] = (byte)'i';
                xAddress[31] = 0x0C;
                xAddress[32] = (byte)'o';
                xAddress[33] = 0x0C;
                xAddress[34] = (byte)'n';
                xAddress[35] = 0x0C;
                xAddress[36] = (byte)' ';
                xAddress[37] = 0x0C;
                xAddress[38] = (byte)'x';
                xAddress[39] = 0x0C;
                xAddress[40] = (byte)xHex[(int)((ctx.Interrupt >> 4) & 0xF)];
                xAddress[41] = 0x0C;
                xAddress[42] = (byte)xHex[(int)(ctx.Interrupt & 0xF)];
                xAddress[43] = 0x0C;
                xAddress[44] = (byte)' ';
                xAddress[45] = 0x0C;
                xAddress[46] = (byte)'*';
                xAddress[47] = 0x0C;
                xAddress[48] = (byte)'*';
                xAddress[49] = 0x0C;
                xAddress[50] = (byte)'*';
                xAddress[51] = 0x0C;
                xAddress[52] = (byte)' ';
                xAddress[53] = 0x0C;
            }

          // lock up
            while (true)
            {
            }
        }
コード例 #47
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_0F(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Unknown Interrupt Exception", "Unknown Interrupt Exception", ref aContext);
 }
コード例 #48
0
ファイル: INTs.cs プロジェクト: iSalva/Cosmos
 private static void IRQ(uint irq, ref IRQContext aContext)
 {
     var xCallback = mIRQ_Handlers[irq];
     if (xCallback != null)
     {
         HMI.GCMonitor();
         xCallback(ref aContext);
         HMI.GCFreeAll();
     }
 }
コード例 #49
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_11(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "Alignment Exception", "Alignment Exception", ref aContext);
 }
コード例 #50
0
ファイル: INTs.cs プロジェクト: iSalva/Cosmos
 public static void HandleInterrupt_35(ref IRQContext aContext)
 {
     Global.Dbg.SendMessage("Interrupts", "Interrupt 35 handler");
     aContext.EAX *= 2;
     aContext.EBX *= 2;
     aContext.ECX *= 2;
     aContext.EDX *= 2;
 }
コード例 #51
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 public static void HandleInterrupt_13(ref IRQContext aContext)
 {
     HandleException(aContext.EIP, "SIMD Floating Point Exception", "SIMD Floating Point Exception", ref aContext);
 }
コード例 #52
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 private static void IRQ(uint irq, ref IRQContext aContext)
 {
     var xCallback = mIRQ_Handlers[irq];
     if (xCallback != null)
     {
         xCallback(ref aContext);
     }
 }
コード例 #53
0
ファイル: INTs.cs プロジェクト: ChrisJamesSadler/Cosmos
 // This is to trick IL2CPU to compile it in
 //TODO: Make a new attribute that IL2CPU sees when scanning to force inclusion so we dont have to do this.
 // We dont actually need to cal this method
 public static void Dummy()
 {
     // Compiler magic
     bool xTest = false;
     if (xTest)
     {
         unsafe
         {
             var xCtx = new IRQContext();
             HandleInterrupt_Default(ref xCtx);
             HandleInterrupt_00(ref xCtx);
             HandleInterrupt_01(ref xCtx);
             HandleInterrupt_02(ref xCtx);
             HandleInterrupt_03(ref xCtx);
             HandleInterrupt_04(ref xCtx);
             HandleInterrupt_05(ref xCtx);
             HandleInterrupt_06(ref xCtx);
             HandleInterrupt_07(ref xCtx);
             HandleInterrupt_08(ref xCtx);
             HandleInterrupt_09(ref xCtx);
             HandleInterrupt_0A(ref xCtx);
             HandleInterrupt_0B(ref xCtx);
             HandleInterrupt_0C(ref xCtx);
             HandleInterrupt_0D(ref xCtx);
             HandleInterrupt_0E(ref xCtx);
             HandleInterrupt_0F(ref xCtx);
             HandleInterrupt_10(ref xCtx);
             HandleInterrupt_11(ref xCtx);
             HandleInterrupt_12(ref xCtx);
             HandleInterrupt_13(ref xCtx);
             HandleInterrupt_20(ref xCtx);
             HandleInterrupt_21(ref xCtx);
             HandleInterrupt_22(ref xCtx);
             HandleInterrupt_23(ref xCtx);
             HandleInterrupt_24(ref xCtx);
             HandleInterrupt_25(ref xCtx);
             HandleInterrupt_26(ref xCtx);
             HandleInterrupt_27(ref xCtx);
             HandleInterrupt_28(ref xCtx);
             HandleInterrupt_29(ref xCtx);
             HandleInterrupt_2A(ref xCtx);
             HandleInterrupt_2B(ref xCtx);
             HandleInterrupt_2C(ref xCtx);
             HandleInterrupt_2D(ref xCtx);
             HandleInterrupt_2E(ref xCtx);
             HandleInterrupt_2F(ref xCtx);
             HandleInterrupt_30(ref xCtx);
             HandleInterrupt_35(ref xCtx);
             HandleInterrupt_40(ref xCtx);
             HandleInterrupt_41(ref xCtx);
             HandleInterrupt_42(ref xCtx);
             HandleInterrupt_43(ref xCtx);
             HandleInterrupt_44(ref xCtx);
             HandleInterrupt_45(ref xCtx);
             HandleInterrupt_46(ref xCtx);
             HandleInterrupt_47(ref xCtx);
             HandleInterrupt_48(ref xCtx);
             HandleInterrupt_49(ref xCtx);
         }
     }
 }
コード例 #54
0
        public static void HandleException(uint aEIP, string aDescription, string aName, ref IRQContext ctx, uint LastKnownAddressValue = 0)
        {
            string       error = ctx.Interrupt.ToString();
            const string xHex  = "0123456789ABCDEF";

            string ctxinterrupt = "";

            ctxinterrupt = ctxinterrupt + xHex[(int)((ctx.Interrupt >> 4) & 0xF)];
            ctxinterrupt = ctxinterrupt + xHex[(int)(ctx.Interrupt & 0xF)];

            string LastKnownAddress = "";

            if (LastKnownAddressValue != 0)
            {
                LastKnownAddress = LastKnownAddress + xHex[(int)((LastKnownAddressValue >> 28) & 0xF)];
                LastKnownAddress = LastKnownAddress + xHex[(int)((LastKnownAddressValue >> 24) & 0xF)];
                LastKnownAddress = LastKnownAddress + xHex[(int)((LastKnownAddressValue >> 20) & 0xF)];
                LastKnownAddress = LastKnownAddress + xHex[(int)((LastKnownAddressValue >> 16) & 0xF)];
                LastKnownAddress = LastKnownAddress + xHex[(int)((LastKnownAddressValue >> 12) & 0xF)];
                LastKnownAddress = LastKnownAddress + xHex[(int)((LastKnownAddressValue >> 8) & 0xF)];
                LastKnownAddress = LastKnownAddress + xHex[(int)((LastKnownAddressValue >> 4) & 0xF)];
                LastKnownAddress = LastKnownAddress + xHex[(int)(LastKnownAddressValue & 0xF)];
            }
            Bluescreen.Panic(aName, aDescription, LastKnownAddress, ref ctx);
        }