mirror of
https://github.com/PSI-Rockin/DobieStation.git
synced 2024-05-20 13:08:11 -04:00
Merge pull request #438 from refractionpcsx2/ee_tlbr
EE: Implement TLBR operation
This commit is contained in:
commit
a3a420eee6
|
@ -223,6 +223,19 @@ bool Cop0::int_pending()
|
|||
return false;
|
||||
}
|
||||
|
||||
void Cop0::read_tlb(int index)
|
||||
{
|
||||
TLB_Entry* entry = &tlb[index];
|
||||
//PageMask
|
||||
gpr[5] = entry->page_mask << 13;
|
||||
//EntryHi (VPN | ASID) & ~PageMask
|
||||
gpr[10] = ((entry->vpn2 << 13) | entry->asid) & ~gpr[5];
|
||||
//EntryLo0
|
||||
gpr[2] = (entry->is_scratchpad << 31) | (entry->pfn[1] << 6) | (entry->cache_mode[1] << 3) | (entry->dirty[1] << 2) | (entry->valid[1] << 1) | entry->global;
|
||||
//EntryLo1
|
||||
gpr[3] = (entry->pfn[0] << 6) | (entry->cache_mode[0] << 3) | (entry->dirty[0] << 2) | (entry->valid[0] << 1) | entry->global;
|
||||
}
|
||||
|
||||
void Cop0::set_tlb(int index)
|
||||
{
|
||||
TLB_Entry* new_entry = &tlb[index];
|
||||
|
|
|
@ -123,6 +123,7 @@ class Cop0
|
|||
|
||||
void count_up(int cycles);
|
||||
|
||||
void read_tlb(int index);
|
||||
void set_tlb(int index);
|
||||
void clear_tlb_modified(size_t page);
|
||||
void set_tlb_modified(size_t page);
|
||||
|
|
|
@ -3405,6 +3405,11 @@ void EE_JitTranslator::translate_op_cop0_type2(uint32_t opcode, uint32_t PC, EE_
|
|||
|
||||
switch (op)
|
||||
{
|
||||
case 0x01:
|
||||
// TLBR
|
||||
Errors::print_warning("[EE_JIT] Unrecognized cop0 type2 op TLBR\n", op);
|
||||
instrs.push_back(instr);
|
||||
break;
|
||||
case 0x02:
|
||||
// TLBWI
|
||||
Errors::print_warning("[EE_JIT] Unrecognized cop0 type2 op TLBWI\n", op);
|
||||
|
|
|
@ -1064,6 +1064,12 @@ void EmotionEngine::set_int1_signal(bool value)
|
|||
printf("[EE] Set INT1\n");
|
||||
}
|
||||
|
||||
void EmotionEngine::tlbr()
|
||||
{
|
||||
int index = cp0->gpr[0];
|
||||
cp0->read_tlb(index);
|
||||
}
|
||||
|
||||
void EmotionEngine::tlbwi()
|
||||
{
|
||||
int index = cp0->gpr[0];
|
||||
|
|
|
@ -195,6 +195,7 @@ class EmotionEngine
|
|||
void set_int0_signal(bool value);
|
||||
void set_int1_signal(bool value);
|
||||
|
||||
void tlbr();
|
||||
void tlbwi();
|
||||
void tlbp();
|
||||
void eret();
|
||||
|
|
|
@ -911,6 +911,8 @@ string disasm_cop(uint32_t instruction, uint32_t instr_addr)
|
|||
uint8_t op2 = instruction & 0x3F;
|
||||
switch (op2)
|
||||
{
|
||||
case 0x1:
|
||||
return "tlbr";
|
||||
case 0x2:
|
||||
return "tlbwi";
|
||||
case 0x8:
|
||||
|
|
|
@ -985,6 +985,10 @@ void EmotionInterpreter::cache(EmotionEngine &cpu, uint32_t instruction)
|
|||
}
|
||||
}
|
||||
|
||||
void EmotionInterpreter::tlbr(EmotionEngine& cpu, uint32_t instruction)
|
||||
{
|
||||
cpu.tlbr();
|
||||
}
|
||||
|
||||
void EmotionInterpreter::tlbwi(EmotionEngine& cpu, uint32_t instruction)
|
||||
{
|
||||
|
@ -1050,6 +1054,10 @@ void EmotionInterpreter::cop(EE_InstrInfo& info, uint32_t instruction)
|
|||
uint8_t op2 = instruction & 0x3F;
|
||||
switch (op2)
|
||||
{
|
||||
case 0x1:
|
||||
info.interpreter_fn = &tlbr;
|
||||
info.pipeline = EE_InstrInfo::Pipeline::COP0;
|
||||
break;
|
||||
case 0x2:
|
||||
info.interpreter_fn = &tlbwi;
|
||||
info.pipeline = EE_InstrInfo::Pipeline::COP0;
|
||||
|
|
|
@ -320,6 +320,7 @@ namespace EmotionInterpreter
|
|||
|
||||
void cache(EmotionEngine& cpu, uint32_t instruction);
|
||||
|
||||
void tlbr(EmotionEngine& cpu, uint32_t instruction);
|
||||
void tlbwi(EmotionEngine& cpu, uint32_t instruction);
|
||||
void eret(EmotionEngine& cpu, uint32_t instruction);
|
||||
void ei(EmotionEngine& cpu, uint32_t instruction);
|
||||
|
|
Loading…
Reference in a new issue