コード例 #1
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();
        }
コード例 #2
0
ファイル: MemoryLayout.cs プロジェクト: sramos30/FlingOS
        public void Unload()
        {
            //x86.Unmap_Print = unloadPrint;

            for (int i = 0; i < CodePages.Keys.Count && i < CodePages.Values.Count; i++)
            {
#if MEMLAYOUT_TRACE
                BasicConsole.WriteLine("Unloading code page...");
#endif

                //if (unloadPrint)
                //{
                //    BasicConsole.WriteLine("Unloading code page");
                //}

                //TODO: Revert to the following line of code and then work out why it results in so many page faults
                //          VirtMemManager.Unmap(CodePages.Keys[i], UpdateUsedPagesFlags.Virtual);
                //      Also see the similar line further down
                VirtMemManager.Unmap(CodePages.Keys[i], UpdateUsedPagesFlags.None);
            }
            for (int i = 0; i < DataPages.Keys.Count && i < DataPages.Values.Count; i++)
            {
#if MEMLAYOUT_TRACE
                BasicConsole.WriteLine("Unloading data page...");
#endif

                //if (unloadPrint)
                //{
                //    FOS_System.String str = "Unloading data page 0x--------";
                //    ExceptionMethods.FillString(DataPages.Keys[i], 29, str);
                //    BasicConsole.WriteLine(str);
                //}

                //TODO: Revert line - see above
                VirtMemManager.Unmap(DataPages.Keys[i], UpdateUsedPagesFlags.None);

                //if (unloadPrint)
                //{
                //    BasicConsole.WriteLine(" > Done.");
                //}
            }

            //if (unloadPrint)
            //{
            //    BasicConsole.WriteLine("Unload complete.");
            //}

            //x86.Unmap_Print = false;
        }