summaryrefslogtreecommitdiff
path: root/arch/mips
diff options
context:
space:
mode:
authornoone <you@example.com>2024-07-31 22:48:31 -0500
committerAlexander Taylor <alex@vector35.com>2024-08-12 15:50:55 -0400
commitc6623fa5f2682f506d2d399d1b12547a195565f7 (patch)
tree3b32dfdadc29fbd870d0f98f472e70e20b7c712a /arch/mips
parent0b3adba96944076c8b1e4110f1698553bdfc265d (diff)
Add decode, disassembly, IL for TLBINV, TLBINVF
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/arch_mips.cpp15
-rw-r--r--arch/mips/il.cpp12
-rw-r--r--arch/mips/il.h2
-rw-r--r--arch/mips/mips/mips.c20
-rw-r--r--arch/mips/mips/mips.h2
5 files changed, 44 insertions, 7 deletions
diff --git a/arch/mips/arch_mips.cpp b/arch/mips/arch_mips.cpp
index 8d0c70ec..1632b165 100644
--- a/arch/mips/arch_mips.cpp
+++ b/arch/mips/arch_mips.cpp
@@ -979,6 +979,10 @@ public:
return "_readTLB";
case MIPS_INTRIN_TLBSEARCH:
return "_probeTLB";
+ case MIPS_INTRIN_TLBINV:
+ return "_invalidateTLB";
+ case MIPS_INTRIN_TLBINVF:
+ return "_invalidateTLBFlush";
case CNMIPS_INTRIN_SYNCIOBDMA:
return "_synciobdma";
@@ -1043,6 +1047,8 @@ public:
MIPS_INTRIN_TLBSET,
MIPS_INTRIN_TLBGET,
MIPS_INTRIN_TLBSEARCH,
+ MIPS_INTRIN_TLBINV,
+ MIPS_INTRIN_TLBINVF,
CNMIPS_INTRIN_SYNCIOBDMA,
CNMIPS_INTRIN_SYNCS,
@@ -1200,6 +1206,15 @@ public:
return {
NameAndType("match", Type::IntegerType(8, false)),
};
+ case MIPS_INTRIN_TLBINV:
+ return {
+ NameAndType("index", Type::IntegerType(8, false)),
+ NameAndType("match", Type::IntegerType(8, false)),
+ };
+ case MIPS_INTRIN_TLBINVF:
+ return {
+ NameAndType("index", Type::IntegerType(8, false)),
+ };
default:
return vector<NameAndType>();
}
diff --git a/arch/mips/il.cpp b/arch/mips/il.cpp
index d5bc1421..f14a8d3c 100644
--- a/arch/mips/il.cpp
+++ b/arch/mips/il.cpp
@@ -1876,6 +1876,18 @@ bool GetLowLevelILForInstruction(Architecture* arch, uint64_t addr, LowLevelILFu
}));
break;
+ case MIPS_TLBINV:
+ il.AddInstruction(il.Intrinsic({}, MIPS_INTRIN_TLBINV, {
+ il.Register(registerSize, REG_INDEX),
+ il.Register(registerSize, REG_ENTRY_HI)
+ }));
+ break;
+
+ case MIPS_TLBINVF:
+ il.AddInstruction(il.Intrinsic({}, MIPS_INTRIN_TLBINVF, {
+ il.Register(registerSize, REG_INDEX),
+ }));
+ break;
case CNMIPS_BADDU:
il.AddInstruction(SetRegisterOrNop(il, 8, registerSize, op1.reg,
diff --git a/arch/mips/il.h b/arch/mips/il.h
index 9a5a7999..df84f4a6 100644
--- a/arch/mips/il.h
+++ b/arch/mips/il.h
@@ -68,6 +68,8 @@ enum MipsIntrinsic : uint32_t
MIPS_INTRIN_TLBSET,
MIPS_INTRIN_TLBGET,
MIPS_INTRIN_TLBSEARCH,
+ MIPS_INTRIN_TLBINV,
+ MIPS_INTRIN_TLBINVF,
CNMIPS_INTRIN_SYNCIOBDMA,
CNMIPS_INTRIN_SYNCS,
diff --git a/arch/mips/mips/mips.c b/arch/mips/mips/mips.c
index 897a9a1e..7ab64f24 100644
--- a/arch/mips/mips/mips.c
+++ b/arch/mips/mips/mips.c
@@ -743,6 +743,8 @@ static const char* const OperationStrings[] = {
"tgei",
"tgeiu",
"tgeu",
+ "tlbinv",
+ "tlbinvf",
"tlbp",
"tlbr",
"tlbwi",
@@ -1400,13 +1402,15 @@ uint32_t mips_decompose_instruction(
{
switch (ins.r.function)
{
- case 1: instruction->operation = MIPS_TLBR; break;
- case 2: instruction->operation = MIPS_TLBWI; break;
- case 6: instruction->operation = MIPS_TLBWR; break;
- case 8: instruction->operation = MIPS_TLBP; break;
- case 24: instruction->operation = MIPS_ERET; break;
- case 31: instruction->operation = MIPS_DERET; break;
- case 32: instruction->operation = MIPS_WAIT; break;
+ case 1: instruction->operation = MIPS_TLBR; break;
+ case 2: instruction->operation = MIPS_TLBWI; break;
+ case 3: instruction->operation = MIPS_TLBINV; break;
+ case 4: instruction->operation = MIPS_TLBINVF; break;
+ case 6: instruction->operation = MIPS_TLBWR; break;
+ case 8: instruction->operation = MIPS_TLBP; break;
+ case 24: instruction->operation = MIPS_ERET; break;
+ case 31: instruction->operation = MIPS_DERET; break;
+ case 32: instruction->operation = MIPS_WAIT; break;
}
}
break;
@@ -1674,6 +1678,8 @@ uint32_t mips_decompose_instruction(
case MIPS_TLBWI:
case MIPS_TLBR:
case MIPS_TLBP:
+ case MIPS_TLBINV:
+ case MIPS_TLBINVF:
if (((ins.value >> 6) & 0x7ff) != 0 || ins.bits.bit25 != 1)
return 1;
break;
diff --git a/arch/mips/mips/mips.h b/arch/mips/mips/mips.h
index 48b68712..8725f97d 100644
--- a/arch/mips/mips/mips.h
+++ b/arch/mips/mips/mips.h
@@ -451,6 +451,8 @@ namespace mips
MIPS_TGEI,
MIPS_TGEIU,
MIPS_TGEU,
+ MIPS_TLBINV,
+ MIPS_TLBINVF,
MIPS_TLBP,
MIPS_TLBR,
MIPS_TLBWI,