Skip to content

Commit

Permalink
Set refptr for Xtensa l32r opcode for better disassembly output
Browse files Browse the repository at this point in the history
  • Loading branch information
bucienator committed Jan 14, 2023
1 parent 4a9740d commit c505fdd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions librz/analysis/p/analysis_xtensa.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ static void xtensa_shr_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, con
static void xtensa_l32r_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *buf) {
op->type = RZ_ANALYSIS_OP_TYPE_LOAD;
op->ptr = ((addr + 3) & ~3) + ((buf[2] << 8 | buf[1]) << 2) - 0x40000;
op->refptr = 4;
}

static void xtensa_snm0_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *buf) {
Expand Down
15 changes: 15 additions & 0 deletions test/db/analysis/xtensa
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,18 @@ var int32_t var_8h @ stack - 0x8
var int32_t var_4h @ stack - 0x4
EOF
RUN


NAME=xtensa l32r refptr
FILE=malloc://512
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
wx 00000000ff11ff1121ffff0df0ff
pD 3 @ 8
EOF
EXPECT=<<EOF
0x00000008 l32r a2, 0x00000004 ; [0x4:4]=0x11ff11ff
EOF
RUN

0 comments on commit c505fdd

Please sign in to comment.