Пример #1
0
        private static void IRQ(uint irq, ref IRQContext aContext)
        {
            var xCallback = mIRQ_Handlers[irq];

            if (xCallback != null)
            {
                HMI.GCMonitor();
                xCallback(ref aContext);
                HMI.GCFreeAll();
            }
        }
Пример #2
0
 public static void DecreaseMemoryUse(uint aSize)
 {
     mStartAddress -= aSize;
     if (mStartAddress < HMI.ProtectArea)
     {
         HMI.CauseProgramFault("[ Heap Error: Memory Access Violation ]");
     }
     else
     {
         LastMallocAddr = mStartAddress;
     }
 }
Пример #3
0
        public static void CheckForErrors(uint aSize)
        {
            //Check if address is Zero
            if (JediReallocAddr == 0 & GCEnable == true & GCObjCount > 0)
            {
                Console.Clear();
                Console.Write("Debug ID: ");
                Console.WriteLine(GCDebugID.ToHex());

                Console.Write("Index ID: ");
                Console.WriteLine(GCIndex.ToHex());

                Console.Write("GCMax ID: ");
                Console.WriteLine(GCObjIDs[(GCObjCount - 1)].ToHex());

                Console.WriteLine("Realloc Error: Base Memory Address is Zero");
                Console.Write("Requested Memory: ");
                Console.WriteLine(aSize.ToString());

                if (GCObjCount == 0)
                {
                    Console.WriteLine("No objects in GC List.");
                }

                int  aIndex   = GCObjIDs[GCIndex];
                uint DataSize = MemSizes[aIndex];
                Console.Write("Block# ");
                Console.Write(aIndex.ToString() + ": ");
                Console.WriteLine(DataSize.ToString());
                while (true)
                {
                }
                ;
            }
            //Cause a Heap Fault if an object illegally accesses Kernel Memory Area
            else if (JediReallocAddr != 0 & JediReallocAddr < ProtectArea & GCEnable == true)
            {
                HMI.CauseProgramFault("[ HMI Error: Kernel Memory Access Violation ]");
                while (true)
                {
                    ;
                }
            }
        }
Пример #4
0
        public static uint MemAlloc(uint aLength)
        {
            Initialize();
            xAddr = 0;

            if (SkipRalloc == false)
            {
                xAddr = HMI.ReAlloc(aLength);
            }

            if (xAddr == 0)
            {
                xAddr = mStartAddress;

                if (mStartAddress >= mEndOfRam)
                {
                    HMI.HeapOutOfMemory();
                }

                else
                {
                    mStartAddress += aLength;
                    Cosmos.Core.Global.CPU.ZeroFill(xAddr, aLength);
                    if (HMI.IsInitalised == true)//Prevent it from interfering with unmanaged memory before boot
                    {
                        HMI.AddBlock(xAddr, aLength);
                    }
                    if (SkipRalloc == false)
                    {
                        LastMallocAddr = xAddr;//Update this when we allocate a new block not extend an old block
                    }
                    SkipRalloc = false;
                }
            }

            return(xAddr);
        }
Пример #5
0
 public static void xHeapExcessUseFault()
 {
     HMI.HeapExcessUseFault();
 }