Esempio n. 1
0
        public void Load(bool ProcessIsUM)
        {
            VirtMemImpl.PageFlags flags = ProcessIsUM ? VirtMemImpl.PageFlags.None : VirtMemImpl.PageFlags.KernelOnly;

            UInt32Dictionary.Iterator iterator = CodePages.GetIterator();
            while (iterator.HasNext())
            {
                UInt32Dictionary.KeyValuePair pair = iterator.Next();
                uint vAddr = pair.Key;
                uint pAddr = pair.Value;

#if MEMLAYOUT_TRACE
                BasicConsole.WriteLine("Loading code page...");
#endif
                VirtMemManager.Map(pAddr, vAddr, 4096, flags, UpdateUsedPagesFlags.Virtual);
            }
            iterator.RestoreState();

            flags    = ProcessIsUM ? VirtMemImpl.PageFlags.None : VirtMemImpl.PageFlags.KernelOnly;
            iterator = DataPages.GetIterator();
            while (iterator.HasNext())
            {
                UInt32Dictionary.KeyValuePair pair = iterator.Next();
                uint vAddr = pair.Key;
                uint pAddr = pair.Value;

#if MEMLAYOUT_TRACE
                BasicConsole.WriteLine("Loading data page...");
#endif
                VirtMemManager.Map(pAddr, vAddr, 4096, flags, UpdateUsedPagesFlags.Virtual);
            }
            iterator.RestoreState();
        }
Esempio n. 2
0
        public FOS_System.String ToString()
        {
            FOS_System.String result = "";

            result = result + "Code pages:\r\n";
            UInt32Dictionary.Iterator iterator = CodePages.GetIterator();
            while (iterator.HasNext())
            {
                UInt32Dictionary.KeyValuePair pair = iterator.Next();
                uint vAddr = pair.Key;
                uint pAddr = pair.Value;

                result = result + vAddr + " -> " + pAddr + "\r\n";
            }

            result = result + "\r\n";

            result   = result + "Data pages:\r\n";
            iterator = DataPages.GetIterator();
            while (iterator.HasNext())
            {
                UInt32Dictionary.KeyValuePair pair = iterator.Next();
                uint vAddr = pair.Key;
                uint pAddr = pair.Value;

                result = result + vAddr + " -> " + pAddr + "\r\n";
            }

            return(result);
        }
Esempio n. 3
0
        public void Unload()
        {
            if (NoUnload)
            {
                return;
            }

            UInt32Dictionary.Iterator iterator = CodePages.GetIterator();
            while (iterator.HasNext())
            {
                UInt32Dictionary.KeyValuePair pair = iterator.Next();
                uint vAddr = pair.Key;

#if MEMLAYOUT_TRACE
                BasicConsole.WriteLine("Unloading code page...");
#endif
                VirtMemManager.Unmap(vAddr, UpdateUsedPagesFlags.Virtual);
            }
            iterator.RestoreState();

            iterator = DataPages.GetIterator();
            while (iterator.HasNext())
            {
                UInt32Dictionary.KeyValuePair pair = iterator.Next();
                uint vAddr = pair.Key;

#if MEMLAYOUT_TRACE
                BasicConsole.WriteLine("Unloading data page...");
#endif
                VirtMemManager.Unmap(vAddr, UpdateUsedPagesFlags.Virtual);
            }
            iterator.RestoreState();
        }
Esempio n. 4
0
        public static void HandlePageFault(uint eip, uint errorCode, uint address)
        {
            Hardware.VirtMem.MemoryLayout memLayout = ProcessManager.CurrentProcess.TheMemoryLayout;
            BasicConsole.WriteLine("Code pages:");
            string TempDisplayString = "0x        ";

            UInt32Dictionary.Iterator iterator = memLayout.CodePages.GetIterator();
            while (iterator.HasNext())
            {
                UInt32Dictionary.KeyValuePair pair = iterator.Next();
                uint vAddr = pair.Key;
                WriteNumber(TempDisplayString, vAddr);
                BasicConsole.WriteLine(TempDisplayString);
            }
            BasicConsole.WriteLine("Data pages:");
            iterator = memLayout.DataPages.GetIterator();
            while (iterator.HasNext())
            {
                UInt32Dictionary.KeyValuePair pair = iterator.Next();
                uint vAddr = pair.Key;
                WriteNumber(TempDisplayString, vAddr);
                BasicConsole.WriteLine(TempDisplayString);
            }
            BasicConsole.DelayOutput(100);
        }
Esempio n. 5
0
        public void Unmerge(MemoryLayout y)
        {
            UInt32Dictionary.Iterator iterator = y.CodePages.GetIterator();
            while (iterator.HasNext())
            {
                UInt32Dictionary.KeyValuePair pair = iterator.Next();
                uint vAddr = pair.Key;
                uint pAddr = pair.Value;

                RemovePage(vAddr);
            }
            iterator = y.DataPages.GetIterator();
            while (iterator.HasNext())
            {
                UInt32Dictionary.KeyValuePair pair = iterator.Next();
                uint vAddr = pair.Key;
                uint pAddr = pair.Value;

                RemovePage(vAddr);
            }
        }