コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         objPageManager = new PageManager();
         PageTable objTable = null;
         objTable = objPageManager.FetchPage(1);
         if (objTable.Rows.Count > 0)
         {
             lblCompanyProfile.Text = objTable.Rows[0][PageTable.PAGECONTENT_FIELD].ToString();
         }
         BindHeaders(objTable.Rows[0][PageTable.PAGEMETAKEYWORDS_FIELD].ToString(), objTable.Rows[0][PageTable.PAGEMETADESCRIPTION_FIELD].ToString());
         Page.Title = objTable.Rows[0][PageTable.PAGETITLE_FIELD].ToString();
         objTable   = objPageManager.FetchPage(2);
         if (objTable.Rows.Count > 0)
         {
             lblJobPositions.Text = objTable.Rows[0][PageTable.PAGECONTENT_FIELD].ToString();
         }
         loadAllService();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        /// <summary>
        /// Creates a new instance of the host mapped memory manager.
        /// </summary>
        /// <param name="backingMemory">Physical backing memory where virtual memory will be mapped to</param>
        /// <param name="addressSpaceSize">Size of the address space</param>
        /// <param name="unsafeMode">True if unmanaged access should not be masked (unsafe), false otherwise.</param>
        /// <param name="invalidAccessHandler">Optional function to handle invalid memory accesses</param>
        public MemoryManagerHostMapped(MemoryBlock backingMemory, ulong addressSpaceSize, bool unsafeMode, InvalidAccessHandler invalidAccessHandler = null)
        {
            _backingMemory        = backingMemory;
            _pageTable            = new PageTable <ulong>();
            _invalidAccessHandler = invalidAccessHandler;
            _unsafeMode           = unsafeMode;
            _addressSpaceSize     = addressSpaceSize;

            ulong asSize = PageSize;
            int   asBits = PageBits;

            while (asSize < addressSpaceSize)
            {
                asSize <<= 1;
                asBits++;
            }

            AddressSpaceBits = asBits;

            _pageBitmap = new ulong[1 << (AddressSpaceBits - (PageBits + PageToPteShift))];

            MemoryAllocationFlags asFlags = MemoryAllocationFlags.Reserve | MemoryAllocationFlags.ViewCompatible;

            _addressSpace       = new MemoryBlock(asSize, asFlags);
            _addressSpaceMirror = new MemoryBlock(asSize, asFlags | MemoryAllocationFlags.ForceWindows4KBViewMapping);

            Tracking  = new MemoryTracking(this, PageSize, invalidAccessHandler);
            _memoryEh = new MemoryEhMeilleure(_addressSpace, Tracking);
        }
コード例 #3
0
 public static void Setup()
 {
     Screen.Clear();
     Screen.Color = 0x0E;
     Screen.SetCursor(24, 0);
     Screen.Write('1');
     Multiboot.Setup();
     Screen.SetCursor(24, 1);
     Screen.Write('2');
     PIC.Setup();
     Screen.SetCursor(24, 2);
     Screen.Write('3');
     GDT.Setup();
     Screen.SetCursor(24, 3);
     Screen.Write('4');
     IDT.Setup();
     Screen.SetCursor(24, 4);
     Screen.Write('5');
     PageFrameAllocator.Setup();
     Screen.SetCursor(24, 5);
     Screen.Write('6');
     PageTable.Setup();
     Screen.SetCursor(24, 6);
     Screen.Write('7');
     VirtualPageAllocator.Setup();
     Screen.SetCursor(24, 7);
     Screen.Write('8');
     Screen.SetCursor(24, 8);
     ProcessManager.Setup();
     Screen.Write('9');
     Screen.SetCursor(24, 9);
     TaskManager.Setup();
     Screen.Write('A');
     Screen.SetCursor(24, 10);
 }
コード例 #4
0
    private void loadAllService()
    {
        PageManager objPageManager1 = new PageManager();
        PageTable   dtPage1         = new PageTable();

        dtPage1 = objPageManager1.FetchServicePages();
    }
コード例 #5
0
        public void loadProcess(int pId, int textSegmentSize, int dataSegmentSize)
        {
            int numTextSegmentPages = (int)Math.Ceiling((double)textSegmentSize / pageSize);
            int numDataSegmentPages = (int)Math.Ceiling((double)dataSegmentSize / pageSize);

            //Create page tables for each segment of the process.
            PageTable textTable = new PageTable("text", numTextSegmentPages);
            PageTable dataTable = new PageTable("data", numDataSegmentPages);

            //Create an inner page to hold the two page tables.
            InnerPage innerPage;

            //Find a frame for each text segment and update the page table and the frame table.
            for (int i = 0; i < numTextSegmentPages; ++i)
            {
                for (int j = 0; j < numFrames; ++j)
                {
                    //See if frame is empty.
                    if (string.IsNullOrEmpty(frameTable[j]))
                    {
                        //Assign the page to an empty frame.
                        frameTable[j] = "P" + pId.ToString() + " Text Page " + i.ToString();
                        physicalMListRowData[j].frameInfoXAML = frameTable[j];
                        textTable.Table[i] = j;
                        break;
                    }
                }
            }

            //Find a frame for each data segment and update the page table and the frame table.
            for (int i = 0; i < numDataSegmentPages; ++i)
            {
                for (int j = 0; j < numFrames; ++j)
                {
                    //See if frame is empty.
                    if (string.IsNullOrEmpty(frameTable[j]))
                    {
                        //Assign the page to an empty frame.
                        frameTable[j] = "P" + pId.ToString() + " Data Page " + i.ToString();
                        physicalMListRowData[j].frameInfoXAML = frameTable[j];
                        dataTable.Table[i] = j;
                        break;
                    }
                }
            }

            //For GUI
            String textKey = pId.ToString() + "0";
            String dataKey = pId.ToString() + "1";

            makeRows(textKey, textTable);
            makeRows(dataKey, dataTable);
            //End for GUI

            //Create and populate the inner page.
            innerPage = new InnerPage(pId, textTable, dataTable);

            //Add the inner page to the outer page table.
            outerPageTable.Add(pId, innerPage);
        }
コード例 #6
0
ファイル: AoiteTableTests.cs プロジェクト: yufengfei/Aoite
        public void Test()
        {
            PageTable t = new PageTable();

            t.Total = 10;
            Assert.Equal(10, t.Total);
        }
コード例 #7
0
 /// <summary>
 /// Interpret the pointer as a stack pointer to determine the stack
 /// height.
 /// </summary>
 /// <param name="stackPointer">Pointer into the stack.</param>
 /// <returns>The stack height of the location pointed to by the
 /// argument.</returns>
 internal StackHeight(UIntPtr stackPointer)
 {
     VTable.Assert(stackPointer == UIntPtr.Zero ||
                   (PageTable.Type(PageTable.Page(stackPointer))
                    == PageType.Stack));
     this.stackPointer = stackPointer;
 }
コード例 #8
0
        private PageTable GetOrCreateTable(int directory_index)
        {
            if (Directory[directory_index] == null)
            {
                Directory[directory_index] = new PageTable(directory_index);
            }

            return(Directory[directory_index]);
        }
コード例 #9
0
ファイル: VirtualMachine.cs プロジェクト: jokubasb/My-OS
 public VirtualMachine(VirtualMachine oldVirtualMachine)
 {
     this.PC         = oldVirtualMachine.PC;
     this.SP         = oldVirtualMachine.SP;
     this.IsFinished = oldVirtualMachine.IsFinished;
     this.Name       = oldVirtualMachine.Name;
     this.pg         = new PageTable(oldVirtualMachine.pg, oldVirtualMachine.PagesNumber);
     this.rm         = oldVirtualMachine.rm;
 }
コード例 #10
0
        public void PageTableTest1()
        {
            List <PageTableEntry> entries = new List <PageTableEntry>();

            entries.Add(new PageTableEntry(0, 0, 0, false, new MemoryPage(0, 0, "Unit Test", -1)));
            PageTable t = new PageTable(0, entries);

            Assert.IsTrue(t is PageTable && t.Entries.Count == 1);
        }
コード例 #11
0
ファイル: FrameBuffer.cs プロジェクト: gitter-badger/lonos
        private void RequestPhysicalMemory(uint address, uint size)
        {
            // Map physical memory space to virtual memory space
            for (uint at = address; at < address + size; at += 4096)
            {
                PageTable.MapVirtualAddressToPhysical(at, at);
            }

            //return new Memory(new IntPtr(address), size);
        }
コード例 #12
0
        public void SwapOutTest()
        {
            PhysicalMemory mem   = new PhysicalMemory(10);
            PageTable      table = new PageTable(0);
            MemoryPage     m     = new MemoryPage(0, 0, "Unit Test", -1);

            mem.AddPage(m, 0);
            m.SwapOut(0, 0);
            Assert.IsTrue(table.Entries[0].SwappedOut);
        }
コード例 #13
0
        /// <summary>
        /// Requests a block of memory from the kernel
        /// </summary>
        /// <param name="address">The address.</param>
        /// <param name="size">The size.</param>
        /// <returns></returns>
        public override BaseMemory RequestPhysicalMemory(uint address, uint size)
        {
            // Map physical memory space to virtual memory space
            for (uint at = address; at < address + size; at += 4096)
            {
                PageTable.MapVirtualAddressToPhysical(at, at);
            }

            return(new Memory(address, size));
        }
コード例 #14
0
        /// <summary>
        /// Gets a block of memory from the kernel
        /// </summary>
        /// <param name="address">The address.</param>
        /// <param name="size">The size.</param>
        /// <returns></returns>
        public override Memory GetPhysicalMemory(uint address, uint size)
        {
            // Map physical memory space to virtual memory space
            for (uint at = address; at < address + size; at += PageSize)
            {
                PageTable.MapVirtualAddressToPhysical(at, at);
            }

            return(new Memory(new IntPtr(address), size));
        }
コード例 #15
0
        /// <summary>
        /// Requests a block of memory from the kernel
        /// </summary>
        /// <param name="address">The address.</param>
        /// <param name="size">The size.</param>
        /// <returns></returns>
        IMemory IHardwareAbstraction.RequestPhysicalMemory(uint address, uint size)
        {
            // Map physical memory space to virtual memory space
            for (uint at = address; at < address + size; address = address + 4096)
            {
                PageTable.MapVirtualAddressToPhysical(address, address);
            }

            return(new Memory(address, size));
        }
コード例 #16
0
        /// <summary>
        /// Gets the page table of the currently selected process and displays it in the lower-left DataGrid.
        /// </summary>
        /// <param name="processName">The name of the Border associated to the selected process.</param>
        private void GetProcessPageTableInfo(string processName)
        {
            int       pid = Int32.Parse(processName[1].ToString());
            PageTable pt  = OS.GetRunningProcesses()[pid].PageTable;

            ProcessPageTable = new ObservableCollection <Machine.Components.Page>(pt.GetPageTableInfo());
            dgProcessPageTable.Columns.Clear();
            dgProcessPageTable.ItemsSource = ProcessPageTable;
            SetColumnNames();
            SwitchProcessBorderColor(processName);
        }
コード例 #17
0
ファイル: ProcessContextBlock.cs プロジェクト: andy-uq/TinyOS
        public ProcessContextBlock()
        {
            Registers = new uint[10];
            Locks = new HashSet<Lock>();

            Stack = new PageInfo();
            Code = new PageInfo();
            GlobalData = new PageInfo();

            PageTable = new PageTable {Code, GlobalData, Stack};
        }
コード例 #18
0
ファイル: VirtualMachine.cs プロジェクト: jokubasb/My-OS
 public VirtualMachine(RealMachine realMachine, int CodeSize, int MaxPages)
 {
     rm          = realMachine;
     pg          = new PageTable(rm, MaxPages);
     PC          = 0;
     SP          = 0;
     PagesNumber = MaxPages;
     CS          = 0;
     DS          = CodeSize;
     SS          = ((MaxPages - CodeSize) - (MaxPages - CodeSize) / 2) + CodeSize;
 }
コード例 #19
0
        /// <summary>
        /// Gets a block of memory from the kernel
        /// </summary>
        /// <param name="address">The address.</param>
        /// <param name="size">The size.</param>
        /// <returns></returns>
        public override ConstrainedPointer GetPhysicalMemory(IntPtr address, uint size)
        {
            var start = (uint)address.ToInt32();

            // Map physical memory space to virtual memory space
            for (var at = start; at < start + size; at += PageSize)
            {
                PageTable.MapVirtualAddressToPhysical(at, at);
            }

            return(new ConstrainedPointer(address, size));
        }
コード例 #20
0
        /// <summary>
        /// Создает новый процесс
        /// </summary>
        /// <param name="memory">количество требуемой памяти в байтах</param>
        public void CreateNewProcess(string name, int memory, int prioryty)
        {
            int pid = 0;

            // вычислить размер таблицы - количество страниц для храненния таблицы
            int pageCountForTable = PageNumberForTable(memory * 2);

            try
            {
                BitArray[] bits      = GetFreePages(GetFreePageIndexesInListOfPages(pageCountForTable), out uint offset);
                PageTable  pageTable = new PageTable(offset, ref bits, pageCountForTable);
                pid = CreateRandomPid();
                //
                // инициализировать таблицу страниц
                //
                int pageCountToInit = memory / PageSize;
                if (FreePages.Count >= pageCountToInit)
                {
                    for (int i = 0; i < pageCountToInit; i++)
                    {
                        pageTable.PageTableEntries[i].Adress  = FreePages[0];
                        pageTable.PageTableEntries[i].Present = true;
                        FreePages.RemoveAt(0);
                    }
                }
                else
                {
                    throw new OutOfMemoryException("Невозможно выделить минимум памяти процессу");
                }
                processes.Add(new Process(name, memory, pid, prioryty, ref pageTable));
                //
                // создать файл на диске, отвечающий за данный процесс
                //
                //File.Create(CurrentDirectoryName + processes[processes.Count - 1].Name + ".prc");
                StreamWriter writer      = new StreamWriter(CurrentDirectoryName + "\\" + processes[processes.Count - 1].FileName);
                int          recordCount = processes[processes.Count - 1].WSClockEntryMirrors.Count;
                for (int i = 0; i < recordCount; i++)
                {
                    WritePageToDrive(writer, processes[processes.Count - 1].PageTable.PageTableEntries[i], i);
                    processes[processes.Count - 1].WSClockEntryMirrors[i].WrittenIntoFile = true;
                }
                writer.Close();
            }
            catch (OutOfMemoryException e)
            {
                MessageBox.Show(e.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (Exception)
            {
                MessageBox.Show("Произошло что-то непредвиденное", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #21
0
        /// <summary>
        /// Generates the processes that will be run during our simulation.
        /// </summary>
        /// <returns>The list of processes to be run during the simulation.</returns>
        internal List <Process> GenerateProcesses(int processesCount, int maxPagesPerProcess)
        {
            List <Process> processes = new List <Process>(processesCount);

            for (int pid = 0; pid < processesCount; pid++)
            {
                PageTable pageTable = new PageTable(Generate(1, maxPagesPerProcess));
                Process   process   = new Process(pid, pageTable);
                processes.Add(process);
            }

            return(processes);
        }
コード例 #22
0
    private void loadAllService()
    {
        PageManager objPageManager1 = new PageManager();
        PageTable   dtPage1         = new PageTable();

        dtPage1 = objPageManager1.FetchPage(9);

        //dlCountry.DataSource = dtPage1;
        //dlCountry.DataBind();

        BindHeaders(dtPage1.Rows[0][PageTable.PAGEMETAKEYWORDS_FIELD].ToString(), dtPage1.Rows[0][PageTable.PAGEMETADESCRIPTION_FIELD].ToString());
        Page.Title = dtPage1.Rows[0][PageTable.PAGETITLE_FIELD].ToString();
    }
コード例 #23
0
        public void makeRows(string key, PageTable pageTable)
        {
            for (int i = 0; i < pageTable.NumPages; ++i)
            {
                int page  = i;
                int frame = pageTable.Table[i];

                PageCellRow row = new PageCellRow(page, frame);
                cellRowDict[key].Add(row);
            }
            String XAMLCellName = "cell" + key;

            updateCellGUI(XAMLCellName, key);
        }
コード例 #24
0
    private void load_ClinicalStudyMgt()
    {
        objPageManager1 = new PageManager();
        PageTable objTable = new PageTable();

        objTable = objPageManager1.FetchServicePage(3);

        if (objTable.Rows.Count > 0)
        {
            div_clinicalstudymgt.InnerHtml = objTable.Rows[0][PageTable.SERVICECONTENT_FIELD].ToString();
        }
        BindHeaders(objTable.Rows[0][PageTable.PAGEMETAKEYWORDS_FIELD].ToString(), objTable.Rows[0][PageTable.PAGEMETADESCRIPTION_FIELD].ToString());
        Page.Title = objTable.Rows[0][PageTable.PAGETITLE_FIELD].ToString();
    }
コード例 #25
0
    private void load_ServicesOutSourcing()
    {
        objPageManager1 = new PageManager();
        PageTable dtPage1 = new PageTable();

        dtPage1 = objPageManager1.FetchServicePage(1);

        if (dtPage1.Rows.Count > 0)
        {
            div_servicesoutsourcing.InnerHtml = dtPage1.Rows[0][PageTable.SERVICECONTENT_FIELD].ToString();
        }
        BindHeaders(dtPage1.Rows[0][PageTable.PAGEMETAKEYWORDS_FIELD].ToString(), dtPage1.Rows[0][PageTable.PAGEMETADESCRIPTION_FIELD].ToString());
        Page.Title = dtPage1.Rows[0][PageTable.PAGETITLE_FIELD].ToString();
    }
コード例 #26
0
        public VirtualMachine(VirtualMachine oldVirtualMachine)
        {
            DP            = oldVirtualMachine.DP;
            PC            = oldVirtualMachine.PC;
            SP            = oldVirtualMachine.SP;
            Console       = new StringBuilder(oldVirtualMachine.Console.ToString());
            IsFinished    = oldVirtualMachine.IsFinished;
            Name          = oldVirtualMachine.Name;
            m_realMachine = oldVirtualMachine.m_realMachine;

            maxPID++;
            PID        = maxPID;
            PagesTable = new PageTable(oldVirtualMachine.PagesTable);
        }
コード例 #27
0
    private void load_ClinicalStudySetup()
    {
        objPageManager1 = new PageManager();
        PageTable dtPage1 = new PageTable();

        dtPage1 = objPageManager1.FetchServicePage(2);

        if (dtPage1.Rows.Count > 0)
        {
            div_clinicalstudysetup.InnerHtml = dtPage1.Rows[0][PageTable.SERVICECONTENT_FIELD].ToString();
        }
        BindHeaders(dtPage1.Rows[0][PageTable.PAGEMETAKEYWORDS_FIELD].ToString(), dtPage1.Rows[0][PageTable.PAGEMETADESCRIPTION_FIELD].ToString());
        Page.Title = dtPage1.Rows[0][PageTable.PAGETITLE_FIELD].ToString();
    }
コード例 #28
0
ファイル: MainWindow.xaml.cs プロジェクト: spmadeira/Bd2App
        private void WorkerOnRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            var hashResult = (HashResult)e.Result;

            LoadingIcon.Visibility     = Visibility.Hidden;
            ProgressBar.Visibility     = Visibility.Hidden;
            DataGrid.Visibility        = Visibility.Visible;
            StatisticsPanel.Visibility = Visibility.Visible;
            PageDataGrid.ItemsSource   = hashResult.PageRepresentations;
            BucketDataGrid.ItemsSource = hashResult.BucketRepresentations;
            Storage                = hashResult.Storage;
            PageTable              = hashResult.PageTable;
            OverflowLabel.Content  = $"{hashResult.overflowPct:0.######}%";
            CollisionLabel.Content = $"{hashResult.collisionsPct:0.######}%";
            AccessLabel.Content    = $"{hashResult.avgAccess:#.##}";
        }
コード例 #29
0
        /// <summary>
        /// 执行查询,并返回一张表。
        /// </summary>
        /// <param name="dbCommand">数据库命令。</param>
        /// <param name="dataAdpater">数据源适配器。</param>
        /// <returns>一张表。</returns>
        public static PageTable ExecuteTable(this DbCommand dbCommand, DbDataAdapter dataAdpater)
        {
            if (dbCommand == null)
            {
                throw new ArgumentNullException(nameof(dbCommand));
            }
            if (dataAdpater == null)
            {
                throw new ArgumentNullException(nameof(dataAdpater));
            }

            PageTable table = new PageTable();

            dataAdpater.Fill(table);
            table.Total = table.Rows.Count;
            return(table);
        }
コード例 #30
0
        public void haltProcess(int pId)
        {
            //Get a reference to the PCB node for the process.
            PCB PCBNode = findPCBNode(pId);

            //Get references to the processes page tables.
            PageTable textTable = PCBNode.InnerPage.TextTable;
            PageTable dataTable = PCBNode.InnerPage.DataTable;

            //Go through the text page table.
            for (int i = 0; i < PCBNode.NumTextPages; ++i)
            {
                //Find the frame number for each page in the text page table.
                int frame = textTable.Table[i];

                //Clear the frame.
                frameTable[frame] = "";
                physicalMListRowData[frame].frameInfoXAML = frameTable[frame];
            }

            //Go through the data page table.
            for (int i = 0; i < PCBNode.NumDataPages; ++i)
            {
                //Find the frame number for each page in the data page table.
                int frame = dataTable.Table[i];

                //Clear the frame.
                frameTable[frame] = "";
                physicalMListRowData[frame].frameInfoXAML = frameTable[frame];
            }

            //Remove the inner page table from the outer page table.
            outerPageTable.Remove(pId);

            //Remove the PCB from the PCB list. This removes all references to the page tables, so they should be garbage collected.
            pcbList.Remove(PCBNode);

            String   XAMLCellText = "cell" + pId.ToString() + "0";
            String   XAMLCellData = "cell" + pId.ToString() + "1";
            DataGrid gridText     = (DataGrid)App.Current.MainWindow.FindName(XAMLCellText);
            DataGrid dataText     = (DataGrid)App.Current.MainWindow.FindName(XAMLCellData);

            gridText.Opacity = 0.0;
            dataText.Opacity = 0.0;
        }
コード例 #31
0
        public void IndexTest()
        {
            var target = new SimpleDatabase_Accessor("RRR", false, true);

            target.CreateTable("Car", 96, 36);
            PageTable pt = target.DiskReadPageTable("Car");

            pt.InsertIndex("aa", 1, 1, 1, Guid.Empty);
            pt.InsertIndex("bb", 1, 1, 1, Guid.Empty);
            var r = new RecordIndexEntry
            {
                Key = "aa"
            };

            pt.WipeoutIndex(r, Guid.Empty);
            Assert.IsFalse((from i in pt.RecordIndices where i.Key == "aa" select i).Any());
            pt.InsertIndex("aa", 1, 1, 1, Guid.Empty);
            Assert.IsTrue(pt.RecordIndices[0].Key == "aa");
        }
コード例 #32
0
ファイル: DataContext.cs プロジェクト: Grim-Jokes/Ifba2Bbic
 partial void InsertPageTable(PageTable instance);
コード例 #33
0
        private PageTable GetOrCreateTable(int directory_index)
        {
            if (Directory[directory_index] == null)
                Directory[directory_index] = new PageTable(directory_index);

            return Directory[directory_index];
        }
コード例 #34
0
ファイル: DataContext.cs プロジェクト: Grim-Jokes/Ifba2Bbic
 partial void UpdatePageTable(PageTable instance);
コード例 #35
0
ファイル: DataContext.cs プロジェクト: Grim-Jokes/Ifba2Bbic
 partial void DeletePageTable(PageTable instance);
コード例 #36
0
 public Table(string name, PageTable pageTable, DataFileHeader fileHeader)
 {
     this.Name = name;
     this.PageTable = pageTable;
     this.FileHeader = fileHeader;
 }