Merge pull request #4854 from lioncash/constant
PowerPC: Convert #defines into typed constants
This commit is contained in:
commit
b41921935c
|
@ -1028,7 +1028,7 @@ static void UpdateTLBEntry(const XCheckTLBFlag flag, UPTE2 PTE2, const u32 addre
|
||||||
|
|
||||||
const int tag = address >> HW_PAGE_INDEX_SHIFT;
|
const int tag = address >> HW_PAGE_INDEX_SHIFT;
|
||||||
TLBEntry& tlbe = ppcState.tlb[IsOpcodeFlag(flag)][tag & HW_PAGE_INDEX_MASK];
|
TLBEntry& tlbe = ppcState.tlb[IsOpcodeFlag(flag)][tag & HW_PAGE_INDEX_MASK];
|
||||||
const int index = tlbe.recent == 0 && tlbe.tag[0] != TLB_TAG_INVALID;
|
const int index = tlbe.recent == 0 && tlbe.tag[0] != TLBEntry::INVALID_TAG;
|
||||||
tlbe.recent = index;
|
tlbe.recent = index;
|
||||||
tlbe.paddr[index] = PTE2.RPN << HW_PAGE_INDEX_SHIFT;
|
tlbe.paddr[index] = PTE2.RPN << HW_PAGE_INDEX_SHIFT;
|
||||||
tlbe.pte[index] = PTE2.Hex;
|
tlbe.pte[index] = PTE2.Hex;
|
||||||
|
@ -1040,12 +1040,12 @@ void InvalidateTLBEntry(u32 address)
|
||||||
const u32 entry_index = (address >> HW_PAGE_INDEX_SHIFT) & HW_PAGE_INDEX_MASK;
|
const u32 entry_index = (address >> HW_PAGE_INDEX_SHIFT) & HW_PAGE_INDEX_MASK;
|
||||||
|
|
||||||
TLBEntry& tlbe = ppcState.tlb[0][entry_index];
|
TLBEntry& tlbe = ppcState.tlb[0][entry_index];
|
||||||
tlbe.tag[0] = TLB_TAG_INVALID;
|
tlbe.tag[0] = TLBEntry::INVALID_TAG;
|
||||||
tlbe.tag[1] = TLB_TAG_INVALID;
|
tlbe.tag[1] = TLBEntry::INVALID_TAG;
|
||||||
|
|
||||||
TLBEntry& tlbe_i = ppcState.tlb[1][entry_index];
|
TLBEntry& tlbe_i = ppcState.tlb[1][entry_index];
|
||||||
tlbe_i.tag[0] = TLB_TAG_INVALID;
|
tlbe_i.tag[0] = TLBEntry::INVALID_TAG;
|
||||||
tlbe_i.tag[1] = TLB_TAG_INVALID;
|
tlbe_i.tag[1] = TLBEntry::INVALID_TAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Page Address Translation
|
// Page Address Translation
|
||||||
|
|
|
@ -37,14 +37,15 @@ enum class CoreMode
|
||||||
};
|
};
|
||||||
|
|
||||||
// TLB cache
|
// TLB cache
|
||||||
#define TLB_SIZE 128
|
constexpr size_t TLB_SIZE = 128;
|
||||||
#define NUM_TLBS 2
|
constexpr size_t NUM_TLBS = 2;
|
||||||
#define TLB_WAYS 2
|
constexpr size_t TLB_WAYS = 2;
|
||||||
#define TLB_TAG_INVALID 0xffffffff
|
|
||||||
|
|
||||||
struct TLBEntry
|
struct TLBEntry
|
||||||
{
|
{
|
||||||
u32 tag[TLB_WAYS] = {TLB_TAG_INVALID, TLB_TAG_INVALID};
|
static constexpr u32 INVALID_TAG = 0xffffffff;
|
||||||
|
|
||||||
|
u32 tag[TLB_WAYS] = {INVALID_TAG, INVALID_TAG};
|
||||||
u32 paddr[TLB_WAYS] = {};
|
u32 paddr[TLB_WAYS] = {};
|
||||||
u32 pte[TLB_WAYS] = {};
|
u32 pte[TLB_WAYS] = {};
|
||||||
u8 recent = 0;
|
u8 recent = 0;
|
||||||
|
|
Loading…
Reference in New Issue