Added the "nop" instruction for sparc{,64}

This commit is contained in:
Pierre Pronchery 2011-06-04 13:16:36 +00:00
parent 95ababcdfa
commit 7edc2f2b6a
3 changed files with 7 additions and 2 deletions

View File

@ -42,7 +42,7 @@ static int _sparc_decode(ArchPlugin * plugin, ArchInstructionCall * call)
u32 = _htob32(u32); u32 = _htob32(u32);
if((u32 & 0xc0000000) == 0xc0000000) /* load store */ if((u32 & 0xc0000000) == 0xc0000000) /* load store */
opcode = u32 & (0xc0000000 | (0xf << 19) | (0x1 << 13)); opcode = u32 & (0xc0000000 | (0xf << 19) | (0x1 << 13));
else if((u32 & 0xc1c00000) == 0x01000000) /* sethi */ else if((u32 & 0xc1c00000) == 0x01000000) /* nop, sethi */
opcode = u32 & (0x7 << 22); opcode = u32 & (0x7 << 22);
else if((u32 & 0xc0000000) == 0x80000000) /* integer arithmetic */ else if((u32 & 0xc0000000) == 0x80000000) /* integer arithmetic */
opcode = u32 & (0x80000000 | (0x1f << 19) | (0x1 << 13)); opcode = u32 & (0x80000000 | (0x1f << 19) | (0x1 << 13));
@ -272,6 +272,9 @@ static int _write_sethi(ArchPlugin * plugin, ArchInstruction * instruction,
char const * name; char const * name;
ArchRegister * ar; ArchRegister * ar;
/* nop */
if(AO_GET_TYPE(instruction->op1) == AOT_NONE)
return 0;
/* value */ /* value */
if(AO_GET_TYPE(instruction->op1) != AOT_IMMEDIATE) if(AO_GET_TYPE(instruction->op1) != AOT_IMMEDIATE)
return -1; return -1;

View File

@ -152,6 +152,7 @@
{ "ldub", OPLS1(ldub), OPLS1F, OPLS_RS12,OP_RD, AOT_NONE }, { "ldub", OPLS1(ldub), OPLS1F, OPLS_RS12,OP_RD, AOT_NONE },
{ "lduh", OPLS1(lduh), OPLS1F, OPLS_RS1, OP_RD, AOT_NONE }, { "lduh", OPLS1(lduh), OPLS1F, OPLS_RS1, OP_RD, AOT_NONE },
{ "lduh", OPLS1(lduh), OPLS1F, OPLS_RS12,OP_RD, AOT_NONE }, { "lduh", OPLS1(lduh), OPLS1F, OPLS_RS12,OP_RD, AOT_NONE },
{ "nop", OPSH(sethi), OPSHF, AOT_NONE, AOT_NONE, AOT_NONE },
{ "or", OPIA1(or), OPIA1F, OPIA_RS1, OPIA_RS2, OP_RD }, { "or", OPIA1(or), OPIA1F, OPIA_RS1, OPIA_RS2, OP_RD },
{ "or", OPIA2(or), OPIA2F, OPIA_RS1, OPIA_U12, OP_RD }, { "or", OPIA2(or), OPIA2F, OPIA_RS1, OPIA_U12, OP_RD },
{ "orcc", OPIA1(orcc), OPIA1F, OPIA_RS1, OPIA_RS2, OP_RD }, { "orcc", OPIA1(orcc), OPIA1F, OPIA_RS1, OPIA_RS2, OP_RD },
@ -160,11 +161,11 @@
{ "orn", OPIA2(orn), OPIA2F, OPIA_RS1, OPIA_U12, OP_RD }, { "orn", OPIA2(orn), OPIA2F, OPIA_RS1, OPIA_U12, OP_RD },
{ "orncc", OPIA1(orncc), OPIA1F, OPIA_RS1, OPIA_RS2, OP_RD }, { "orncc", OPIA1(orncc), OPIA1F, OPIA_RS1, OPIA_RS2, OP_RD },
{ "orncc", OPIA2(orncc), OPIA2F, OPIA_RS1, OPIA_U12, OP_RD }, { "orncc", OPIA2(orncc), OPIA2F, OPIA_RS1, OPIA_U12, OP_RD },
{ "sethi", OPSH(sethi), OPSHF, OPSH_U21, OP_RD, AOT_NONE },
{ "sdiv", OPIA1(sdiv), OPIA1F, OPIA_RS1, OPIA_RS2, OP_RD }, { "sdiv", OPIA1(sdiv), OPIA1F, OPIA_RS1, OPIA_RS2, OP_RD },
{ "sdiv", OPIA2(sdiv), OPIA2F, OPIA_RS1, OPIA_U12, OP_RD }, { "sdiv", OPIA2(sdiv), OPIA2F, OPIA_RS1, OPIA_U12, OP_RD },
{ "sdivcc", OPIA1(sdivcc), OPIA1F, OPIA_RS1, OPIA_RS2, OP_RD }, { "sdivcc", OPIA1(sdivcc), OPIA1F, OPIA_RS1, OPIA_RS2, OP_RD },
{ "sdivcc", OPIA2(sdivcc), OPIA2F, OPIA_RS1, OPIA_U12, OP_RD }, { "sdivcc", OPIA2(sdivcc), OPIA2F, OPIA_RS1, OPIA_U12, OP_RD },
{ "sethi", OPSH(sethi), OPSHF, OPSH_U21, OP_RD, AOT_NONE },
{ "smul", OPIA1(smul), OPIA1F, OPIA_RS1, OPIA_RS2, OP_RD }, { "smul", OPIA1(smul), OPIA1F, OPIA_RS1, OPIA_RS2, OP_RD },
{ "smul", OPIA2(smul), OPIA2F, OPIA_RS1, OPIA_S12, OP_RD }, { "smul", OPIA2(smul), OPIA2F, OPIA_RS1, OPIA_S12, OP_RD },
{ "smulcc", OPIA1(smulcc), OPIA1F, OPIA_RS1, OPIA_RS2, OP_RD }, { "smulcc", OPIA1(smulcc), OPIA1F, OPIA_RS1, OPIA_RS2, OP_RD },

View File

@ -36,6 +36,7 @@
ldub [%r23], %r19 ldub [%r23], %r19
lduh [%r4 + %r7], %r11 lduh [%r4 + %r7], %r11
lduh [%r23], %r19 lduh [%r23], %r19
nop
or %r16, %r26, %r27 or %r16, %r26, %r27
or %r29, -$23, %r19 or %r29, -$23, %r19
orcc %r16, %r26, %r27 orcc %r16, %r26, %r27