Skip to content

Commit

Permalink
working on converting to new implicit operand descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
John Detter committed Dec 20, 2016
1 parent 6fac704 commit 5e2a6d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions common/src/arch-x86.h
Expand Up @@ -652,6 +652,7 @@ enum { sNONE=0, // the instruction does something that cannot be classified as r
#define sGetImplicitOP3(b) ((b) & s3I)
#define sGetImplicitOP4(b) ((b) & s4I)
#define sGetImplicitOPs(b) ((b) & 0xFFFF0000)
#define sGetImplicitOP(b, i) ((b) & (1 << (16 + (i))))

/* Implicit mask setters */
#define sSetImplicitOP1(b) ((b) | s1I)
Expand All @@ -664,8 +665,8 @@ enum { sNONE=0, // the instruction does something that cannot be classified as r
#define sSetDecoration(b, dec) ((b) | (dec))

enum {
s1D = 1,
s1D2D
s1D = 1, /* Take decoration from 1st operand */
s1D2D /* Take decoration from 1st, 2nd operand in that order */
};

/* Masks */
Expand Down
13 changes: 7 additions & 6 deletions instructionAPI/src/InstructionDecoder-x86.C
Expand Up @@ -84,6 +84,7 @@ namespace Dyninst
case sNONE:
return false;
default:
return false;
// printf("OPSEMA: %d\n", opsema);
assert(!"Unknown opsema!");
return false;
Expand Down Expand Up @@ -126,11 +127,9 @@ namespace Dyninst
}
}

bool implicitOperand(unsigned int opsema, unsigned int i)
bool implicitOperand(unsigned int implicit_operands, unsigned int i)
{
// unsigned int implicits = sGETIMPL(opsema);
// return ((0x1 << i) & implicits) != 0x0;
return false;
return sGetImplicitOP(implicit_opernds, i) != 0x0;
}


Expand Down Expand Up @@ -1817,6 +1816,8 @@ namespace Dyninst
if(!decodedInstruction || !decodedInstruction->getEntry()) return false;
unsigned int opsema = decodedInstruction->getEntry()->opsema;
unsigned int semantics = opsema & 0xFF;
unsigned int implicit_operands =
sGetImplicitOPs(decodedInstruction->getEntry()->impl_dec);
InstructionDecoder::buffer b(insn_to_complete->ptr(), insn_to_complete->size());

if (decodedInstruction->getEntry()->getID() == e_ret_near ||
Expand All @@ -1838,7 +1839,7 @@ namespace Dyninst
insn_to_complete,
readsOperand(semantics, i),
writesOperand(semantics, i),
implicitOperand(0x0, i)))
implicitOperand(implicit_operands, i)))
{
return false;
}
Expand All @@ -1853,7 +1854,7 @@ namespace Dyninst
insn_to_complete,
readsOperand(semantics, 3),
writesOperand(semantics, 3),
implicitOperand(0x0, 3)))
implicitOperand(implicit_operands, 3)))
{
return false;
}
Expand Down

0 comments on commit 5e2a6d0

Please sign in to comment.