Skip to content

Commit c6623fa

Browse files
noonefuzyll
authored andcommitted
Add decode, disassembly, IL for TLBINV, TLBINVF
1 parent 0b3adba commit c6623fa

File tree

5 files changed

+44
-7
lines changed

5 files changed

+44
-7
lines changed

arch/mips/arch_mips.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,10 @@ class MipsArchitecture: public Architecture
979979
return "_readTLB";
980980
case MIPS_INTRIN_TLBSEARCH:
981981
return "_probeTLB";
982+
case MIPS_INTRIN_TLBINV:
983+
return "_invalidateTLB";
984+
case MIPS_INTRIN_TLBINVF:
985+
return "_invalidateTLBFlush";
982986

983987
case CNMIPS_INTRIN_SYNCIOBDMA:
984988
return "_synciobdma";
@@ -1043,6 +1047,8 @@ class MipsArchitecture: public Architecture
10431047
MIPS_INTRIN_TLBSET,
10441048
MIPS_INTRIN_TLBGET,
10451049
MIPS_INTRIN_TLBSEARCH,
1050+
MIPS_INTRIN_TLBINV,
1051+
MIPS_INTRIN_TLBINVF,
10461052

10471053
CNMIPS_INTRIN_SYNCIOBDMA,
10481054
CNMIPS_INTRIN_SYNCS,
@@ -1200,6 +1206,15 @@ class MipsArchitecture: public Architecture
12001206
return {
12011207
NameAndType("match", Type::IntegerType(8, false)),
12021208
};
1209+
case MIPS_INTRIN_TLBINV:
1210+
return {
1211+
NameAndType("index", Type::IntegerType(8, false)),
1212+
NameAndType("match", Type::IntegerType(8, false)),
1213+
};
1214+
case MIPS_INTRIN_TLBINVF:
1215+
return {
1216+
NameAndType("index", Type::IntegerType(8, false)),
1217+
};
12031218
default:
12041219
return vector<NameAndType>();
12051220
}

arch/mips/il.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,6 +1876,18 @@ bool GetLowLevelILForInstruction(Architecture* arch, uint64_t addr, LowLevelILFu
18761876
}));
18771877
break;
18781878

1879+
case MIPS_TLBINV:
1880+
il.AddInstruction(il.Intrinsic({}, MIPS_INTRIN_TLBINV, {
1881+
il.Register(registerSize, REG_INDEX),
1882+
il.Register(registerSize, REG_ENTRY_HI)
1883+
}));
1884+
break;
1885+
1886+
case MIPS_TLBINVF:
1887+
il.AddInstruction(il.Intrinsic({}, MIPS_INTRIN_TLBINVF, {
1888+
il.Register(registerSize, REG_INDEX),
1889+
}));
1890+
break;
18791891

18801892
case CNMIPS_BADDU:
18811893
il.AddInstruction(SetRegisterOrNop(il, 8, registerSize, op1.reg,

arch/mips/il.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ enum MipsIntrinsic : uint32_t
6868
MIPS_INTRIN_TLBSET,
6969
MIPS_INTRIN_TLBGET,
7070
MIPS_INTRIN_TLBSEARCH,
71+
MIPS_INTRIN_TLBINV,
72+
MIPS_INTRIN_TLBINVF,
7173

7274
CNMIPS_INTRIN_SYNCIOBDMA,
7375
CNMIPS_INTRIN_SYNCS,

arch/mips/mips/mips.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,8 @@ static const char* const OperationStrings[] = {
743743
"tgei",
744744
"tgeiu",
745745
"tgeu",
746+
"tlbinv",
747+
"tlbinvf",
746748
"tlbp",
747749
"tlbr",
748750
"tlbwi",
@@ -1400,13 +1402,15 @@ uint32_t mips_decompose_instruction(
14001402
{
14011403
switch (ins.r.function)
14021404
{
1403-
case 1: instruction->operation = MIPS_TLBR; break;
1404-
case 2: instruction->operation = MIPS_TLBWI; break;
1405-
case 6: instruction->operation = MIPS_TLBWR; break;
1406-
case 8: instruction->operation = MIPS_TLBP; break;
1407-
case 24: instruction->operation = MIPS_ERET; break;
1408-
case 31: instruction->operation = MIPS_DERET; break;
1409-
case 32: instruction->operation = MIPS_WAIT; break;
1405+
case 1: instruction->operation = MIPS_TLBR; break;
1406+
case 2: instruction->operation = MIPS_TLBWI; break;
1407+
case 3: instruction->operation = MIPS_TLBINV; break;
1408+
case 4: instruction->operation = MIPS_TLBINVF; break;
1409+
case 6: instruction->operation = MIPS_TLBWR; break;
1410+
case 8: instruction->operation = MIPS_TLBP; break;
1411+
case 24: instruction->operation = MIPS_ERET; break;
1412+
case 31: instruction->operation = MIPS_DERET; break;
1413+
case 32: instruction->operation = MIPS_WAIT; break;
14101414
}
14111415
}
14121416
break;
@@ -1674,6 +1678,8 @@ uint32_t mips_decompose_instruction(
16741678
case MIPS_TLBWI:
16751679
case MIPS_TLBR:
16761680
case MIPS_TLBP:
1681+
case MIPS_TLBINV:
1682+
case MIPS_TLBINVF:
16771683
if (((ins.value >> 6) & 0x7ff) != 0 || ins.bits.bit25 != 1)
16781684
return 1;
16791685
break;

arch/mips/mips/mips.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,8 @@ namespace mips
451451
MIPS_TGEI,
452452
MIPS_TGEIU,
453453
MIPS_TGEU,
454+
MIPS_TLBINV,
455+
MIPS_TLBINVF,
454456
MIPS_TLBP,
455457
MIPS_TLBR,
456458
MIPS_TLBWI,

0 commit comments

Comments
 (0)