예제 #1
0
파일: TLB.cs 프로젝트: claassen/RIVM
        public void AddEntry(int vpn, int pfn)
        {
            bool success = false;

            for (int i = 0; i < _entries.Length; i++)
            {
                if (_entries[i] == null || !_entries[i].Valid)
                {
                    success = true;
                    _entries[i] = new TLBEntry()
                    {
                        Valid = true,
                        VPN = vpn,
                        PFN = pfn
                    };
                }
            }

            while (!success)
            {
                //Eject a random entry (only if it's not marked as permanent)
                int index = new Random().Next(_entries.Length);

                if (!_entries[index].Permanent)
                {
                    _entries[index] = new TLBEntry()
                    {
                        Valid = true,
                        VPN = vpn,
                        PFN = pfn
                    };

                    success = true;
                }
            }
        }
예제 #2
0
파일: TLB.cs 프로젝트: claassen/RIVM
        public void AddEntry(int vpn, int pfn)
        {
            bool success = false;

            for (int i = 0; i < _entries.Length; i++)
            {
                if (_entries[i] == null || !_entries[i].Valid)
                {
                    success     = true;
                    _entries[i] = new TLBEntry()
                    {
                        Valid = true,
                        VPN   = vpn,
                        PFN   = pfn
                    };
                }
            }

            while (!success)
            {
                //Eject a random entry (only if it's not marked as permanent)
                int index = new Random().Next(_entries.Length);

                if (!_entries[index].Permanent)
                {
                    _entries[index] = new TLBEntry()
                    {
                        Valid = true,
                        VPN   = vpn,
                        PFN   = pfn
                    };

                    success = true;
                }
            }
        }