Skip to content

Commit

Permalink
j|jx
Browse files Browse the repository at this point in the history
  • Loading branch information
imbillow committed Nov 21, 2024
1 parent c3e8782 commit 5915531
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions librz/arch/isa/xtensa/xtensa_il.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,14 @@ static RzAnalysisLiftedILOp op_isync(XtensaContext *ctx) {
return NOP();
}

static RzAnalysisLiftedILOp op_j(XtensaContext *ctx) {
return JMP(U32(PC + IMM(0)));
}

static RzAnalysisLiftedILOp op_jx(XtensaContext *ctx) {
return JMP(IREG(0));
}

#include <rz_il/rz_il_opbuilder_end.h>

static const fn_analyze_op_il fn_tbl[] = {
Expand Down Expand Up @@ -563,6 +571,8 @@ static const fn_analyze_op_il fn_tbl[] = {
[XTENSA_INS_FLOAT_S] = op_float_s,
[XTENSA_INS_FLOOR_S] = op_floor_s,
[XTENSA_INS_ISYNC] = op_isync,
[XTENSA_INS_J] = op_j,
[XTENSA_INS_JX] = op_jx,
};

void xtensa_analyze_op_rzil(XtensaContext *ctx, RzAnalysisOp *op) {
Expand Down
5 changes: 4 additions & 1 deletion test/db/asm/xtensa
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,7 @@ d "extui a2, a1, 0x13, 5" 102345 0x0 (set a2 (let at (var a1) (& (bv 32 0x3f) (l
d "extw" d02000 0x0 nop
d "float.s f2, a3, 1" 1023ca 0x0 (set f2 (cast 64 false (fbits (fcast_float ieee754-bin32 rna (div (var a3) (bv 32 0x0))))))
d "floor.s a2, f3, 1" 1023aa 0x0 (set a2 (fcast_sint 32 rna (*. rna (float 0 (var f3) ) (float 0 (bv 32 0x40000000) ))))
d "" 002000 0 ()
d "isync" 002000 0x0 nop
d "jx a1" a00100 0x0 (jmp (var a1))
d "j . +3" c6ffff 0x0 (jmp (bv 32 0x3))
d "j . +3" c6ffff 0x40000 (jmp (bv 32 0x40003))

0 comments on commit 5915531

Please sign in to comment.