Disassembling some more Dalvik
This commit is contained in:
parent
5e227be104
commit
e243a69199
@ -29,7 +29,7 @@ typedef struct _DalvikDecode
|
||||
ArchPlugin * plugin;
|
||||
ArchInstructionCall * call;
|
||||
|
||||
uint8_t u8;
|
||||
int u8;
|
||||
} DalvikDecode;
|
||||
|
||||
|
||||
@ -146,9 +146,9 @@ static int _dalvik_decode(ArchPlugin * plugin, ArchInstructionCall * call)
|
||||
ArchInstruction * ai;
|
||||
size_t i;
|
||||
|
||||
memset(&dd, 0, sizeof(dd));
|
||||
dd.plugin = plugin;
|
||||
dd.call = call;
|
||||
dd.u8 = -1;
|
||||
/* FIXME detect end of input */
|
||||
if(helper->read(helper->arch, &u8, sizeof(u8)) != sizeof(u8))
|
||||
return -1;
|
||||
@ -181,7 +181,17 @@ static int _decode_immediate(DalvikDecode * dd, size_t i)
|
||||
switch(AO_GET_SIZE(dd->call->operands[i].type))
|
||||
{
|
||||
case 4:
|
||||
ao->value.immediate.value = dd->u8 & 0xf;
|
||||
if(dd->u8 >= 0)
|
||||
{
|
||||
ao->value.immediate.value = dd->u8 & 0xf;
|
||||
dd->u8 = -1;
|
||||
break;
|
||||
}
|
||||
if(helper->read(helper->arch, &u8, sizeof(u8))
|
||||
!= sizeof(u8))
|
||||
return -1;
|
||||
ao->value.immediate.value = u8 >> 4;
|
||||
dd->u8 = u8;
|
||||
break;
|
||||
case 8:
|
||||
if(helper->read(helper->arch, &u8, sizeof(u8))
|
||||
@ -237,6 +247,12 @@ static int _decode_register(DalvikDecode * dd, size_t i)
|
||||
switch(AO_GET_VALUE(dd->call->operands[i].type))
|
||||
{
|
||||
case 4:
|
||||
if(dd->u8 >= 0)
|
||||
{
|
||||
id = dd->u8 & 0xf;
|
||||
dd->u8 = -1;
|
||||
break;
|
||||
}
|
||||
if(helper->read(helper->arch, &u8, sizeof(u8))
|
||||
!= sizeof(u8))
|
||||
return -1;
|
||||
|
@ -91,7 +91,7 @@
|
||||
{ "const-class", 0x1c, OP1F, OP_REGISTER, OP_U16, AOT_NONE },
|
||||
{ "const-string", 0x1a, OP1F, OP_REG8, OP_U16, AOT_NONE },
|
||||
{ "const-wide", 0x18, OP1F, OP_REGISTER, OP_U64, AOT_NONE },
|
||||
{ "const-wide/16", 0x16, OP1F, OP_REGISTER, OP_U16, AOT_NONE },
|
||||
{ "const-wide/16", 0x16, OP1F, OP_REG8, OP_U16, AOT_NONE },
|
||||
{ "const-wide/32", 0x17, OP1F, OP_REGISTER, OP_U32, AOT_NONE },
|
||||
{ "div-double", 0xae, OP1F, OP_REGISTER, OP_REGISTER, OP_REGISTER },
|
||||
{ "div-double/2addr", 0xce, OP1F, OP_v0, OP_REGISTER, AOT_NONE },
|
||||
@ -171,9 +171,7 @@
|
||||
#endif
|
||||
{ "monitor-enter", 0x1d, OP1F, OP_REGISTER, AOT_NONE, AOT_NONE },
|
||||
{ "monitor-exit", 0x1e, OP1F, OP_REGISTER, AOT_NONE, AOT_NONE },
|
||||
#if 1 /* XXX really implement */
|
||||
{ "move", 0x01, OP1F, OP_v0, OP_REGISTER, AOT_NONE },
|
||||
#endif
|
||||
{ "move", 0x01, OP1F, OP_REG4, OP_REG4, AOT_NONE },
|
||||
{ "move/16", 0x03, OP1F, OP_REGISTER, OP_REGISTER, AOT_NONE },
|
||||
{ "move/from16", 0x02, OP1F, OP_REGISTER, OP_REGISTER, AOT_NONE },
|
||||
{ "move-exception", 0x0d, OP1F, OP_REGISTER, AOT_NONE, AOT_NONE },
|
||||
|
Loading…
Reference in New Issue
Block a user