mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
commit
8c304d01be
4 changed files with 32 additions and 11 deletions
|
@ -43,6 +43,11 @@ public class EndInstructionValueSolver extends AbstractExpressionSolver<EndInstr
|
||||||
AssemblyResolvedPatterns cur, Set<SolverHint> hints, String description) {
|
AssemblyResolvedPatterns cur, Set<SolverHint> hints, String description) {
|
||||||
throw new AssertionError(
|
throw new AssertionError(
|
||||||
"INTERNAL: Should never be asked to solve for " + AssemblyTreeResolver.INST_NEXT);
|
"INTERNAL: Should never be asked to solve for " + AssemblyTreeResolver.INST_NEXT);
|
||||||
|
/**
|
||||||
|
* I suppose we could instead throw NeedsBackfillExcpeiton(INST_NEXT) here, too, but this
|
||||||
|
* serves as a sanity check on the SLEIGH spec. I can't think of a good reason to try to
|
||||||
|
* solve INST_NEXT == const.
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,7 +19,7 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import ghidra.app.plugin.assembler.sleigh.sem.*;
|
import ghidra.app.plugin.assembler.sleigh.sem.*;
|
||||||
import ghidra.app.plugin.processors.sleigh.expression.EndInstructionValue;
|
import ghidra.app.plugin.processors.sleigh.expression.Next2InstructionValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Solves" expressions of {@code inst_next2}
|
* "Solves" expressions of {@code inst_next2}
|
||||||
|
@ -32,21 +32,22 @@ import ghidra.app.plugin.processors.sleigh.expression.EndInstructionValue;
|
||||||
* <b>NOTE:</b> This solver requires backfill, since the value of {@code inst_next2} is not known
|
* <b>NOTE:</b> This solver requires backfill, since the value of {@code inst_next2} is not known
|
||||||
* until possible prefixes have been considered.
|
* until possible prefixes have been considered.
|
||||||
*/
|
*/
|
||||||
public class Next2InstructionValueSolver extends AbstractExpressionSolver<EndInstructionValue> {
|
public class Next2InstructionValueSolver extends AbstractExpressionSolver<Next2InstructionValue> {
|
||||||
|
|
||||||
public Next2InstructionValueSolver() {
|
public Next2InstructionValueSolver() {
|
||||||
super(EndInstructionValue.class);
|
super(Next2InstructionValue.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AssemblyResolution solve(EndInstructionValue iv, MaskedLong goal, Map<String, Long> vals,
|
public AssemblyResolution solve(Next2InstructionValue iv, MaskedLong goal,
|
||||||
|
Map<String, Long> vals,
|
||||||
AssemblyResolvedPatterns cur, Set<SolverHint> hints, String description) {
|
AssemblyResolvedPatterns cur, Set<SolverHint> hints, String description) {
|
||||||
throw new AssertionError(
|
throw new AssertionError(
|
||||||
"INTERNAL: Should never be asked to solve for " + AssemblyTreeResolver.INST_NEXT2);
|
"INTERNAL: Should never be asked to solve for " + AssemblyTreeResolver.INST_NEXT2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaskedLong getValue(EndInstructionValue iv, Map<String, Long> vals,
|
public MaskedLong getValue(Next2InstructionValue iv, Map<String, Long> vals,
|
||||||
AssemblyResolvedPatterns cur) throws NeedsBackfillException {
|
AssemblyResolvedPatterns cur) throws NeedsBackfillException {
|
||||||
Long instNext = vals.get(AssemblyTreeResolver.INST_NEXT2);
|
Long instNext = vals.get(AssemblyTreeResolver.INST_NEXT2);
|
||||||
if (instNext == null) {
|
if (instNext == null) {
|
||||||
|
@ -56,12 +57,12 @@ public class Next2InstructionValueSolver extends AbstractExpressionSolver<EndIns
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInstructionLength(EndInstructionValue iv) {
|
public int getInstructionLength(Next2InstructionValue iv) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaskedLong valueForResolution(EndInstructionValue exp, Map<String, Long> vals,
|
public MaskedLong valueForResolution(Next2InstructionValue exp, Map<String, Long> vals,
|
||||||
AssemblyResolvedPatterns rc) {
|
AssemblyResolvedPatterns rc) {
|
||||||
Long instNext = vals.get(AssemblyTreeResolver.INST_NEXT2);
|
Long instNext = vals.get(AssemblyTreeResolver.INST_NEXT2);
|
||||||
if (instNext == null) {
|
if (instNext == null) {
|
||||||
|
|
|
@ -121,4 +121,19 @@ public class ARMAssemblyTest extends AbstractAssemblyTest {
|
||||||
assertOneCompatRestExact("vmov.i64 d0,simdExpand(0x1,0xe,0xb1)", "83:ff:31:0e", THUMB,
|
assertOneCompatRestExact("vmov.i64 d0,simdExpand(0x1,0xe,0xb1)", "83:ff:31:0e", THUMB,
|
||||||
0x00010100, "vmov.i64 d0,simdExpand(0x1,0xe,0xb1)");
|
0x00010100, "vmov.i64 d0,simdExpand(0x1,0xe,0xb1)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAssemble_T_tbb_mr0_r1() {
|
||||||
|
assertOneCompatRestExact("tbb [r0, r1]", "d0:e8:01:f0", THUMB, 0x00400000, "tbb [r0,r1]");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAssemble_T_tbb_mpc_r0() {
|
||||||
|
assertOneCompatRestExact("tbb [pc, r1]", "df:e8:01:f0", THUMB, 0x00400000, "tbb [pc,r1]");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAssemble_T_tbb_m0_r0() {
|
||||||
|
assertAllSyntaxErrors("tbb [0, r0]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4764,13 +4764,13 @@ thumbEndianNess: "BE" is op0=0xb658 { export 1:1; }
|
||||||
goto [pc];
|
goto [pc];
|
||||||
}
|
}
|
||||||
|
|
||||||
Pcrel: [cloc,Rm0003] is Rm0003 & thc0404=0 [ cloc = inst_next; ]
|
Pcrel: [pc,Rm0003] is Rm0003 & thc0404=0 & pc
|
||||||
{
|
{
|
||||||
local tmp = Rm0003; tmp = cloc + tmp; val:1 = *tmp; tmp = zext(val); export tmp;
|
local tmp = Rm0003; tmp = inst_next + tmp; val:1 = *tmp; tmp = zext(val); export tmp;
|
||||||
}
|
}
|
||||||
Pcrel: [cloc,Rm0003] is Rm0003 & thc0404=1 [ cloc = inst_next; ]
|
Pcrel: [pc,Rm0003] is Rm0003 & thc0404=1 & pc
|
||||||
{
|
{
|
||||||
local tmp = Rm0003; tmp = cloc + (tmp * 2); val:2 = *tmp; tmp = zext(val); export tmp;
|
local tmp = Rm0003; tmp = inst_next + (tmp * 2); val:2 = *tmp; tmp = zext(val); export tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
:tbb^ItCond Pcrel is TMode=1 & ItCond & op4=0xe8d & thc0003=15; op8=0xf0 & thc0507=0 & thc0404=0 & Pcrel
|
:tbb^ItCond Pcrel is TMode=1 & ItCond & op4=0xe8d & thc0003=15; op8=0xf0 & thc0507=0 & thc0404=0 & Pcrel
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue