Пример #1
0
        public static void ProbeTLB()
        {
            bool FoundEntry = false;

            for (uint i = 0; i < TLBEntries.Length; ++i)
            {
                TLBEntry Entry = TLBEntries[i];

                if ((Entry.Valid0 | Entry.Valid1) == 0)
                {
                    continue;
                }

                uint EntryHi = (uint)Registers.COP0.Reg[Registers.COP0.ENTRYHI_REG];
                uint VPN2    = (EntryHi & 0xFFFFE000) >> 13;
                uint ASID    = EntryHi & 0xFF;

                if (Entry.VPN2 == VPN2 && Entry.ASID == ASID)
                {
                    FoundEntry = true;
                    Registers.COP0.Reg[Registers.COP0.INDEX_REG] = i & 0x3F;
                    break;
                }
            }

            if (!FoundEntry)
            {
                throw new Common.Exceptions.TLBMissException("TLB Miss happened while probing the TLB.");
            }
        }
Пример #2
0
        public static void ReadTLBEntry()
        {
            TLBEntry Entry = TLBEntries[(uint)Registers.COP0.Reg[Registers.COP0.INDEX_REG] & 0x3F];

            Registers.COP0.Reg[Registers.COP0.ENTRYLO0_REG] = (Entry.PFN0 << 6)
                                                              | (byte)(Entry.Global0 & 0x1)
                                                              | (byte)((Entry.Valid0 & 0x1) << 1)
                                                              | (byte)((Entry.Dirty0 & 0x1) << 2)
                                                              | (byte)((Entry.PageCoherency0 & 0b111) << 3);
            Registers.COP0.Reg[Registers.COP0.ENTRYLO1_REG] = (Entry.PFN1 << 6)
                                                              | (byte)(Entry.Global1 & 0x1)
                                                              | (byte)((Entry.Valid1 & 0x1) << 1)
                                                              | (byte)((Entry.Dirty1 & 0x1) << 2)
                                                              | (byte)((Entry.PageCoherency1 & 0b111) << 3);

            Registers.COP0.Reg[Registers.COP0.PAGEMASK_REG] = (uint)(Entry.PageMask << 13);
            Registers.COP0.Reg[Registers.COP0.ENTRYHI_REG]  = (Entry.VPN2 << 13) | Entry.ASID;
        }
Пример #3
0
 internal TLBEntryInfo(Int32 index, TLBEntry entry)
 {
     m_TLBIndex = index;
     m_Entry = entry;
 }
Пример #4
0
 public TlbModelEntry(Int32 index, TLBEntry entry)
 {
     m_EntryIndex = index;
     m_AssociatedEntry = entry;
 }