Fix PPC ESIL of addis instruction ##esil

This commit is contained in:
max-lv 2022-03-26 01:14:19 -01:00 committed by pancake
parent 5abd6faf47
commit 7043983bd2
2 changed files with 34 additions and 1 deletions

View File

@ -929,8 +929,11 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAn
op->type = R_ANAL_OP_TYPE_ADD;
esilprintf (op, "%s,%s,+,%s,=", ARG (2), ARG (1), ARG (0));
break;
case PPC_INS_ADDE:
case PPC_INS_ADDIS:
op->type = R_ANAL_OP_TYPE_ADD;
esilprintf (op, "16,%s,<<,%s,+,%s,=", ARG (2), ARG (1), ARG (0));
break;
case PPC_INS_ADDE:
case PPC_INS_ADDME:
case PPC_INS_ADDZE:
op->type = R_ANAL_OP_TYPE_ADD;

View File

@ -42,3 +42,33 @@ bdnz 0xfffffffffffffff0
0x00000000 1,ctr,-=,$z,!,?{,0xfffffffffffffff0,pc,=,}
EOF
RUN
NAME=addis with positive number ppc-32
FILE=-
CMDS=<<EOF
e asm.arch=ppc
e asm.bits=32
e cfg.bigendian=true
(pi bytes;wx $0;pi 1;pie 1)
.(pi 3c4c0002)
EOF
EXPECT=<<EOF
addis r2, r12, 2
0x00000000 16,0x2,<<,r12,+,r2,=
EOF
RUN
NAME=addis with negative number ppc-32
FILE=-
CMDS=<<EOF
e asm.arch=ppc
e asm.bits=32
e cfg.bigendian=true
(pi bytes;wx $0;pi 1;pie 1)
.(pi 3c4cfffd)
EOF
EXPECT=<<EOF
addis r2, r12, -3
0x00000000 16,0xfffffffffffffffd,<<,r12,+,r2,=
EOF
RUN